diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml index 00e1ccddaf..757e7649dd 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml @@ -393,10 +393,13 @@ + + + diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java index 1194805168..9c2379c302 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java @@ -89,6 +89,9 @@ public class FilePlanServiceImpl extends ServiceBaseImpl /** root container cache */ private SimpleCache, NodeRef> rootContainerCache; + /** root records management cache */ + private SimpleCache, Set> rootRecordsManagementCache; + /** File plan role service */ private FilePlanRoleService filePlanRoleService; @@ -174,6 +177,14 @@ public class FilePlanServiceImpl extends ServiceBaseImpl this.rootContainerCache = rootContainerCache; } + /** + * @param rootRecordsManagementCache root records management node cache + */ + public void setRootRecordsManagementCache(SimpleCache, Set> rootRecordsManagementCache) + { + this.rootRecordsManagementCache = rootRecordsManagementCache; + } + /** * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getFilePlans(org.alfresco.service.cmr.repository.StoreRef) */ @@ -185,20 +196,36 @@ public class FilePlanServiceImpl extends ServiceBaseImpl final Set results = new HashSet<>(); Set aspects = new HashSet<>(1); aspects.add(ASPECT_RECORDS_MANAGEMENT_ROOT); - getNodeDAO().getNodesWithAspects(aspects, Long.MIN_VALUE, Long.MAX_VALUE, new NodeDAO.NodeRefQueryCallback() - { - @Override - public boolean handle(Pair nodePair) - { - NodeRef nodeRef = nodePair.getSecond(); - if (storeRef.equals(nodeRef.getStoreRef())) - { - results.add(nodeRef); - } - return true; + Pair key = new Pair(storeRef, ASPECT_RECORDS_MANAGEMENT_ROOT.toString()); + + if (!rootRecordsManagementCache.contains(key)) + { + getNodeDAO().getNodesWithAspects(aspects, Long.MIN_VALUE, Long.MAX_VALUE, new NodeDAO.NodeRefQueryCallback() + { + @Override + public boolean handle(Pair nodePair) + { + NodeRef nodeRef = nodePair.getSecond(); + if (storeRef.equals(nodeRef.getStoreRef())) + { + results.add(nodeRef); + } + + return true; + } + }); + + if (results.size() > 0) + { + rootRecordsManagementCache.put(key, results); } - }); + } + else + { + return rootRecordsManagementCache.get(key); + } + return results; }