AnsweredAssumed Answered

business rule with action MoveActionExecuter

Question asked by teron_lsde on Feb 2, 2008
hi everyone!

i'm currently creating a java-class using the java-repository-api. the class has the purpose of automatically setting up quite a huge structure of spaces/groups/permissions/rules/workflows/… based on a self-created  script-language (but that's off topic in fact).

technically, i've implemented a java-class performing all the necessary stuff, which has to be executed by the admin as a script action. amongst other issues the class has to apply business rules to the repository, which implement inbound-based move-actions on newly created content.

the rule is created by the following code:

NodeRef _moveDestinationSpace = getNodeByPath(companyHomeNodeRef, "B"); // getNodeByPath is a self-created function

// Rule properties
Map<String, Serializable> _conditionProps = new HashMap<String, Serializable>();

Map<String, Serializable> _actionProps = new HashMap<String, Serializable>();
_actionProps.put(MoveActionExecuter.PARAM_DESTINATION_FOLDER, _moveDestinationSpace);
_actionProps.put(MoveActionExecuter.PARAM_ASSOC_TYPE_QNAME, ContentModel.ASSOC_CONTAINS);
_actionProps.put(MoveActionExecuter.PARAM_ASSOC_TYPE_QNAME, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "move")); //************************ PROBLEM

List<String> _ruleTypes = new ArrayList<String>(1);
_ruleTypes.add(RuleType.INBOUND);

// Create the action
Action _action = actionService.createAction(MoveActionExecuter.NAME);
_action.setParameterValues(_actionProps);

ActionCondition _actionCondition = actionService.createActionCondition(NoConditionEvaluator.NAME);
_actionCondition.setParameterValues(_conditionProps);
_action.addActionCondition(_actionCondition);

// Create the rule
Rule rule = new Rule();
rule.setRuleTypes(_ruleTypes);
rule.setTitle(title);
rule.setDescription(description);
rule.applyToChildren(isAppliedToChildren);       
rule.setAction(_action);

return rule;

the problem is the following:
creating a move action with explicit nodes is quite simple. but the issue is, that the move action has to be performed upon a node (a file) which is dynamically put into the space applying the rule-type (INBOUND). i just have no idea of how to define the parameters of MoveActionExecuter, so that a newly created node is moved somewhere else. in fact it is an absolutely standard usecase, but i just don't get a clue out of the alfresco source, because it contains QNames like "move" or "moved" for MoveActionExecuter,.PARAM_ASSOC_QNAME, which makes absolutely no sense to me.

so again, the question is: which parameters do i have to pass to MoveActionExecuter, in order to perform a standard move action on INBOUND content.

thanks, very much!

greetz!

Outcomes