mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Performance enhancement to update disposition schedule job
* after profilling looks to spped things up by about 50% * hoping the reduced work will help with RM-380 * does have a knock on effect of the calculated search properties which will need to be fixed up git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.0@36944 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -577,8 +577,11 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="broadcastDispositionActionDefinitionUpdate" class="org.alfresco.module.org_alfresco_module_rm.action.impl.BroadcastDispositionActionDefinitionUpdateAction"
|
||||
parent="rmAction" />
|
||||
<bean id="broadcastDispositionActionDefinitionUpdate"
|
||||
class="org.alfresco.module.org_alfresco_module_rm.action.impl.BroadcastDispositionActionDefinitionUpdateAction"
|
||||
parent="rmAction" >
|
||||
<property name="behaviourFilter" ref="policyBehaviourFilter"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- complete event -->
|
||||
|
@@ -32,6 +32,8 @@ import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
|
||||
import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementSearchBehaviour;
|
||||
import org.alfresco.repo.policy.BehaviourFilter;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -55,6 +57,13 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx
|
||||
public static final String NAME = "broadcastDispositionActionDefinitionUpdate";
|
||||
public static final String CHANGED_PROPERTIES = "changedProperties";
|
||||
|
||||
private BehaviourFilter behaviourFilter;
|
||||
|
||||
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
|
||||
{
|
||||
this.behaviourFilter = behaviourFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action,
|
||||
* org.alfresco.service.cmr.repository.NodeRef)
|
||||
@@ -75,12 +84,20 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx
|
||||
NodeRef rmContainer = nodeService.getPrimaryParent(dispositionScheduleNode).getParentRef();
|
||||
DispositionSchedule dispositionSchedule = dispositionService.getAssociatedDispositionSchedule(rmContainer);
|
||||
|
||||
behaviourFilter.disableBehaviour();
|
||||
try
|
||||
{
|
||||
List<NodeRef> disposableItems = dispositionService.getDisposableItems(dispositionSchedule);
|
||||
for (NodeRef disposableItem : disposableItems)
|
||||
{
|
||||
updateDisposableItem(dispositionSchedule, disposableItem, actionedUponNodeRef, changedProps);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
behaviourFilter.enableBehaviour();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -250,6 +267,9 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: eventsList contains all the events that have been updated!
|
||||
// TODO: manually update the search properties for the parent node!
|
||||
|
||||
// finally since events may have changed re-calculate the events eligible flag
|
||||
boolean eligible = updateEventEligible(nextAction);
|
||||
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.job;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
@@ -100,8 +101,27 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
||||
markPublishInProgress(nodeRef);
|
||||
try
|
||||
{
|
||||
Date start = new Date();
|
||||
if (logger.isDebugEnabled() == true)
|
||||
{
|
||||
logger.debug("Starting publish of updates ...");
|
||||
logger.debug(" - for " + nodeRef.toString());
|
||||
logger.debug(" - at " + start.toString());
|
||||
}
|
||||
|
||||
// Publish updates
|
||||
publishUpdates(nodeRef);
|
||||
|
||||
|
||||
if (logger.isDebugEnabled() == true)
|
||||
{
|
||||
Date end = new Date();
|
||||
long duration = end.getTime() - start.getTime();
|
||||
logger.debug("Completed publish of updates ...");
|
||||
logger.debug(" - for " + nodeRef.toString());
|
||||
logger.debug(" - at " + end.toString());
|
||||
logger.debug(" - duration " + Long.toString(duration));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -143,10 +163,19 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
||||
}
|
||||
|
||||
// Execute query to find updates awaiting publishing
|
||||
ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE,
|
||||
SearchService.LANGUAGE_LUCENE, query);
|
||||
List<NodeRef> resultNodes = results.getNodeRefs();
|
||||
List<NodeRef> resultNodes = null;
|
||||
ResultSet results = searchService.query(
|
||||
StoreRef.STORE_REF_WORKSPACE_SPACESSTORE,
|
||||
SearchService.LANGUAGE_LUCENE,
|
||||
query);
|
||||
try
|
||||
{
|
||||
resultNodes = results.getNodeRefs();
|
||||
}
|
||||
finally
|
||||
{
|
||||
results.close();
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled() == true)
|
||||
{
|
||||
|
@@ -136,14 +136,13 @@ public class RecordComponentIdentifierAspect
|
||||
*/
|
||||
private void updateUniqueness(NodeRef nodeRef, String beforeId, String afterId)
|
||||
{
|
||||
ChildAssociationRef childAssoc = nodeService.getPrimaryParent(nodeRef);
|
||||
NodeRef contextNodeRef = childAssoc.getParentRef();
|
||||
|
||||
if (beforeId == null)
|
||||
{
|
||||
if (afterId != null)
|
||||
{
|
||||
// Just create it
|
||||
ChildAssociationRef childAssoc = nodeService.getPrimaryParent(nodeRef);
|
||||
NodeRef contextNodeRef = childAssoc.getParentRef();
|
||||
attributeService.createAttribute(null, CONTEXT_VALUE, contextNodeRef, afterId);
|
||||
}
|
||||
else
|
||||
@@ -156,6 +155,8 @@ public class RecordComponentIdentifierAspect
|
||||
if (beforeId != null)
|
||||
{
|
||||
// The before value was not null, so remove it
|
||||
ChildAssociationRef childAssoc = nodeService.getPrimaryParent(nodeRef);
|
||||
NodeRef contextNodeRef = childAssoc.getParentRef();
|
||||
attributeService.removeAttribute(CONTEXT_VALUE, contextNodeRef, beforeId);
|
||||
}
|
||||
// Do a blanket removal in case this is a contextual nodes
|
||||
@@ -164,6 +165,8 @@ public class RecordComponentIdentifierAspect
|
||||
else
|
||||
{
|
||||
// This is a full update
|
||||
ChildAssociationRef childAssoc = nodeService.getPrimaryParent(nodeRef);
|
||||
NodeRef contextNodeRef = childAssoc.getParentRef();
|
||||
attributeService.updateOrCreateAttribute(
|
||||
CONTEXT_VALUE, contextNodeRef, beforeId,
|
||||
CONTEXT_VALUE, contextNodeRef, afterId);
|
||||
|
@@ -147,6 +147,21 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
|
||||
/** Java behaviour */
|
||||
private JavaBehaviour onAddSearchAspect = new JavaBehaviour(this, "rmSearchAspectAdd", NotificationFrequency.TRANSACTION_COMMIT);
|
||||
private JavaBehaviour jbDispositionActionCreate = new JavaBehaviour(this, "dispositionActionCreate", NotificationFrequency.TRANSACTION_COMMIT);
|
||||
private JavaBehaviour jbDispositionActionPropertiesUpdate = new JavaBehaviour(this, "dispositionActionPropertiesUpdate", NotificationFrequency.TRANSACTION_COMMIT);
|
||||
private JavaBehaviour jbDispositionSchedulePropertiesUpdate = new JavaBehaviour(this, "dispositionSchedulePropertiesUpdate", NotificationFrequency.TRANSACTION_COMMIT);
|
||||
private JavaBehaviour jbEventExecutionUpdate = new JavaBehaviour(this, "eventExecutionUpdate", NotificationFrequency.TRANSACTION_COMMIT);
|
||||
private JavaBehaviour jbEventExecutionDelete = new JavaBehaviour(this, "eventExecutionDelete", NotificationFrequency.TRANSACTION_COMMIT);
|
||||
|
||||
/** Array of behaviours related to disposition schedule artifacts */
|
||||
private JavaBehaviour[] jbDispositionBehaviours =
|
||||
{
|
||||
jbDispositionActionCreate,
|
||||
jbDispositionActionPropertiesUpdate,
|
||||
jbDispositionSchedulePropertiesUpdate,
|
||||
jbEventExecutionUpdate,
|
||||
jbEventExecutionDelete
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialisation method
|
||||
@@ -156,28 +171,28 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"),
|
||||
TYPE_DISPOSITION_ACTION,
|
||||
new JavaBehaviour(this, "dispositionActionCreate", NotificationFrequency.TRANSACTION_COMMIT));
|
||||
jbDispositionActionCreate);
|
||||
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
|
||||
TYPE_DISPOSITION_ACTION,
|
||||
new JavaBehaviour(this, "dispositionActionPropertiesUpdate", NotificationFrequency.TRANSACTION_COMMIT));
|
||||
jbDispositionActionPropertiesUpdate);
|
||||
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
|
||||
TYPE_DISPOSITION_SCHEDULE,
|
||||
new JavaBehaviour(this, "dispositionSchedulePropertiesUpdate", NotificationFrequency.TRANSACTION_COMMIT));
|
||||
jbDispositionSchedulePropertiesUpdate);
|
||||
|
||||
this.policyComponent.bindAssociationBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"),
|
||||
TYPE_DISPOSITION_ACTION,
|
||||
ASSOC_EVENT_EXECUTIONS,
|
||||
new JavaBehaviour(this, "eventExecutionUpdate", NotificationFrequency.TRANSACTION_COMMIT));
|
||||
jbEventExecutionUpdate);
|
||||
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"),
|
||||
TYPE_EVENT_EXECUTION,
|
||||
new JavaBehaviour(this, "eventExecutionDelete", NotificationFrequency.TRANSACTION_COMMIT));
|
||||
jbEventExecutionDelete);
|
||||
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"),
|
||||
@@ -216,6 +231,22 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
new JavaBehaviour(this, "frozenAspectUpdateProperties", NotificationFrequency.TRANSACTION_COMMIT));
|
||||
}
|
||||
|
||||
public void disableDispositionScheduleBehaviour()
|
||||
{
|
||||
for (JavaBehaviour jb : jbDispositionBehaviours)
|
||||
{
|
||||
jb.disable();
|
||||
}
|
||||
}
|
||||
|
||||
public void enableDispositionScheduleBehaviour()
|
||||
{
|
||||
for (JavaBehaviour jb : jbDispositionBehaviours)
|
||||
{
|
||||
jb.enable();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures the search aspect for the given node is present, complete and correct.
|
||||
*
|
||||
|
Reference in New Issue
Block a user