mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Root container cache to improve unfiled record browse performance
* relates to RM-1594 and RM-1595 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.1.0.x@76673 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -438,6 +438,8 @@
|
|||||||
|
|
||||||
<!-- File Plan Service -->
|
<!-- File Plan Service -->
|
||||||
|
|
||||||
|
<bean id="rootContainerCache" 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">
|
||||||
@@ -446,6 +448,7 @@
|
|||||||
<!-- <property name="nodeDAO" ref="nodeDAO"/> -->
|
<!-- <property name="nodeDAO" ref="nodeDAO"/> -->
|
||||||
<!-- <property name="internalNodeService" ref="nodeService"/> -->
|
<!-- <property name="internalNodeService" ref="nodeService"/> -->
|
||||||
<!-- <property name="siteService" ref="SiteService" /> -->
|
<!-- <property name="siteService" ref="SiteService" /> -->
|
||||||
|
<property name="rootContainerCache" ref="rootContainerCache" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="FilePlanService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
<bean id="FilePlanService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||||
|
@@ -39,6 +39,7 @@ import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedReaderDynamicAuthority;
|
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedReaderDynamicAuthority;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedWriterDynamicAuthority;
|
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedWriterDynamicAuthority;
|
||||||
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.domain.node.NodeDAO;
|
import org.alfresco.repo.domain.node.NodeDAO;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -82,6 +83,9 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
|||||||
/** RM site file plan container */
|
/** RM site file plan container */
|
||||||
private static final String FILE_PLAN_CONTAINER = "documentLibrary";
|
private static final String FILE_PLAN_CONTAINER = "documentLibrary";
|
||||||
|
|
||||||
|
/** root container cache */
|
||||||
|
private SimpleCache<Pair<NodeRef, String>, NodeRef> rootContainerCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NOTE: for some reason spring couldn't cope with the circular references between these two
|
* NOTE: for some reason spring couldn't cope with the circular references between these two
|
||||||
* beans so we need to grab this one manually.
|
* beans so we need to grab this one manually.
|
||||||
@@ -166,6 +170,14 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
|||||||
return getFilePlans(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
return getFilePlans(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param rootContainerCache root container cache
|
||||||
|
*/
|
||||||
|
public void setRootContainerCache(SimpleCache<Pair<NodeRef, String>, NodeRef> rootContainerCache)
|
||||||
|
{
|
||||||
|
this.rootContainerCache = rootContainerCache;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getFilePlans(org.alfresco.service.cmr.repository.StoreRef)
|
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getFilePlans(org.alfresco.service.cmr.repository.StoreRef)
|
||||||
*/
|
*/
|
||||||
@@ -255,10 +267,11 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the file root container for the given type.
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* @param containerName
|
* @param containerName container type
|
||||||
* @return
|
* @return {@link NodeRef} file plan container
|
||||||
*/
|
*/
|
||||||
private NodeRef getFilePlanRootContainer(NodeRef filePlan, String containerName)
|
private NodeRef getFilePlanRootContainer(NodeRef filePlan, String containerName)
|
||||||
{
|
{
|
||||||
@@ -269,16 +282,25 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
NodeRef result = null;
|
NodeRef result = null;
|
||||||
|
Pair<NodeRef, String> key = new Pair<NodeRef, String>(filePlan, containerName);
|
||||||
// try and get the unfiled record container
|
|
||||||
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(filePlan, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, containerName));
|
if (!rootContainerCache.contains(key))
|
||||||
if (assocs.size() > 1)
|
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Unable to get unfiled conatiner " + containerName + ".");
|
// try and get the unfiled record container
|
||||||
|
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(filePlan, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, containerName));
|
||||||
|
if (assocs.size() > 1)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Unable to get unfiled conatiner " + containerName + ".");
|
||||||
|
}
|
||||||
|
else if (assocs.size() == 1)
|
||||||
|
{
|
||||||
|
result = assocs.get(0).getChildRef();
|
||||||
|
rootContainerCache.put(key, result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (assocs.size() == 1)
|
else
|
||||||
{
|
{
|
||||||
result = assocs.get(0).getChildRef();
|
result = rootContainerCache.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Reference in New Issue
Block a user