mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-925 The updated rule is triggered several timce by complete/undo event, cutoff/undo cutoff
- Ignored these type of node from being fired by rules: dispositionSchedule dispositionAction eventExecution git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@55273 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.rule;
|
package org.alfresco.repo.rule;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||||
@@ -40,6 +41,8 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
|||||||
{
|
{
|
||||||
private boolean runAsRmAdmin = true;
|
private boolean runAsRmAdmin = true;
|
||||||
|
|
||||||
|
private Set<QName> ignoredTypes = new HashSet<QName>();
|
||||||
|
|
||||||
private FilePlanService filePlanService;
|
private FilePlanService filePlanService;
|
||||||
|
|
||||||
private FilePlanAuthenticationService filePlanAuthenticationService;
|
private FilePlanAuthenticationService filePlanAuthenticationService;
|
||||||
@@ -66,6 +69,17 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
|||||||
this.filePlanService = filePlanService;
|
this.filePlanService = filePlanService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
// Specify a set of system types to be ignored by rule executions
|
||||||
|
ignoredTypes.add(RecordsManagementModel.TYPE_DISPOSITION_SCHEDULE);
|
||||||
|
ignoredTypes.add(RecordsManagementModel.TYPE_DISPOSITION_ACTION);
|
||||||
|
ignoredTypes.add(RecordsManagementModel.TYPE_EVENT_EXECUTION);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveRule(final NodeRef nodeRef, final Rule rule)
|
public void saveRule(final NodeRef nodeRef, final Rule rule)
|
||||||
{
|
{
|
||||||
@@ -115,10 +129,10 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
|||||||
{
|
{
|
||||||
QName typeQName = nodeService.getType(nodeRef);
|
QName typeQName = nodeService.getType(nodeRef);
|
||||||
|
|
||||||
// The dispositionSchedule node will not be executed by rules
|
|
||||||
if (filePlanService.isFilePlanComponent(nodeRef) == true
|
if (filePlanService.isFilePlanComponent(nodeRef) == true
|
||||||
&& typeQName.equals(RecordsManagementModel.TYPE_DISPOSITION_SCHEDULE) == false
|
|
||||||
&& isFilePlanComponentRule(rule) == true && runAsRmAdmin == true)
|
&& isFilePlanComponentRule(rule) == true && runAsRmAdmin == true)
|
||||||
|
{
|
||||||
|
if (isIgnoredType(typeQName) == false)
|
||||||
{
|
{
|
||||||
String user = AuthenticationUtil.getFullyAuthenticatedUser();
|
String user = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||||
try
|
try
|
||||||
@@ -131,6 +145,7 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
|||||||
AuthenticationUtil.setFullyAuthenticatedUser(user);
|
AuthenticationUtil.setFullyAuthenticatedUser(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// just execute the rule as the current user
|
// just execute the rule as the current user
|
||||||
@@ -143,4 +158,12 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
|||||||
NodeRef nodeRef = getOwningNodeRef(rule);
|
NodeRef nodeRef = getOwningNodeRef(rule);
|
||||||
return filePlanService.isFilePlanComponent(nodeRef);
|
return filePlanService.isFilePlanComponent(nodeRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param typeQName
|
||||||
|
*/
|
||||||
|
private boolean isIgnoredType(QName typeQName)
|
||||||
|
{
|
||||||
|
return ignoredTypes.contains(typeQName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user