From a0a312b24d21aaa588c88cc063a69c35b721ff51 Mon Sep 17 00:00:00 2001 From: Roy Wetherall Date: Tue, 26 Feb 2008 16:35:04 +0000 Subject: [PATCH] Merged V2.2 to HEAD 7461: Reapply rules to children and other rule related fixes git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8385 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/action-services-context.xml | 3 ++ .../ExecuteAllRulesActionExecuter.java | 35 +++++++++++++++---- .../repo/coci/CheckOutCheckInServiceImpl.java | 5 ++- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/config/alfresco/action-services-context.xml b/config/alfresco/action-services-context.xml index 13b66c0759..ced22775ba 100644 --- a/config/alfresco/action-services-context.xml +++ b/config/alfresco/action-services-context.xml @@ -413,6 +413,9 @@ + + + diff --git a/source/java/org/alfresco/repo/action/executer/ExecuteAllRulesActionExecuter.java b/source/java/org/alfresco/repo/action/executer/ExecuteAllRulesActionExecuter.java index 266375e4f7..d50485e07b 100644 --- a/source/java/org/alfresco/repo/action/executer/ExecuteAllRulesActionExecuter.java +++ b/source/java/org/alfresco/repo/action/executer/ExecuteAllRulesActionExecuter.java @@ -28,6 +28,7 @@ import java.util.List; import org.alfresco.model.ContentModel; import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.repo.rule.RuntimeRuleService; import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.ActionService; import org.alfresco.service.cmr.action.ParameterDefinition; @@ -62,6 +63,11 @@ public class ExecuteAllRulesActionExecuter extends ActionExecuterAbstractBase */ private RuleService ruleService; + /** + * The runtime rule service + */ + private RuntimeRuleService runtimeRuleService; + /** * The action service */ @@ -90,6 +96,16 @@ public class ExecuteAllRulesActionExecuter extends ActionExecuterAbstractBase this.ruleService = ruleService; } + /** + * Set the runtime rule service + * + * @param runtimeRuleService the runtime rule service + */ + public void setRuntimeRuleService(RuntimeRuleService runtimeRuleService) + { + this.runtimeRuleService = runtimeRuleService; + } + /** * Set the action service * @@ -125,7 +141,7 @@ public class ExecuteAllRulesActionExecuter extends ActionExecuterAbstractBase includeInherited = includeInheritedValue.booleanValue(); } - // Get the rules + // Get the rules List rules = this.ruleService.getRules(actionedUponNodeRef, includeInherited); if (rules != null && rules.isEmpty() == false) { @@ -140,12 +156,17 @@ public class ExecuteAllRulesActionExecuter extends ActionExecuterAbstractBase if (this.dictionaryService.isSubClass(this.nodeService.getType(child), ContentModel.TYPE_SYSTEM_FOLDER) == false) { for (Rule rule : rules) - { - Action action = rule.getAction(); - if (action != null) - { - this.actionService.executeAction(action, child); - } + { + // Only reapply rules that are enabled + if (rule.getRuleDisabled() == false) + { + Action action = rule.getAction(); + if (action != null) + { + //this.actionService.executeAction(action, child); + this.runtimeRuleService.addRulePendingExecution(actionedUponNodeRef, child, rule); + } + } } } } diff --git a/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java b/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java index 69a9b78c33..9ea83ca230 100644 --- a/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java +++ b/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java @@ -50,7 +50,7 @@ import org.alfresco.service.cmr.version.VersionService; import org.alfresco.service.namespace.QName; /** - * Version opertaions service implementation + * Version operations service implementation * * @author Roy Wetherall */ @@ -105,6 +105,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService /** * The versionable aspect behaviour implementation */ + @SuppressWarnings("unused") private VersionableAspect versionableAspect; /** @@ -374,7 +375,6 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService if (keepCheckedOut == false) { // Delete the working copy - this.nodeService.removeAspect(workingCopyNodeRef, ContentModel.ASPECT_WORKING_COPY); this.nodeService.deleteNode(workingCopyNodeRef); } else @@ -448,7 +448,6 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService this.lockService.unlock(nodeRef); // Delete the working copy - this.nodeService.removeAspect(workingCopyNodeRef, ContentModel.ASPECT_WORKING_COPY); this.nodeService.deleteNode(workingCopyNodeRef); } else