RM-1021: It's possible to create record for synced content in folder with create record updated rule

* improve stability when defining update rules in collab site



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@56231 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2013-10-02 07:55:34 +00:00
parent b86621ce5c
commit 3f92fef4de
2 changed files with 44 additions and 32 deletions

View File

@@ -20,6 +20,7 @@ package org.alfresco.module.org_alfresco_module_rm.action.dm;
import java.util.List;
import org.alfresco.enterprise.repo.sync.SyncModel;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase;
@@ -161,6 +162,14 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " has previously been rejected.");
}
}
else if (nodeService.hasAspect(actionedUponNodeRef, SyncModel.ASPECT_SYNCED) == true)
{
// can't declare the record if the node is sync'ed
if (logger.isDebugEnabled() == true)
{
logger.debug("Can't declare as record, because " + actionedUponNodeRef.toString() + " is synched content.");
}
}
else
{
NodeRef filePlan = (NodeRef)action.getParameterValue(PARAM_FILE_PLAN);

View File

@@ -157,39 +157,42 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
@Override
public void executeRule(final Rule rule, final NodeRef nodeRef, final Set<ExecutedRuleData> executedRules)
{
QName typeQName = nodeService.getType(nodeRef);
// check if this is a rm rule on a rm artifact
if (filePlanService.isFilePlanComponent(nodeRef) == true &&
isFilePlanComponentRule(rule) == true)
if (nodeService.exists(nodeRef) == true)
{
// ignore and
if (isIgnoredType(typeQName) == false)
{
if (runAsRmAdmin == true)
{
// run as rmadmin
filePlanAuthenticationService.runAsRmAdmin(new RunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules);
return null;
}
});
}
else
{
// run as current user
ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules);
}
}
}
else
{
// just execute the rule as the current user
super.executeRule(rule, nodeRef, executedRules);
QName typeQName = nodeService.getType(nodeRef);
// check if this is a rm rule on a rm artifact
if (filePlanService.isFilePlanComponent(nodeRef) == true &&
isFilePlanComponentRule(rule) == true)
{
// ignore and
if (isIgnoredType(typeQName) == false)
{
if (runAsRmAdmin == true)
{
// run as rmadmin
filePlanAuthenticationService.runAsRmAdmin(new RunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules);
return null;
}
});
}
else
{
// run as current user
ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules);
}
}
}
else
{
// just execute the rule as the current user
super.executeRule(rule, nodeRef, executedRules);
}
}
}