mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Revert "Merge pull request #1220 from Alfresco/hotfix-3.2/MNT-21818_fix_tests"
This reverts commit2538c12a92
, reversing changes made to56db0398b6
.
This commit is contained in:
@@ -71,7 +71,6 @@
|
|||||||
<property name="identifierService" ref="recordsManagementIdentifierService"/>
|
<property name="identifierService" ref="recordsManagementIdentifierService"/>
|
||||||
<property name="recordService" ref="RecordService" />
|
<property name="recordService" ref="RecordService" />
|
||||||
<property name="recordFolderService" ref="recordFolderService" />
|
<property name="recordFolderService" ref="recordFolderService" />
|
||||||
<property name="rmContainerCacheManager" ref="rmContainerCacheManager" />
|
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="rma.nonElectronicRecord" class="org.alfresco.module.org_alfresco_module_rm.model.rma.type.NonElectronicRecordType" parent="rm.baseBehaviour">
|
<bean id="rma.nonElectronicRecord" class="org.alfresco.module.org_alfresco_module_rm.model.rma.type.NonElectronicRecordType" parent="rm.baseBehaviour">
|
||||||
@@ -124,7 +123,6 @@
|
|||||||
<property name="capabilityService" ref="CapabilityService" />
|
<property name="capabilityService" ref="CapabilityService" />
|
||||||
<property name="authorityService" ref="AuthorityService" />
|
<property name="authorityService" ref="AuthorityService" />
|
||||||
<property name="filePlanType" ref="rma.filePlan" />
|
<property name="filePlanType" ref="rma.filePlan" />
|
||||||
<property name="rmContainerCacheManager" ref="rmContainerCacheManager" />
|
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- rma model aspects -->
|
<!-- rma model aspects -->
|
||||||
|
@@ -390,23 +390,17 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- RM Container Cache Manager -->
|
|
||||||
<bean id="rmContainerCache" class="org.alfresco.repo.cache.DefaultSimpleCache" />
|
|
||||||
|
|
||||||
<bean id="rmContainerCacheManager" class="org.alfresco.module.org_alfresco_module_rm.util.RMContainerCacheManager">
|
|
||||||
<property name="nodeService" ref="nodeService" />
|
|
||||||
<property name="cache" ref="rmContainerCache" />
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- File Plan Service -->
|
<!-- File Plan Service -->
|
||||||
|
|
||||||
<bean id="rootContainerCache" class="org.alfresco.repo.cache.DefaultSimpleCache" />
|
<bean id="rootContainerCache" class="org.alfresco.repo.cache.DefaultSimpleCache" />
|
||||||
|
|
||||||
|
<bean id="rootRecordsManagementCache" class="org.alfresco.repo.cache.DefaultSimpleCache" />
|
||||||
|
|
||||||
<bean id="filePlanService"
|
<bean id="filePlanService"
|
||||||
parent="baseService"
|
parent="baseService"
|
||||||
class="org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanServiceImpl">
|
class="org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanServiceImpl">
|
||||||
<property name="rootContainerCache" ref="rootContainerCache" />
|
<property name="rootContainerCache" ref="rootContainerCache" />
|
||||||
<property name="rmContainerCacheManager" ref="rmContainerCacheManager" />
|
<property name="rootRecordsManagementCache" ref="rootRecordsManagementCache" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="FilePlanService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
<bean id="FilePlanService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||||
|
@@ -42,7 +42,6 @@ import org.alfresco.model.ContentModel;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.RMContainerCacheManager;
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
|
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
|
||||||
import org.alfresco.repo.cache.SimpleCache;
|
import org.alfresco.repo.cache.SimpleCache;
|
||||||
import org.alfresco.repo.domain.node.NodeDAO;
|
import org.alfresco.repo.domain.node.NodeDAO;
|
||||||
@@ -90,6 +89,9 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
|||||||
/** root container cache */
|
/** root container cache */
|
||||||
private SimpleCache<Pair<NodeRef, String>, NodeRef> rootContainerCache;
|
private SimpleCache<Pair<NodeRef, String>, NodeRef> rootContainerCache;
|
||||||
|
|
||||||
|
/** root records management cache */
|
||||||
|
private SimpleCache<Pair<StoreRef, String>, Set<NodeRef>> rootRecordsManagementCache;
|
||||||
|
|
||||||
/** File plan role service */
|
/** File plan role service */
|
||||||
private FilePlanRoleService filePlanRoleService;
|
private FilePlanRoleService filePlanRoleService;
|
||||||
|
|
||||||
@@ -102,9 +104,6 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
|||||||
/** Site service */
|
/** Site service */
|
||||||
private SiteService siteService;
|
private SiteService siteService;
|
||||||
|
|
||||||
/** RM container cache manager **/
|
|
||||||
private RMContainerCacheManager rmContainerCacheManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the file plan role service
|
* Gets the file plan role service
|
||||||
*
|
*
|
||||||
@@ -179,12 +178,11 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param rmContainerCacheManager RM container cache manager
|
* @param rootRecordsManagementCache root records management node cache
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public void setRmContainerCacheManager(RMContainerCacheManager rmContainerCacheManager)
|
public void setRootRecordsManagementCache(SimpleCache<Pair<StoreRef, String>, Set<NodeRef>> rootRecordsManagementCache)
|
||||||
{
|
{
|
||||||
this.rmContainerCacheManager = rmContainerCacheManager;
|
this.rootRecordsManagementCache = rootRecordsManagementCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -199,7 +197,9 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
|||||||
Set<QName> aspects = new HashSet<>(1);
|
Set<QName> aspects = new HashSet<>(1);
|
||||||
aspects.add(ASPECT_RECORDS_MANAGEMENT_ROOT);
|
aspects.add(ASPECT_RECORDS_MANAGEMENT_ROOT);
|
||||||
|
|
||||||
if (!rmContainerCacheManager.isCached(storeRef))
|
Pair<StoreRef, String> key = new Pair<StoreRef, String>(storeRef, ASPECT_RECORDS_MANAGEMENT_ROOT.toString());
|
||||||
|
|
||||||
|
if (!rootRecordsManagementCache.contains(key))
|
||||||
{
|
{
|
||||||
getNodeDAO().getNodesWithAspects(aspects, Long.MIN_VALUE, Long.MAX_VALUE, new NodeDAO.NodeRefQueryCallback()
|
getNodeDAO().getNodesWithAspects(aspects, Long.MIN_VALUE, Long.MAX_VALUE, new NodeDAO.NodeRefQueryCallback()
|
||||||
{
|
{
|
||||||
@@ -210,16 +210,20 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
|||||||
if (storeRef.equals(nodeRef.getStoreRef()))
|
if (storeRef.equals(nodeRef.getStoreRef()))
|
||||||
{
|
{
|
||||||
results.add(nodeRef);
|
results.add(nodeRef);
|
||||||
rmContainerCacheManager.add(nodeRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (results.size() > 0)
|
||||||
|
{
|
||||||
|
rootRecordsManagementCache.put(key, results);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return rmContainerCacheManager.get(storeRef);
|
return rootRecordsManagementCache.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
|
@@ -33,7 +33,6 @@ import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService;
|
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.RMContainerCacheManager;
|
|
||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||||
import org.alfresco.repo.policy.annotation.Behaviour;
|
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||||
@@ -56,8 +55,7 @@ import org.alfresco.service.namespace.QName;
|
|||||||
defaultType = "rma:recordsManagementContainer"
|
defaultType = "rma:recordsManagementContainer"
|
||||||
)
|
)
|
||||||
public class RecordsManagementContainerType extends BaseBehaviourBean
|
public class RecordsManagementContainerType extends BaseBehaviourBean
|
||||||
implements NodeServicePolicies.OnCreateChildAssociationPolicy,
|
implements NodeServicePolicies.OnCreateChildAssociationPolicy
|
||||||
NodeServicePolicies.OnDeleteChildAssociationPolicy
|
|
||||||
{
|
{
|
||||||
/** behaviour name */
|
/** behaviour name */
|
||||||
private static final String BEHAVIOUR_NAME = "onCreateContainerType";
|
private static final String BEHAVIOUR_NAME = "onCreateContainerType";
|
||||||
@@ -71,21 +69,9 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
|
|||||||
/** record folder service */
|
/** record folder service */
|
||||||
protected RecordFolderService recordFolderService;
|
protected RecordFolderService recordFolderService;
|
||||||
|
|
||||||
/** RM container cache manager **/
|
|
||||||
private RMContainerCacheManager rmContainerCacheManager;
|
|
||||||
|
|
||||||
/** I18N */
|
/** I18N */
|
||||||
private static final String MSG_CANNOT_CAST_TO_RM_TYPE = "rm.action.cast-to-rm-type";
|
private static final String MSG_CANNOT_CAST_TO_RM_TYPE = "rm.action.cast-to-rm-type";
|
||||||
|
|
||||||
/**
|
|
||||||
* @param rmContainerCacheManager RM container cache manager
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setRmContainerCacheManager(RMContainerCacheManager rmContainerCacheManager)
|
|
||||||
{
|
|
||||||
this.rmContainerCacheManager = rmContainerCacheManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param identifierService identifier service
|
* @param identifierService identifier service
|
||||||
*/
|
*/
|
||||||
@@ -208,48 +194,12 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
|
|||||||
setIdenifierProperty(child);
|
setIdenifierProperty(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rmContainerCacheManager != null)
|
|
||||||
{
|
|
||||||
rmContainerCacheManager.add(child);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempts to remove a deleted node from records management root cache
|
|
||||||
*
|
|
||||||
* @see org.alfresco.repo.node.NodeServicePolicies.OnDeleteAssociationPolicy#onDeleteAssociation(org.alfresco.service.cmr.repository.AssociationRef)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Behaviour
|
|
||||||
(
|
|
||||||
kind = BehaviourKind.ASSOCIATION,
|
|
||||||
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
|
|
||||||
)
|
|
||||||
public void onDeleteChildAssociation(ChildAssociationRef childAssocRef)
|
|
||||||
{
|
|
||||||
|
|
||||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public Void doWork()
|
|
||||||
{
|
|
||||||
// Get the elements of the deleted association
|
|
||||||
final NodeRef child = childAssocRef.getChildRef();
|
|
||||||
|
|
||||||
if (rmContainerCacheManager != null)
|
|
||||||
{
|
|
||||||
rmContainerCacheManager.remove(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -39,7 +39,6 @@ import org.alfresco.model.ContentModel;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
|
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
|
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.RMContainerCacheManager;
|
|
||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||||
import org.alfresco.repo.policy.annotation.Behaviour;
|
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||||
@@ -74,8 +73,7 @@ public class RmSiteType extends BaseBehaviourBean
|
|||||||
implements NodeServicePolicies.OnCreateNodePolicy,
|
implements NodeServicePolicies.OnCreateNodePolicy,
|
||||||
NodeServicePolicies.OnUpdatePropertiesPolicy,
|
NodeServicePolicies.OnUpdatePropertiesPolicy,
|
||||||
NodeServicePolicies.BeforeDeleteNodePolicy,
|
NodeServicePolicies.BeforeDeleteNodePolicy,
|
||||||
NodeServicePolicies.OnCreateChildAssociationPolicy,
|
NodeServicePolicies.OnCreateChildAssociationPolicy
|
||||||
NodeServicePolicies.OnDeleteChildAssociationPolicy
|
|
||||||
{
|
{
|
||||||
/** Constant values */
|
/** Constant values */
|
||||||
public static final String COMPONENT_DOCUMENT_LIBRARY = "documentLibrary";
|
public static final String COMPONENT_DOCUMENT_LIBRARY = "documentLibrary";
|
||||||
@@ -97,9 +95,6 @@ public class RmSiteType extends BaseBehaviourBean
|
|||||||
|
|
||||||
private FilePlanType filePlanType;
|
private FilePlanType filePlanType;
|
||||||
|
|
||||||
/** RM container cache manager **/
|
|
||||||
private RMContainerCacheManager rmContainerCacheManager;
|
|
||||||
|
|
||||||
/** Map of file plan type's key'ed by corresponding site types */
|
/** Map of file plan type's key'ed by corresponding site types */
|
||||||
protected Map<QName, QName> mapFilePlanType = new HashMap<>(3);
|
protected Map<QName, QName> mapFilePlanType = new HashMap<>(3);
|
||||||
|
|
||||||
@@ -141,15 +136,6 @@ public class RmSiteType extends BaseBehaviourBean
|
|||||||
this.filePlanType = filePlanType;
|
this.filePlanType = filePlanType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param rmContainerCacheManager RM container cache manager
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setRmContainerCacheManager(RMContainerCacheManager rmContainerCacheManager)
|
|
||||||
{
|
|
||||||
this.rmContainerCacheManager = rmContainerCacheManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a file plan type for a specific site type.
|
* Registers a file plan type for a specific site type.
|
||||||
*
|
*
|
||||||
@@ -324,36 +310,6 @@ public class RmSiteType extends BaseBehaviourBean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles site deletion in order to reset the records management root cache
|
|
||||||
*
|
|
||||||
* @param childAssocRef
|
|
||||||
*
|
|
||||||
* @see org.alfresco.repo.node.NodeServicePolicies.OnDeleteAssociationPolicy#onDeleteAssociation(org.alfresco.service.cmr.repository.AssociationRef)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Behaviour
|
|
||||||
(
|
|
||||||
kind = BehaviourKind.ASSOCIATION
|
|
||||||
)
|
|
||||||
public void onDeleteChildAssociation(ChildAssociationRef childAssocRef)
|
|
||||||
{
|
|
||||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public Void doWork()
|
|
||||||
{
|
|
||||||
// Resets RM Container Cache Manager
|
|
||||||
if (rmContainerCacheManager != null)
|
|
||||||
{
|
|
||||||
rmContainerCacheManager.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the limitation of creating only one rma:filePlan or one dod:filePlan depending on the type of rm site.
|
* Add the limitation of creating only one rma:filePlan or one dod:filePlan depending on the type of rm site.
|
||||||
* Let multiple cm:folder type be created under rm site.
|
* Let multiple cm:folder type be created under rm site.
|
||||||
@@ -383,13 +339,6 @@ public class RmSiteType extends BaseBehaviourBean
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the deletion node policy (alf:onDeleteNode), resetting the records management root cache
|
|
||||||
* and enabling file plan behavior as well
|
|
||||||
*
|
|
||||||
* @param childAssocRef
|
|
||||||
* @param isNodeArchived
|
|
||||||
*/
|
|
||||||
@Behaviour
|
@Behaviour
|
||||||
(
|
(
|
||||||
kind = BehaviourKind.CLASS,
|
kind = BehaviourKind.CLASS,
|
||||||
@@ -398,12 +347,6 @@ public class RmSiteType extends BaseBehaviourBean
|
|||||||
)
|
)
|
||||||
public void onDeleteNodeOnCommit(ChildAssociationRef childAssocRef, boolean isNodeArchived)
|
public void onDeleteNodeOnCommit(ChildAssociationRef childAssocRef, boolean isNodeArchived)
|
||||||
{
|
{
|
||||||
// Resets RM Container Cache Manager
|
|
||||||
if (rmContainerCacheManager != null)
|
|
||||||
{
|
|
||||||
rmContainerCacheManager.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
filePlanType.enable();
|
filePlanType.enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,162 +0,0 @@
|
|||||||
/*
|
|
||||||
* #%L
|
|
||||||
* Alfresco Records Management Module
|
|
||||||
* %%
|
|
||||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
|
||||||
* %%
|
|
||||||
* This file is part of the Alfresco software.
|
|
||||||
* -
|
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
|
||||||
* provided under the following open source license terms:
|
|
||||||
* -
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
* -
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
* -
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
* #L%
|
|
||||||
*/
|
|
||||||
package org.alfresco.module.org_alfresco_module_rm.util;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
|
||||||
import org.alfresco.repo.cache.SimpleCache;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
import org.alfresco.util.Pair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides operations to manipulate the records management root cache
|
|
||||||
*
|
|
||||||
* @author Tiago Salvado
|
|
||||||
*
|
|
||||||
* @see RecordsManagementModel
|
|
||||||
*/
|
|
||||||
public class RMContainerCacheManager implements RecordsManagementModel
|
|
||||||
{
|
|
||||||
/** node service */
|
|
||||||
private NodeService nodeService;
|
|
||||||
|
|
||||||
/** root records management cache */
|
|
||||||
private SimpleCache<Pair<StoreRef, String>, Set<NodeRef>> cache;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param nodeService
|
|
||||||
* node service
|
|
||||||
*/
|
|
||||||
public void setNodeService(NodeService nodeService)
|
|
||||||
{
|
|
||||||
this.nodeService = nodeService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param cache
|
|
||||||
*/
|
|
||||||
public void setCache(SimpleCache<Pair<StoreRef, String>, Set<NodeRef>> cache)
|
|
||||||
{
|
|
||||||
this.cache = cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verifies if there is cached nodes for supplied storeRef
|
|
||||||
*
|
|
||||||
* @param storeRef
|
|
||||||
* @return true if there are cached nodes, false otherwise
|
|
||||||
*/
|
|
||||||
public boolean isCached(StoreRef storeRef)
|
|
||||||
{
|
|
||||||
return cache.contains(getKey(storeRef));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtains the cached nodes for supplied storeRef
|
|
||||||
*
|
|
||||||
* @param storeRef
|
|
||||||
* @return a set containing the cached nodes
|
|
||||||
*/
|
|
||||||
public Set<NodeRef> get(StoreRef storeRef)
|
|
||||||
{
|
|
||||||
return cache.get(getKey(storeRef));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Caches the supplied node
|
|
||||||
*
|
|
||||||
* @param nodeRef
|
|
||||||
*/
|
|
||||||
public void add(NodeRef nodeRef)
|
|
||||||
{
|
|
||||||
if (nodeRef != null && nodeService.hasAspect(nodeRef, ASPECT_RECORDS_MANAGEMENT_ROOT))
|
|
||||||
{
|
|
||||||
Set<NodeRef> entries;
|
|
||||||
Pair<StoreRef, String> key = getKey(nodeRef.getStoreRef());
|
|
||||||
|
|
||||||
if (cache.contains(key))
|
|
||||||
{
|
|
||||||
entries = this.cache.get(key);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
entries = new HashSet<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!entries.contains(nodeRef))
|
|
||||||
{
|
|
||||||
entries.add(nodeRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
cache.put(key, entries);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the supplied entry from the cache
|
|
||||||
*
|
|
||||||
* @param nodeRef
|
|
||||||
*/
|
|
||||||
public void remove(NodeRef nodeRef)
|
|
||||||
{
|
|
||||||
if (nodeRef != null)
|
|
||||||
{
|
|
||||||
if (nodeService.hasAspect(nodeRef, ASPECT_RECORDS_MANAGEMENT_ROOT))
|
|
||||||
{
|
|
||||||
Pair<StoreRef, String> key = getKey(nodeRef.getStoreRef());
|
|
||||||
if (cache.contains(key))
|
|
||||||
{
|
|
||||||
cache.get(key).remove(nodeRef);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets the cache entries
|
|
||||||
*/
|
|
||||||
public void reset()
|
|
||||||
{
|
|
||||||
this.cache.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds the cache key using the supplied storeRef
|
|
||||||
*
|
|
||||||
* @param storeRef
|
|
||||||
* @return a pair corresponding to the cache key
|
|
||||||
*/
|
|
||||||
private Pair<StoreRef, String> getKey(StoreRef storeRef)
|
|
||||||
{
|
|
||||||
return new Pair<StoreRef, String>(storeRef, ASPECT_RECORDS_MANAGEMENT_ROOT.toString());
|
|
||||||
}
|
|
||||||
}
|
|
@@ -57,7 +57,6 @@ import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
|
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService;
|
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.RMContainerCacheManager;
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService;
|
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService;
|
||||||
import org.alfresco.repo.policy.BehaviourFilter;
|
import org.alfresco.repo.policy.BehaviourFilter;
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
@@ -174,9 +173,6 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
|||||||
protected InplaceRecordService inplaceRecordService;
|
protected InplaceRecordService inplaceRecordService;
|
||||||
protected RelationshipService relationshipService;
|
protected RelationshipService relationshipService;
|
||||||
|
|
||||||
/** RM Container Cache Manager */
|
|
||||||
protected RMContainerCacheManager rmContainerCacheManager;
|
|
||||||
|
|
||||||
/** test utils */
|
/** test utils */
|
||||||
protected UserAndGroupsUtils userAndGroupsUtils;
|
protected UserAndGroupsUtils userAndGroupsUtils;
|
||||||
|
|
||||||
@@ -428,9 +424,6 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
|||||||
holdService = (HoldService) applicationContext.getBean("HoldService");
|
holdService = (HoldService) applicationContext.getBean("HoldService");
|
||||||
inplaceRecordService = (InplaceRecordService) applicationContext.getBean("InplaceRecordService");
|
inplaceRecordService = (InplaceRecordService) applicationContext.getBean("InplaceRecordService");
|
||||||
relationshipService = (RelationshipService) applicationContext.getBean("RelationshipService");
|
relationshipService = (RelationshipService) applicationContext.getBean("RelationshipService");
|
||||||
|
|
||||||
// RM Container Cache Manager
|
|
||||||
rmContainerCacheManager = (RMContainerCacheManager) applicationContext.getBean("rmContainerCacheManager");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -491,11 +484,6 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
|||||||
{
|
{
|
||||||
siteService.deleteSite(collabSiteId);
|
siteService.deleteSite(collabSiteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rmContainerCacheManager != null)
|
|
||||||
{
|
|
||||||
rmContainerCacheManager.reset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user