mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-695: Consolidation of RM actions appearing in RM rule UI
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@50977 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -21,11 +21,14 @@ package org.alfresco.repo.rule;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.rule.Rule;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* Extended rule service implementation.
|
||||
@@ -39,6 +42,8 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
||||
|
||||
private FilePlanAuthenticationService filePlanAuthenticationService;
|
||||
|
||||
protected NodeService nodeService;
|
||||
|
||||
private RecordsManagementService recordsManagementService;
|
||||
|
||||
public void setRunAsRmAdmin(boolean runAsRmAdmin)
|
||||
@@ -56,6 +61,11 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
||||
this.recordsManagementService = recordsManagementService;
|
||||
}
|
||||
|
||||
public void setNodeService2(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveRule(final NodeRef nodeRef, final Rule rule)
|
||||
{
|
||||
@@ -81,24 +91,31 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
||||
@Override
|
||||
public void executeRule(final Rule rule, final NodeRef nodeRef, final Set<ExecutedRuleData> executedRules)
|
||||
{
|
||||
if (isFilePlanComponentRule(rule) == true && runAsRmAdmin == true)
|
||||
QName typeQName = nodeService.getType(nodeRef);
|
||||
|
||||
// The dispositionSchedule node will not be executed by rules
|
||||
if (recordsManagementService.isFilePlanComponent(nodeRef) == true
|
||||
&& typeQName.equals(RecordsManagementModel.TYPE_DISPOSITION_SCHEDULE) == false)
|
||||
{
|
||||
String user = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||
try
|
||||
if (isFilePlanComponentRule(rule) == true && runAsRmAdmin == true)
|
||||
{
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(filePlanAuthenticationService.getRmAdminUserName());
|
||||
ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules);
|
||||
String user = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||
try
|
||||
{
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(filePlanAuthenticationService.getRmAdminUserName());
|
||||
ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules);
|
||||
}
|
||||
finally
|
||||
{
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(user);
|
||||
}
|
||||
}
|
||||
finally
|
||||
else
|
||||
{
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(user);
|
||||
// just execute the rule as the current user
|
||||
super.executeRule(rule, nodeRef, executedRules);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// just execute the rule as the current user
|
||||
super.executeRule(rule, nodeRef, executedRules);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isFilePlanComponentRule(Rule rule)
|
||||
|
Reference in New Issue
Block a user