03-10-2011 08:59 AM
Action action = actionService.createAction(AddAspectActionExecuter.NAME);
Rule rule = new Rule();
rule.setTitle("my Rule");
rule.setAction(action);
ruleService.saveRule(nodeRef, rule);
Rule rule = ruleService.getRule(nodeRef); //the nodeRef instance is the same used for rule save
org.alfresco.service.cmr.rule.RuleServiceException: 02100001 Rule exists without a specified action
at org.alfresco.repo.rule.RuleServiceImpl.getRule(RuleServiceImpl.java:702)
at …..
05-18-2011 07:14 AM
05-25-2011 10:05 AM
Rule rule = new Rule();
rule.setRuleType(RuleType.INBOUND);
rule.setTitle("Your Rule Title");
rule.applyToChildren(false); // set this to true if you want to cascade to sub folders
CompositeAction compositeAction = actionService.createCompositeAction();
rule.setAction(compositeAction);
ActionCondition actionCondition = actionService.createActionCondition(IsSubTypeEvaluator.NAME);
Map<String, Serializable> conditionParameters = new HashMap<String, Serializable>(1);
conditionParameters.put(IsSubTypeEvaluator.PARAM_TYPE, ContentModel.TYPE_CONTENT); // setting subtypes to CONTENT
actionCondition.setParameterValues(conditionParameters);
compositeAction.addActionCondition(actionCondition);
Action action = actionService.createAction(AddFeaturesActionExecuter.NAME); // The Add Aspect Action
action.setTitle("Your action title");
action.setExecuteAsynchronously(false);
Map<String, Serializable> ruleParameters = new HashMap<String, Serializable>(1);
ruleParameters.put(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_VERSIONABLE); // The Aspect to add
action.setParameterValues(ruleParameters);
compositeAction.addAction(action);
ruleService.saveRule(nodeRef, rule); // Save the rule to your nodeRef
07-27-2011 04:20 AM
11-15-2011 02:58 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.