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 34 public class SetPropertyValueActionExecuter extends ActionExecuterAbstractBase 35 { 36 39 public static final String NAME = "set-property-value"; 40 public static final String PARAM_PROPERTY = "property"; 41 public static final String PARAM_VALUE = "value"; 42 43 46 private NodeService nodeService; 47 48 53 public void setNodeService(NodeService nodeService) 54 { 55 this.nodeService = nodeService; 56 } 57 58 61 public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) 62 { 63 if (this.nodeService.exists(actionedUponNodeRef) == true) 64 { 65 this.nodeService.setProperty( 67 actionedUponNodeRef, 68 (QName)ruleAction.getParameterValue(PARAM_PROPERTY), 69 ruleAction.getParameterValue(PARAM_VALUE)); 70 } 71 } 72 73 76 @Override 77 protected void addParameterDefintions(List <ParameterDefinition> paramList) 78 { 79 paramList.add(new ParameterDefinitionImpl(PARAM_PROPERTY, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_PROPERTY))); 80 paramList.add(new ParameterDefinitionImpl(PARAM_VALUE, DataTypeDefinition.ANY, true, getParamDisplayLabel(PARAM_VALUE))); 81 } 82 83 } 84 | Popular Tags |