As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
package org.alfresco.sample import org.alfresco.repo.action.executer.ActionExecuterAbstractBase
package org.alfresco.sample; import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; public class TagActionExecuter extends ActionExecuterAbstractBase { public static final String NAME = "tag"; private NodeService nodeService; public void setNodeService(NodeService nodeService) { this.nodeService = nodeService; } protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { if (this.nodeService.exists(actionedUponNodeRef) == true) { // add the aspect if it is not already present on the node QName tagAspect = QName.createQName("extension.tags", "taggable"); if (this.nodeService.hasAspect(actionedUponNodeRef, tagAspect) == false) { this.nodeService.addAspect(actionedUponNodeRef, tagAspect, null); } } } @Override protected void addParameterDefinitions(List<ParameterDefinition> paramList) { // there are no parameters } }
package org.alfresco.sample; import java.util.List; import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.ParameterDefinition; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.namespace.QName; public class TagActionExecuter extends ActionExecuterAbstractBase { public static final String NAME = "tag"; private NodeService nodeService; public void setNodeService(NodeService nodeService) { this.nodeService = nodeService; } protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { if (this.nodeService.exists(actionedUponNodeRef) == true) { // add the aspect if it is not already present on the node QName tagAspect = QName.createQName("extension.tags", "taggable"); if (this.nodeService.hasAspect(actionedUponNodeRef, tagAspect) == false) { this.nodeService.addAspect(actionedUponNodeRef, tagAspect, null); } } } @Override protected void addParameterDefinitions(List<ParameterDefinition> paramList) { // there are no parameters } }
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <beans> <bean id="tag" class="org.alfresco.sample.TagActionExecuter" parent="action-executer" > <property name="nodeService"> <ref bean="nodeService" /> </property> </bean> </beans>
public String getJSPPath() { return "/jsp/extension/tag.jsp"; }