Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 nodeRe
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement