RM Performance Improvements

* general file plan browse rendering in around half the previously recorded times for around 500 records (need to scale up)
 * unessesary bottle neck removed from record detail page rendering (see RM-1461)
 * other general improvements
 * TODO .. hasFrozenChildren, getNextDisposition, TransferNodeIndicator, HeldBy .. all traverse up or down record/record folder hierarchy in ways that don't scale
 * fix to disposition lifecycle job that failed all when one failed .. this explains why the job appeared not to work on occasion



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@74458 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2014-06-23 07:21:51 +00:00
parent 15a00fa939
commit 3e7aa934f7
10 changed files with 79 additions and 72 deletions

View File

@@ -1214,7 +1214,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
*/
public List<AssociationRef> getCustomReferencesTo(NodeRef node)
{
return nodeService.getSourceAssocs(node, RegexQNamePattern.MATCH_ALL);
return nodeService.getSourceAssocs(node, null);
}
/**

View File

@@ -213,10 +213,6 @@ public class RMSecurityCommon implements ApplicationContextAware
return result;
}
// Get the file plan for the node
NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef);
if (permissionService.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS) == AccessStatus.DENIED)
{
// log message
@@ -229,7 +225,9 @@ public class RMSecurityCommon implements ApplicationContextAware
return setTransactionCache("checkRmRead", nodeRef, AccessDecisionVoter.ACCESS_DENIED);
}
// Get the file plan for the node
NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef);
if (permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS) == AccessStatus.DENIED)
{
// log capability details

View File

@@ -745,7 +745,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
private NodeRef getNextDispositionActionNodeRef(NodeRef nodeRef)
{
NodeRef result = null;
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, RegexQNamePattern.MATCH_ALL);
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION, 1, true);
if (assocs.size() != 0)
{
result = assocs.get(0).getChildRef();
@@ -838,7 +838,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
NodeRef currentDispositionAction = null;
if (nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE))
{
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, RegexQNamePattern.MATCH_ALL);
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION);
if (assocs.size() > 0)
{
currentDispositionAction = assocs.get(0).getChildRef();

View File

@@ -186,12 +186,22 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
Map<String, Serializable> props = new HashMap<String, Serializable>(1);
props.put(RMDispositionActionExecuterAbstractBase.PARAM_NO_ERROR_CHECK, Boolean.FALSE);
// execute disposition action
recordsManagementActionService.executeRecordsManagementAction(parent.getParentRef(), dispAction, props);
if (logger.isDebugEnabled())
try
{
logger.debug("Processed action: " + dispAction + "on" + parent);
// execute disposition action
recordsManagementActionService.executeRecordsManagementAction(parent.getParentRef(), dispAction, props);
if (logger.isDebugEnabled())
{
logger.debug("Processed action: " + dispAction + "on" + parent);
}
}
catch (AlfrescoRuntimeException exception)
{
if (logger.isDebugEnabled())
{
logger.debug(exception);
}
}
}
}

View File

@@ -710,17 +710,6 @@ public class RecordServiceImpl extends BaseBehaviourBean
return result;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isDeclared(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public boolean isDeclared(NodeRef record)
{
ParameterCheck.mandatory("record", record);
return nodeService.hasAspect(record, ASPECT_DECLARED_RECORD);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
*/

View File

@@ -86,7 +86,7 @@ public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAut
{
if (nodeService == null)
{
nodeService = (NodeService)applicationContext.getBean("nodeService");
nodeService = (NodeService)applicationContext.getBean("dbNodeService");
}
return nodeService;
}

View File

@@ -52,6 +52,9 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte
/** Application context */
protected ApplicationContext applicationContext;
/** internal node service */
private NodeService internalNodeService;
/**
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
@@ -77,6 +80,21 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte
{
this.dictionaryService = dictionaryService;
}
/**
* Helper to get internal node service.
* <p>
* Used for performance reasons.
*/
private NodeService getInternalNodeService()
{
if (internalNodeService == null)
{
internalNodeService = (NodeService)applicationContext.getBean("dbNodeService");
}
return internalNodeService;
}
/**
* Gets the file plan component kind from the given node reference
@@ -196,12 +214,8 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte
public boolean isFilePlanComponent(NodeRef nodeRef)
{
boolean result = false;
// use the internal node service to prevent redirection of security checking.
NodeService myNodeService = (NodeService)applicationContext.getBean("nodeService");
if (myNodeService.exists(nodeRef) &&
myNodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT))
if (getInternalNodeService().exists(nodeRef) &&
getInternalNodeService().hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT))
{
result = true;
}
@@ -264,7 +278,7 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte
{
ParameterCheck.mandatory("nodeRef", nodeRef);
return nodeService.hasAspect(nodeRef, ASPECT_RECORD);
return getInternalNodeService().hasAspect(nodeRef, ASPECT_RECORD);
}
/**
@@ -280,7 +294,8 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte
ParameterCheck.mandatory("nodeRef", nodeRef);
boolean isHold = false;
if (nodeService.exists(nodeRef) && instanceOf(nodeRef, TYPE_HOLD))
if (getInternalNodeService().exists(nodeRef) &&
instanceOf(nodeRef, TYPE_HOLD))
{
isHold = true;
}
@@ -298,6 +313,18 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte
return instanceOf(nodeRef, TYPE_TRANSFER);
}
/**
* Indicates whether a record is complete or not.
*
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isDeclared(org.alfresco.service.cmr.repository.NodeRef)
*/
public boolean isDeclared(NodeRef record)
{
ParameterCheck.mandatory("record", record);
return getInternalNodeService().hasAspect(record, ASPECT_DECLARED_RECORD);
}
/**
* Gets the file plan that a given file plan component resides within.
@@ -309,35 +336,23 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte
{
NodeRef result = null;
if (nodeRef != null)
{
RunAsWork<NodeRef> runAsWork = new RunAsWork<NodeRef>()
{
result = (NodeRef)getInternalNodeService().getProperty(nodeRef, PROP_ROOT_NODEREF);
if (result == null)
{
@Override
public NodeRef doWork()
if (instanceOf(nodeRef, TYPE_FILE_PLAN))
{
NodeRef result = (NodeRef)nodeService.getProperty(nodeRef, PROP_ROOT_NODEREF);
if (result == null)
{
if (instanceOf(nodeRef, TYPE_FILE_PLAN))
{
result = nodeRef;
}
else
{
ChildAssociationRef parentAssocRef = nodeService.getPrimaryParent(nodeRef);
if (parentAssocRef != null)
{
result = getFilePlan(parentAssocRef.getParentRef());
}
}
}
return result;
result = nodeRef;
}
};
result = AuthenticationUtil.runAsSystem(runAsWork);
else
{
ChildAssociationRef parentAssocRef = getInternalNodeService().getPrimaryParent(nodeRef);
if (parentAssocRef != null)
{
result = getFilePlan(parentAssocRef.getParentRef());
}
}
}
}
return result;
@@ -352,15 +367,9 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte
protected boolean instanceOf(NodeRef nodeRef, QName ofClassName)
{
ParameterCheck.mandatory("nodeRef", nodeRef);
ParameterCheck.mandatory("ofClassName", ofClassName);
boolean result = false;
if (nodeService.exists(nodeRef) &&
(ofClassName.equals(nodeService.getType(nodeRef)) ||
dictionaryService.isSubClass(nodeService.getType(nodeRef), ofClassName)))
{
result = true;
}
return result;
ParameterCheck.mandatory("ofClassName", ofClassName);
QName className = getInternalNodeService().getType(nodeRef);
return instanceOf(className, ofClassName);
}
/**