diff --git a/config/alfresco/core-services-context.xml b/config/alfresco/core-services-context.xml index 5351d54630..3a2a8b77e4 100644 --- a/config/alfresco/core-services-context.xml +++ b/config/alfresco/core-services-context.xml @@ -1218,6 +1218,9 @@ + + + diff --git a/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java b/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java index 9a37642150..15b828822e 100644 --- a/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java +++ b/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java @@ -52,6 +52,7 @@ import org.alfresco.service.cmr.repository.ContentData; import org.alfresco.service.cmr.repository.CopyService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.rule.RuleService; import org.alfresco.service.cmr.search.ResultSet; import org.alfresco.service.cmr.search.SearchService; import org.alfresco.service.cmr.security.AuthenticationService; @@ -129,6 +130,9 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService */ private AuthenticationService authenticationService; + /** Rule service */ + private RuleService ruleService; + /** * The versionable aspect behaviour implementation */ @@ -223,6 +227,14 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService this.policyComponent = policyComponent; } + /** + * @param ruleService rule service + */ + public void setRuleService(RuleService ruleService) + { + this.ruleService = ruleService; + } + /** * Initialise method */ @@ -432,17 +444,25 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService } }, AuthenticationUtil.getSystemUserName()); - // Update the working copy name - this.nodeService.setProperty(workingCopy, ContentModel.PROP_NAME, copyName); + ruleService.disableRules(); + try + { + // Update the working copy name + this.nodeService.setProperty(workingCopy, ContentModel.PROP_NAME, copyName); + + // Apply the working copy aspect to the working copy + Map workingCopyProperties = new HashMap(1); + workingCopyProperties.put(ContentModel.PROP_WORKING_COPY_OWNER, userName); + this.nodeService.addAspect(workingCopy, ContentModel.ASPECT_WORKING_COPY, workingCopyProperties); + } + finally + { + ruleService.enableRules(); + } // Get the user String userName = getUserName(); - // Apply the working copy aspect to the working copy - Map workingCopyProperties = new HashMap(1); - workingCopyProperties.put(ContentModel.PROP_WORKING_COPY_OWNER, userName); - this.nodeService.addAspect(workingCopy, ContentModel.ASPECT_WORKING_COPY, workingCopyProperties); - // Lock the original node this.lockService.lock(nodeRef, LockType.READ_ONLY_LOCK); diff --git a/source/java/org/alfresco/repo/jscript/ScriptUtils.java b/source/java/org/alfresco/repo/jscript/ScriptUtils.java index 8ed2059722..e3357ae46d 100644 --- a/source/java/org/alfresco/repo/jscript/ScriptUtils.java +++ b/source/java/org/alfresco/repo/jscript/ScriptUtils.java @@ -199,4 +199,20 @@ public final class ScriptUtils extends BaseScopableProcessorExtension { return I18NUtil.getMessage(messageId, params); } + + /** + * Disable rule execution for this thread + */ + public void disableRules() + { + services.getRuleService().disableRules(); + } + + /** + * Enable rule execution for this thread + */ + public void enableRules() + { + services.getRuleService().enableRules(); + } }