Merged V2.2 to HEAD 7461: Reapply rules to children and other rule related fixes

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8385 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2008-02-26 16:35:04 +00:00
parent 8c434ca496
commit a0a312b24d
3 changed files with 33 additions and 10 deletions

View File

@@ -28,6 +28,7 @@ import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.ParameterDefinitionImpl;
import org.alfresco.repo.rule.RuntimeRuleService;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.action.ParameterDefinition;
@@ -62,6 +63,11 @@ public class ExecuteAllRulesActionExecuter extends ActionExecuterAbstractBase
*/
private RuleService ruleService;
/**
* The runtime rule service
*/
private RuntimeRuleService runtimeRuleService;
/**
* The action service
*/
@@ -90,6 +96,16 @@ public class ExecuteAllRulesActionExecuter extends ActionExecuterAbstractBase
this.ruleService = ruleService;
}
/**
* Set the runtime rule service
*
* @param runtimeRuleService the runtime rule service
*/
public void setRuntimeRuleService(RuntimeRuleService runtimeRuleService)
{
this.runtimeRuleService = runtimeRuleService;
}
/**
* Set the action service
*
@@ -125,7 +141,7 @@ public class ExecuteAllRulesActionExecuter extends ActionExecuterAbstractBase
includeInherited = includeInheritedValue.booleanValue();
}
// Get the rules
// Get the rules
List<Rule> rules = this.ruleService.getRules(actionedUponNodeRef, includeInherited);
if (rules != null && rules.isEmpty() == false)
{
@@ -140,12 +156,17 @@ public class ExecuteAllRulesActionExecuter extends ActionExecuterAbstractBase
if (this.dictionaryService.isSubClass(this.nodeService.getType(child), ContentModel.TYPE_SYSTEM_FOLDER) == false)
{
for (Rule rule : rules)
{
Action action = rule.getAction();
if (action != null)
{
this.actionService.executeAction(action, child);
}
{
// Only reapply rules that are enabled
if (rule.getRuleDisabled() == false)
{
Action action = rule.getAction();
if (action != null)
{
//this.actionService.executeAction(action, child);
this.runtimeRuleService.addRulePendingExecution(actionedUponNodeRef, child, rule);
}
}
}
}
}

View File

@@ -50,7 +50,7 @@ import org.alfresco.service.cmr.version.VersionService;
import org.alfresco.service.namespace.QName;
/**
* Version opertaions service implementation
* Version operations service implementation
*
* @author Roy Wetherall
*/
@@ -105,6 +105,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
/**
* The versionable aspect behaviour implementation
*/
@SuppressWarnings("unused")
private VersionableAspect versionableAspect;
/**
@@ -374,7 +375,6 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
if (keepCheckedOut == false)
{
// Delete the working copy
this.nodeService.removeAspect(workingCopyNodeRef, ContentModel.ASPECT_WORKING_COPY);
this.nodeService.deleteNode(workingCopyNodeRef);
}
else
@@ -448,7 +448,6 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
this.lockService.unlock(nodeRef);
// Delete the working copy
this.nodeService.removeAspect(workingCopyNodeRef, ContentModel.ASPECT_WORKING_COPY);
this.nodeService.deleteNode(workingCopyNodeRef);
}
else