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:
@@ -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