Creating a rule within a collaboration site was not possible

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@48057 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2013-03-13 18:55:25 +00:00
parent 682de2ef05
commit e653fe265e

View File

@@ -29,38 +29,38 @@ import org.alfresco.service.cmr.rule.Rule;
/** /**
* Extended rule service implementation. * Extended rule service implementation.
* *
* @author Roy Wetherall * @author Roy Wetherall
* @since 2.1 * @since 2.1
*/ */
public class ExtendedRuleServiceImpl extends RuleServiceImpl public class ExtendedRuleServiceImpl extends RuleServiceImpl
{ {
private boolean runAsRmAdmin = true; private boolean runAsRmAdmin = true;
private FilePlanAuthenticationService filePlanAuthenticationService; private FilePlanAuthenticationService filePlanAuthenticationService;
private RecordsManagementService recordsManagementService; private RecordsManagementService recordsManagementService;
public void setRunAsRmAdmin(boolean runAsRmAdmin) public void setRunAsRmAdmin(boolean runAsRmAdmin)
{ {
this.runAsRmAdmin = runAsRmAdmin; this.runAsRmAdmin = runAsRmAdmin;
} }
public void setFilePlanAuthenticationService(FilePlanAuthenticationService filePlanAuthenticationService) public void setFilePlanAuthenticationService(FilePlanAuthenticationService filePlanAuthenticationService)
{ {
this.filePlanAuthenticationService = filePlanAuthenticationService; this.filePlanAuthenticationService = filePlanAuthenticationService;
} }
public void setRecordsManagementService(RecordsManagementService recordsManagementService) public void setRecordsManagementService(RecordsManagementService recordsManagementService)
{ {
this.recordsManagementService = recordsManagementService; this.recordsManagementService = recordsManagementService;
} }
@Override @Override
public void saveRule(final NodeRef nodeRef, final Rule rule) public void saveRule(final NodeRef nodeRef, final Rule rule)
{ {
if (recordsManagementService.isFilePlanComponent(nodeRef) == true && runAsRmAdmin == true) if (recordsManagementService.isFilePlanComponent(nodeRef) == true && runAsRmAdmin == true)
{ {
AuthenticationUtil.runAsSystem(new RunAsWork<Void>() AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{ {
@Override @Override
@@ -69,20 +69,20 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
ExtendedRuleServiceImpl.super.saveRule(nodeRef, rule); ExtendedRuleServiceImpl.super.saveRule(nodeRef, rule);
return null; return null;
} }
}); });
} }
else else
{ {
saveRule(nodeRef, rule); super.saveRule(nodeRef, rule);
} }
} }
@Override @Override
public void executeRule(final Rule rule, final NodeRef nodeRef, final Set<ExecutedRuleData> executedRules) public void executeRule(final Rule rule, final NodeRef nodeRef, final Set<ExecutedRuleData> executedRules)
{ {
if (isFilePlanComponentRule(rule) == true && runAsRmAdmin == true) if (isFilePlanComponentRule(rule) == true && runAsRmAdmin == true)
{ {
String user = AuthenticationUtil.getFullyAuthenticatedUser(); String user = AuthenticationUtil.getFullyAuthenticatedUser();
try try
{ {
@@ -98,12 +98,12 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
{ {
// just execute the rule as the current user // just execute the rule as the current user
super.executeRule(rule, nodeRef, executedRules); super.executeRule(rule, nodeRef, executedRules);
} }
} }
private boolean isFilePlanComponentRule(Rule rule) private boolean isFilePlanComponentRule(Rule rule)
{ {
NodeRef nodeRef = getOwningNodeRef(rule); NodeRef nodeRef = getOwningNodeRef(rule);
return recordsManagementService.isFilePlanComponent(nodeRef); return recordsManagementService.isFilePlanComponent(nodeRef);
} }
} }