mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Remove now unessesary checks from rule execution (RM-3148)
This commit is contained in:
@@ -171,8 +171,7 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
|||||||
if (nodeService.exists(nodeRef))
|
if (nodeService.exists(nodeRef))
|
||||||
{
|
{
|
||||||
QName typeQName = nodeService.getType(nodeRef);
|
QName typeQName = nodeService.getType(nodeRef);
|
||||||
if (shouldRuleBeAppliedToNode(rule, nodeRef, typeQName))
|
|
||||||
{
|
|
||||||
// check if this is a rm rule on a rm artifact
|
// check if this is a rm rule on a rm artifact
|
||||||
if (filePlanService.isFilePlanComponent(nodeRef) &&
|
if (filePlanService.isFilePlanComponent(nodeRef) &&
|
||||||
isFilePlanComponentRule(rule))
|
isFilePlanComponentRule(rule))
|
||||||
@@ -206,7 +205,6 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the rule is a file plan component
|
* Indicates whether the rule is a file plan component
|
||||||
@@ -228,44 +226,4 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
|||||||
{
|
{
|
||||||
return ignoredTypes.contains(typeQName);
|
return ignoredTypes.contains(typeQName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the rule is associated with the file plan component that the node it is being
|
|
||||||
* applied to isn't a hold container, a hold, a transfer container, a transfer, an unfiled
|
|
||||||
* record container, an unfiled record folder or unfiled content
|
|
||||||
*
|
|
||||||
* @param rule
|
|
||||||
* @param nodeRef
|
|
||||||
* @param typeQName
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private boolean shouldRuleBeAppliedToNode(final Rule rule, final NodeRef nodeRef, final QName typeQName)
|
|
||||||
{
|
|
||||||
return AuthenticationUtil.runAsSystem(new RunAsWork<Boolean>()
|
|
||||||
{
|
|
||||||
public Boolean doWork() throws Exception
|
|
||||||
{
|
|
||||||
boolean result = true;
|
|
||||||
NodeRef ruleNodeRef = getOwningNodeRef(rule);
|
|
||||||
if (filePlanService.isFilePlan(ruleNodeRef))
|
|
||||||
{
|
|
||||||
// if this rule is defined at the root of the file plan then
|
|
||||||
// we do not want to apply
|
|
||||||
// it to holds/transfers/unfiled content...
|
|
||||||
result = !(RecordsManagementModel.TYPE_HOLD.equals(typeQName)
|
|
||||||
|| RecordsManagementModel.TYPE_HOLD_CONTAINER.equals(typeQName)
|
|
||||||
|| RecordsManagementModel.TYPE_TRANSFER.equals(typeQName)
|
|
||||||
|| RecordsManagementModel.TYPE_TRANSFER_CONTAINER.equals(typeQName)
|
|
||||||
|| RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER
|
|
||||||
.equals(typeQName)
|
|
||||||
|| RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER.equals(typeQName)
|
|
||||||
|| nodeService.hasAspect(nodeRef,
|
|
||||||
RecordsManagementModel.ASPECT_TRANSFERRING)
|
|
||||||
|| nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FROZEN)
|
|
||||||
|| !recordService.isFiled(nodeRef));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -66,10 +66,10 @@ public class FilePlanRuleInheritanceTest extends BaseRMTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that a singel rule is set on the parent folder of the file plan root
|
* Given that a single rule is set on the parent folder of the file plan root
|
||||||
* And that it is configured to apply to children
|
* And that it is configured to apply to children
|
||||||
* When we ask for the rules on the file plan, inclusing those inherited
|
* When we ask for the rules on the file plan, including those inherited
|
||||||
* Then it will not include thos defined on the parent folder
|
* Then it will not include those defined on the parent folder
|
||||||
*/
|
*/
|
||||||
public void testFilePlanDoesNotInheritRulesFromParentFolder()
|
public void testFilePlanDoesNotInheritRulesFromParentFolder()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user