1 17 package org.alfresco.repo.action.executer; 18 19 import java.util.List ; 20 21 import org.alfresco.repo.action.ParameterDefinitionImpl; 22 import org.alfresco.service.cmr.action.Action; 23 import org.alfresco.service.cmr.action.ParameterDefinition; 24 import org.alfresco.service.cmr.dictionary.DataTypeDefinition; 25 import org.alfresco.service.cmr.repository.NodeRef; 26 import org.alfresco.service.cmr.repository.NodeService; 27 import org.alfresco.service.namespace.QName; 28 29 36 public class MoveActionExecuter extends ActionExecuterAbstractBase 37 { 38 public static final String NAME = "move"; 39 public static final String PARAM_DESTINATION_FOLDER = "destination-folder"; 40 public static final String PARAM_ASSOC_TYPE_QNAME = "assoc-type"; 41 public static final String PARAM_ASSOC_QNAME = "assoc-name"; 42 43 46 private NodeService nodeService; 47 48 public void setNodeService(NodeService nodeService) 49 { 50 this.nodeService = nodeService; 51 } 52 53 @Override 54 protected void addParameterDefintions(List <ParameterDefinition> paramList) 55 { 56 paramList.add(new ParameterDefinitionImpl(PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, true, getParamDisplayLabel(PARAM_DESTINATION_FOLDER))); 57 paramList.add(new ParameterDefinitionImpl(PARAM_ASSOC_TYPE_QNAME, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_ASSOC_TYPE_QNAME))); 58 paramList.add(new ParameterDefinitionImpl(PARAM_ASSOC_QNAME, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_ASSOC_QNAME))); 59 } 60 61 64 public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) 65 { 66 if (this.nodeService.exists(actionedUponNodeRef) == true) 67 { 68 NodeRef destinationParent = (NodeRef)ruleAction.getParameterValue(PARAM_DESTINATION_FOLDER); 69 QName destinationAssocTypeQName = (QName)ruleAction.getParameterValue(PARAM_ASSOC_TYPE_QNAME); 70 QName destinationAssocQName = (QName)ruleAction.getParameterValue(PARAM_ASSOC_QNAME); 71 72 this.nodeService.moveNode( 73 actionedUponNodeRef, 74 destinationParent, 75 destinationAssocTypeQName, 76 destinationAssocQName); 77 } 78 } 79 80 } 81 | Popular Tags |