diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMContainerCacheManager.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMContainerCacheManager.java index 500db5f7a4..6eed0291c0 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMContainerCacheManager.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMContainerCacheManager.java @@ -37,7 +37,7 @@ import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.util.Pair; /** - * Provides operations to manipulate the records management root cache + * Provides operations to manipulate the records management root cache * * @author Tiago Salvado * @@ -45,14 +45,15 @@ import org.alfresco.util.Pair; */ public class RMContainerCacheManager implements RecordsManagementModel { - /** node service */ + /** node service */ private NodeService nodeService; - + /** root records management cache */ - private SimpleCache, Set> cache; - + private SimpleCache, Set> cache; + /** - * @param nodeService node service + * @param nodeService + * node service */ public void setNodeService(NodeService nodeService) { @@ -67,91 +68,91 @@ public class RMContainerCacheManager implements RecordsManagementModel 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) - { - Pair key = new Pair(storeRef, ASPECT_RECORDS_MANAGEMENT_ROOT.toString()); - return cache.contains(key); - } - - /** - * Obtains the cached nodes for supplied storeRef - * - * @param storeRef - * @return a set containing the cached nodes - */ - public Set get(StoreRef storeRef) - { + /** + * 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 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 entries; - Pair key = getKey(nodeRef.getStoreRef()); + /** + * Caches the supplied node + * + * @param nodeRef + */ + public void add(NodeRef nodeRef) + { + if (nodeRef != null && nodeService.hasAspect(nodeRef, ASPECT_RECORDS_MANAGEMENT_ROOT)) + { + Set entries; + Pair key = getKey(nodeRef.getStoreRef()); - if (cache.contains(key)) - { - entries = this.cache.get(key); - } - else - { - entries = new HashSet<>(); - } + if (cache.contains(key)) + { + entries = this.cache.get(key); + } + else + { + entries = new HashSet<>(); + } - if (!entries.contains(nodeRef)) - { - entries.add(nodeRef); - } + if (!entries.contains(nodeRef)) + { + entries.add(nodeRef); + } - cache.put(key, entries); - } - } + cache.put(key, entries); + } + } - /** - * Removes the supplied entry from the cache - * - * @param nodeRef - */ - public void remove(NodeRef nodeRef) - { - if (nodeRef != null && nodeService.hasAspect(nodeRef, ASPECT_RECORDS_MANAGEMENT_ROOT)) - { - Pair key = getKey(nodeRef.getStoreRef()); - if (cache.contains(key)) - { - cache.get(key).remove(nodeRef); - } - } - } + /** + * Removes the supplied entry from the cache + * + * @param nodeRef + */ + public void remove(NodeRef nodeRef) + { + if (nodeRef != null && nodeService.hasAspect(nodeRef, ASPECT_RECORDS_MANAGEMENT_ROOT)) + { + Pair key = getKey(nodeRef.getStoreRef()); + if (cache.contains(key)) + { + cache.get(key).remove(nodeRef); + } + } + } - /** - * Resets the cache entries - */ - public void reset() - { - this.cache.clear(); - } + /** + * 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 getKey(StoreRef storeRef) - { - return new Pair(storeRef, ASPECT_RECORDS_MANAGEMENT_ROOT.toString()); - } + /** + * Builds the cache key using the supplied storeRef + * + * @param storeRef + * @return a pair corresponding to the cache key + */ + private Pair getKey(StoreRef storeRef) + { + return new Pair(storeRef, ASPECT_RECORDS_MANAGEMENT_ROOT.toString()); + } } \ No newline at end of file