mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V34 to HEAD:
Merged V33 to V34: 24440: ALF-6114: Rules for updated items are triggered before users commit any changes. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@24938 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1218,6 +1218,9 @@
|
|||||||
<property name="versionService">
|
<property name="versionService">
|
||||||
<ref bean="versionService" />
|
<ref bean="versionService" />
|
||||||
</property>
|
</property>
|
||||||
|
<property name="ruleService">
|
||||||
|
<ref bean="ruleService" />
|
||||||
|
</property>
|
||||||
<property name="lockService">
|
<property name="lockService">
|
||||||
<ref bean="LockService" />
|
<ref bean="LockService" />
|
||||||
</property>
|
</property>
|
||||||
|
@@ -52,6 +52,7 @@ import org.alfresco.service.cmr.repository.ContentData;
|
|||||||
import org.alfresco.service.cmr.repository.CopyService;
|
import org.alfresco.service.cmr.repository.CopyService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
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.ResultSet;
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||||
@@ -129,6 +130,9 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
|
|||||||
*/
|
*/
|
||||||
private AuthenticationService authenticationService;
|
private AuthenticationService authenticationService;
|
||||||
|
|
||||||
|
/** Rule service */
|
||||||
|
private RuleService ruleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The versionable aspect behaviour implementation
|
* The versionable aspect behaviour implementation
|
||||||
*/
|
*/
|
||||||
@@ -223,6 +227,14 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
|
|||||||
this.policyComponent = policyComponent;
|
this.policyComponent = policyComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ruleService rule service
|
||||||
|
*/
|
||||||
|
public void setRuleService(RuleService ruleService)
|
||||||
|
{
|
||||||
|
this.ruleService = ruleService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise method
|
* Initialise method
|
||||||
*/
|
*/
|
||||||
@@ -432,16 +444,24 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
|
|||||||
}
|
}
|
||||||
}, AuthenticationUtil.getSystemUserName());
|
}, AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
|
ruleService.disableRules();
|
||||||
|
try
|
||||||
|
{
|
||||||
// Update the working copy name
|
// Update the working copy name
|
||||||
this.nodeService.setProperty(workingCopy, ContentModel.PROP_NAME, copyName);
|
this.nodeService.setProperty(workingCopy, ContentModel.PROP_NAME, copyName);
|
||||||
|
|
||||||
// Get the user
|
|
||||||
String userName = getUserName();
|
|
||||||
|
|
||||||
// Apply the working copy aspect to the working copy
|
// Apply the working copy aspect to the working copy
|
||||||
Map<QName, Serializable> workingCopyProperties = new HashMap<QName, Serializable>(1);
|
Map<QName, Serializable> workingCopyProperties = new HashMap<QName, Serializable>(1);
|
||||||
workingCopyProperties.put(ContentModel.PROP_WORKING_COPY_OWNER, userName);
|
workingCopyProperties.put(ContentModel.PROP_WORKING_COPY_OWNER, userName);
|
||||||
this.nodeService.addAspect(workingCopy, ContentModel.ASPECT_WORKING_COPY, workingCopyProperties);
|
this.nodeService.addAspect(workingCopy, ContentModel.ASPECT_WORKING_COPY, workingCopyProperties);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ruleService.enableRules();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the user
|
||||||
|
String userName = getUserName();
|
||||||
|
|
||||||
// Lock the original node
|
// Lock the original node
|
||||||
this.lockService.lock(nodeRef, LockType.READ_ONLY_LOCK);
|
this.lockService.lock(nodeRef, LockType.READ_ONLY_LOCK);
|
||||||
|
@@ -199,4 +199,20 @@ public final class ScriptUtils extends BaseScopableProcessorExtension
|
|||||||
{
|
{
|
||||||
return I18NUtil.getMessage(messageId, params);
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user