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>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="broadcastDispositionActionDefinitionUpdate" class="org.alfresco.module.org_alfresco_module_rm.action.impl.BroadcastDispositionActionDefinitionUpdateAction"
|
<bean id="broadcastDispositionActionDefinitionUpdate"
|
||||||
parent="rmAction" />
|
class="org.alfresco.module.org_alfresco_module_rm.action.impl.BroadcastDispositionActionDefinitionUpdateAction"
|
||||||
|
parent="rmAction" >
|
||||||
|
<property name="behaviourFilter" ref="policyBehaviourFilter"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
<!-- complete event -->
|
<!-- 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.disposition.DispositionSchedule;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails;
|
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.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.Action;
|
||||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
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 NAME = "broadcastDispositionActionDefinitionUpdate";
|
||||||
public static final String CHANGED_PROPERTIES = "changedProperties";
|
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,
|
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action,
|
||||||
* org.alfresco.service.cmr.repository.NodeRef)
|
* org.alfresco.service.cmr.repository.NodeRef)
|
||||||
@@ -75,10 +84,18 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx
|
|||||||
NodeRef rmContainer = nodeService.getPrimaryParent(dispositionScheduleNode).getParentRef();
|
NodeRef rmContainer = nodeService.getPrimaryParent(dispositionScheduleNode).getParentRef();
|
||||||
DispositionSchedule dispositionSchedule = dispositionService.getAssociatedDispositionSchedule(rmContainer);
|
DispositionSchedule dispositionSchedule = dispositionService.getAssociatedDispositionSchedule(rmContainer);
|
||||||
|
|
||||||
List<NodeRef> disposableItems = dispositionService.getDisposableItems(dispositionSchedule);
|
behaviourFilter.disableBehaviour();
|
||||||
for (NodeRef disposableItem : disposableItems)
|
try
|
||||||
{
|
{
|
||||||
updateDisposableItem(dispositionSchedule, disposableItem, actionedUponNodeRef, changedProps);
|
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
|
// finally since events may have changed re-calculate the events eligible flag
|
||||||
boolean eligible = updateEventEligible(nextAction);
|
boolean eligible = updateEventEligible(nextAction);
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package org.alfresco.module.org_alfresco_module_rm.job;
|
package org.alfresco.module.org_alfresco_module_rm.job;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
@@ -100,8 +101,27 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
|||||||
markPublishInProgress(nodeRef);
|
markPublishInProgress(nodeRef);
|
||||||
try
|
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
|
// Publish updates
|
||||||
publishUpdates(nodeRef);
|
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
|
finally
|
||||||
{
|
{
|
||||||
@@ -143,10 +163,19 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Execute query to find updates awaiting publishing
|
// Execute query to find updates awaiting publishing
|
||||||
ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE,
|
List<NodeRef> resultNodes = null;
|
||||||
SearchService.LANGUAGE_LUCENE, query);
|
ResultSet results = searchService.query(
|
||||||
List<NodeRef> resultNodes = results.getNodeRefs();
|
StoreRef.STORE_REF_WORKSPACE_SPACESSTORE,
|
||||||
results.close();
|
SearchService.LANGUAGE_LUCENE,
|
||||||
|
query);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
resultNodes = results.getNodeRefs();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
results.close();
|
||||||
|
}
|
||||||
|
|
||||||
if (logger.isDebugEnabled() == true)
|
if (logger.isDebugEnabled() == true)
|
||||||
{
|
{
|
||||||
|
@@ -136,14 +136,13 @@ public class RecordComponentIdentifierAspect
|
|||||||
*/
|
*/
|
||||||
private void updateUniqueness(NodeRef nodeRef, String beforeId, String afterId)
|
private void updateUniqueness(NodeRef nodeRef, String beforeId, String afterId)
|
||||||
{
|
{
|
||||||
ChildAssociationRef childAssoc = nodeService.getPrimaryParent(nodeRef);
|
|
||||||
NodeRef contextNodeRef = childAssoc.getParentRef();
|
|
||||||
|
|
||||||
if (beforeId == null)
|
if (beforeId == null)
|
||||||
{
|
{
|
||||||
if (afterId != null)
|
if (afterId != null)
|
||||||
{
|
{
|
||||||
// Just create it
|
// Just create it
|
||||||
|
ChildAssociationRef childAssoc = nodeService.getPrimaryParent(nodeRef);
|
||||||
|
NodeRef contextNodeRef = childAssoc.getParentRef();
|
||||||
attributeService.createAttribute(null, CONTEXT_VALUE, contextNodeRef, afterId);
|
attributeService.createAttribute(null, CONTEXT_VALUE, contextNodeRef, afterId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -156,6 +155,8 @@ public class RecordComponentIdentifierAspect
|
|||||||
if (beforeId != null)
|
if (beforeId != null)
|
||||||
{
|
{
|
||||||
// The before value was not null, so remove it
|
// The before value was not null, so remove it
|
||||||
|
ChildAssociationRef childAssoc = nodeService.getPrimaryParent(nodeRef);
|
||||||
|
NodeRef contextNodeRef = childAssoc.getParentRef();
|
||||||
attributeService.removeAttribute(CONTEXT_VALUE, contextNodeRef, beforeId);
|
attributeService.removeAttribute(CONTEXT_VALUE, contextNodeRef, beforeId);
|
||||||
}
|
}
|
||||||
// Do a blanket removal in case this is a contextual nodes
|
// Do a blanket removal in case this is a contextual nodes
|
||||||
@@ -164,6 +165,8 @@ public class RecordComponentIdentifierAspect
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This is a full update
|
// This is a full update
|
||||||
|
ChildAssociationRef childAssoc = nodeService.getPrimaryParent(nodeRef);
|
||||||
|
NodeRef contextNodeRef = childAssoc.getParentRef();
|
||||||
attributeService.updateOrCreateAttribute(
|
attributeService.updateOrCreateAttribute(
|
||||||
CONTEXT_VALUE, contextNodeRef, beforeId,
|
CONTEXT_VALUE, contextNodeRef, beforeId,
|
||||||
CONTEXT_VALUE, contextNodeRef, afterId);
|
CONTEXT_VALUE, contextNodeRef, afterId);
|
||||||
|
@@ -147,6 +147,21 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
|||||||
|
|
||||||
/** Java behaviour */
|
/** Java behaviour */
|
||||||
private JavaBehaviour onAddSearchAspect = new JavaBehaviour(this, "rmSearchAspectAdd", NotificationFrequency.TRANSACTION_COMMIT);
|
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
|
* Initialisation method
|
||||||
@@ -156,28 +171,28 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
|||||||
this.policyComponent.bindClassBehaviour(
|
this.policyComponent.bindClassBehaviour(
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"),
|
QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"),
|
||||||
TYPE_DISPOSITION_ACTION,
|
TYPE_DISPOSITION_ACTION,
|
||||||
new JavaBehaviour(this, "dispositionActionCreate", NotificationFrequency.TRANSACTION_COMMIT));
|
jbDispositionActionCreate);
|
||||||
|
|
||||||
this.policyComponent.bindClassBehaviour(
|
this.policyComponent.bindClassBehaviour(
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
|
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
|
||||||
TYPE_DISPOSITION_ACTION,
|
TYPE_DISPOSITION_ACTION,
|
||||||
new JavaBehaviour(this, "dispositionActionPropertiesUpdate", NotificationFrequency.TRANSACTION_COMMIT));
|
jbDispositionActionPropertiesUpdate);
|
||||||
|
|
||||||
this.policyComponent.bindClassBehaviour(
|
this.policyComponent.bindClassBehaviour(
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
|
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
|
||||||
TYPE_DISPOSITION_SCHEDULE,
|
TYPE_DISPOSITION_SCHEDULE,
|
||||||
new JavaBehaviour(this, "dispositionSchedulePropertiesUpdate", NotificationFrequency.TRANSACTION_COMMIT));
|
jbDispositionSchedulePropertiesUpdate);
|
||||||
|
|
||||||
this.policyComponent.bindAssociationBehaviour(
|
this.policyComponent.bindAssociationBehaviour(
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"),
|
QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"),
|
||||||
TYPE_DISPOSITION_ACTION,
|
TYPE_DISPOSITION_ACTION,
|
||||||
ASSOC_EVENT_EXECUTIONS,
|
ASSOC_EVENT_EXECUTIONS,
|
||||||
new JavaBehaviour(this, "eventExecutionUpdate", NotificationFrequency.TRANSACTION_COMMIT));
|
jbEventExecutionUpdate);
|
||||||
|
|
||||||
this.policyComponent.bindClassBehaviour(
|
this.policyComponent.bindClassBehaviour(
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"),
|
QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"),
|
||||||
TYPE_EVENT_EXECUTION,
|
TYPE_EVENT_EXECUTION,
|
||||||
new JavaBehaviour(this, "eventExecutionDelete", NotificationFrequency.TRANSACTION_COMMIT));
|
jbEventExecutionDelete);
|
||||||
|
|
||||||
this.policyComponent.bindClassBehaviour(
|
this.policyComponent.bindClassBehaviour(
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"),
|
QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"),
|
||||||
@@ -216,6 +231,22 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
|||||||
new JavaBehaviour(this, "frozenAspectUpdateProperties", NotificationFrequency.TRANSACTION_COMMIT));
|
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.
|
* Ensures the search aspect for the given node is present, complete and correct.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user