mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
MNT-12369 "CryptoDoc: Cluster: removeMasterKey operation removes master key alias only on one cluster node"
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@85879 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<bean id="ContentStore" class="org.alfresco.repo.management.subsystems.CryptodocSwitchableApplicationContextFactory"
|
||||
parent="abstractPropertyBackedBean">
|
||||
<property name="autoStart">
|
||||
<value>true</value>
|
||||
<value>false</value>
|
||||
</property>
|
||||
<property name="category">
|
||||
<value>ContentStore</value>
|
||||
|
@@ -49,6 +49,7 @@ Inbound settings from iBatis
|
||||
<typeAlias alias="ContentData" type="org.alfresco.repo.domain.contentdata.ContentDataEntity"/>
|
||||
<typeAlias alias="ContentUrlKey" type="org.alfresco.repo.domain.contentdata.ContentUrlKeyEntity"/>
|
||||
<typeAlias alias="ContentUrlOrphanQuery" type="org.alfresco.repo.domain.contentdata.ContentUrlOrphanQuery"/>
|
||||
<typeAlias alias="SymmetricKeyCount" type="org.alfresco.repo.domain.contentdata.SymmetricKeyCount"/>
|
||||
|
||||
<!-- Locale -->
|
||||
|
||||
|
@@ -10,6 +10,11 @@
|
||||
<!-- Result Maps -->
|
||||
<!-- -->
|
||||
|
||||
<resultMap id="result_SymmetricKeyCount" type="SymmetricKeyCount">
|
||||
<result property="masterKeyAlias" column="master_key_alias" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||
<result property="count" column="count" jdbcType="INTEGER" javaType="java.lang.Integer"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="result_Mimetype" type="Mimetype">
|
||||
<result property="id" column="id" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<result property="version" column="version" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
@@ -465,6 +470,15 @@
|
||||
order by e.id asc
|
||||
</select>
|
||||
|
||||
<select id="select_CountSymmetricKeysForAllMasterKeys" resultMap="result_SymmetricKeyCount">
|
||||
select e.master_key_alias as master_key_alias, count(*) as count
|
||||
from
|
||||
alf_content_url_encryption e
|
||||
group by
|
||||
e.master_key_alias
|
||||
having count(*) > 0
|
||||
</select>
|
||||
|
||||
<select id="select_CountSymmetricKeysByMasterKey" parameterType="String" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from
|
||||
|
@@ -20,6 +20,7 @@ package org.alfresco.repo.domain.contentdata;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
@@ -156,6 +157,14 @@ public interface ContentDataDAO
|
||||
*/
|
||||
List<ContentUrlKeyEntity> getSymmetricKeysByMasterKeyAlias(String masterKeyAlias, long fromId, int maxResults);
|
||||
|
||||
/**
|
||||
* Count symmetric keys entities for symmetric keys for all master keys
|
||||
*
|
||||
* @since 5.0
|
||||
* @return
|
||||
*/
|
||||
Map<String, Integer> countSymmetricKeysForMasterKeys();
|
||||
|
||||
/**
|
||||
* Count symmetric keys entities for symmetric keys that have been encrypted using the given
|
||||
* master key
|
||||
|
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2014-2014 Alfresco Software, Ltd. All rights reserved.
|
||||
*
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
*/
|
||||
package org.alfresco.repo.domain.contentdata;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sglover
|
||||
*
|
||||
*/
|
||||
public class SymmetricKeyCount implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -7823962733045613866L;
|
||||
|
||||
private String masterKeyAlias;
|
||||
private int count;
|
||||
|
||||
public SymmetricKeyCount()
|
||||
{
|
||||
}
|
||||
|
||||
public String getMasterKeyAlias()
|
||||
{
|
||||
return masterKeyAlias;
|
||||
}
|
||||
|
||||
public void setMasterKeyAlias(String masterKeyAlias)
|
||||
{
|
||||
this.masterKeyAlias = masterKeyAlias;
|
||||
}
|
||||
|
||||
public int getCount()
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count)
|
||||
{
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "SymmetricKeyCount [masterKeyAlias=" + masterKeyAlias
|
||||
+ ", count=" + count + "]";
|
||||
}
|
||||
}
|
@@ -34,6 +34,7 @@ import org.alfresco.repo.domain.contentdata.ContentUrlEntity;
|
||||
import org.alfresco.repo.domain.contentdata.ContentUrlKeyEntity;
|
||||
import org.alfresco.repo.domain.contentdata.ContentUrlOrphanQuery;
|
||||
import org.alfresco.repo.domain.contentdata.ContentUrlUpdateEntity;
|
||||
import org.alfresco.repo.domain.contentdata.SymmetricKeyCount;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.util.EqualsHelper;
|
||||
import org.alfresco.util.Pair;
|
||||
@@ -71,6 +72,7 @@ public class ContentDataDAOImpl extends AbstractContentDataDAOImpl
|
||||
private static final String INSERT_SYMMETRIC_KEY = "alfresco.content.insert.insert_KeyData";
|
||||
private static final String SELECT_SYMMETRIC_KEYS_BY_MASTER_KEY = "alfresco.content.select_SymmetricKeysByMasterKey";
|
||||
private static final String COUNT_SYMMETRIC_KEYS_BY_MASTER_KEY = "alfresco.content.select_CountSymmetricKeysByMasterKey";
|
||||
private static final String COUNT_SYMMETRIC_KEYS_FOR_MASTER_KEYS = "alfresco.content.select_CountSymmetricKeysForAllMasterKeys";
|
||||
|
||||
protected SqlSessionTemplate template;
|
||||
|
||||
@@ -336,6 +338,20 @@ public class ContentDataDAOImpl extends AbstractContentDataDAOImpl
|
||||
return results;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> countSymmetricKeysForMasterKeys()
|
||||
{
|
||||
Map<String, Integer> counts = new HashMap<>();
|
||||
|
||||
List<SymmetricKeyCount> res = template.selectList(COUNT_SYMMETRIC_KEYS_FOR_MASTER_KEYS);
|
||||
for(SymmetricKeyCount count : res)
|
||||
{
|
||||
counts.put(count.getMasterKeyAlias(), count.getCount());
|
||||
}
|
||||
|
||||
return counts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countSymmetricKeysForMasterKeyAlias(String masterKeyAlias)
|
||||
{
|
||||
|
Reference in New Issue
Block a user