diff --git a/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleActionExecuter.java b/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleActionExecuter.java index b8f7273..8ed5dc0 100644 --- a/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleActionExecuter.java +++ b/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleActionExecuter.java @@ -30,6 +30,8 @@ import org.springframework.stereotype.Component; /** * This class is an example of how you can use the Alfresco Java Public API in Alfresco Actions. + * + * The bean must be declared in the XML and not through annotations. */ public class ExampleActionExecuter extends ActionExecuterAbstractBase { @@ -45,9 +47,8 @@ public class ExampleActionExecuter extends ActionExecuterAbstractBase { } @Override - protected void executeImpl(Action action, NodeRef actionedUponNoderef) { - if (this.logger.isTraceEnabled()) - this.logger.trace("executeImpl('" + actionedUponNoderef + "')"); + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { + this.logger.trace("executeImpl({})", actionedUponNodeRef); String value = (String)action.getParameterValue("example.param"); // TODO do some work diff --git a/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleEventListener.java b/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleEventListener.java index ef3c358..73c8f02 100644 --- a/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleEventListener.java +++ b/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleEventListener.java @@ -14,11 +14,19 @@ */ package ${package}; +import java.io.Serializable; +import java.util.Map; + import org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy; +import org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.alfresco.repo.policy.JavaBehaviour; import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.namespace.QName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -29,7 +37,8 @@ import org.springframework.stereotype.Component; * This class is an example of how you can use the Alfresco Java Public API when Alfresco triggers an event. */ @Component -public class ExampleEventListener extends AbstractLifecycleBean implements OnCreateNodePolicy { +@BehaviourBean +public class ExampleEventListener extends AbstractLifecycleBean implements OnCreateNodePolicy, OnUpdatePropertiesPolicy { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @@ -64,9 +73,17 @@ public class ExampleEventListener extends AbstractLifecycleBean implements OnCre */ @Override public void onCreateNode(ChildAssociationRef childAssocRef) { - this.logger.trace("onCreateNode('" + childAssocRef.getChildRef() + "')"); + this.logger.trace("onCreateNode({})", childAssocRef.getChildRef()); // TODO do some work } + @Behaviour(kind = BehaviorKind.CLASS, NotificationFrequency = NotificationFrequency.FIRST_EVENT) + public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) { + this.logger.trace("onUpdateProperties({})", nodeRef); + + // TODO do some work + + } + } diff --git a/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleGetWebScript.java b/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleGetWebScript.java index 75967eb..bf2c3b5 100644 --- a/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleGetWebScript.java +++ b/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleGetWebScript.java @@ -46,8 +46,7 @@ public class ExampleGetWebScript extends AbstractWebScript { */ @Override public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException { - if (this.logger.isTraceEnabled()) - this.logger.trace("execute()"); + this.logger.trace("execute()"); // TODO do some work } diff --git a/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleJavaScriptRootObject.java b/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleJavaScriptRootObject.java index 4dc1564..ca8da09 100644 --- a/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleJavaScriptRootObject.java +++ b/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleJavaScriptRootObject.java @@ -23,6 +23,8 @@ import org.springframework.stereotype.Component; /** * This class is an example of how you can use the Alfresco Java Public API to extend the JavaScript engine. + * + * The bean must be declared in the XML and not through annotations. */ public class ExampleJavaScriptRootObject extends BaseProcessorExtension { @@ -40,8 +42,7 @@ public class ExampleJavaScriptRootObject extends BaseProcessorExtension { * The `example` root name comes from the `module-context.xml` file. */ public String getMessage(String messageKey) { - if (this.logger.isTraceEnabled()) - this.logger.trace("getMessage('" + messageKey + "')"); + this.logger.trace("getMessage({})", messageKey); return this.serviceRegistry.getDictionaryService().getMessage(messageKey); } diff --git a/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleJob.java b/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleJob.java index 6a0ac46..0d7ce66 100644 --- a/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleJob.java +++ b/beedk-acs-platform-module-archetype/src/main/resources/archetype-resources/src/main/java/ExampleJob.java @@ -61,8 +61,7 @@ public class ExampleJob implements Job { @Override public void execute(JobExecutionContext context) throws JobExecutionException { - if (this.logger.isTraceEnabled()) - this.logger.trace("execute('" + context.getFireInstanceId() + "')"); + this.logger.trace("execute({})", context.getFireInstanceId()); // provide some authority within the Alfresco context AuthenticationUtil.runAsSystem(new RunAsWork<Void>() { @@ -81,8 +80,7 @@ public class ExampleJob implements Job { } public void fire(JobExecutionContext context) throws JobExecutionException { - if (this.logger.isTraceEnabled()) - this.logger.trace("fire('" + context.getFireInstanceId() + "')"); + this.logger.trace("fire({})", context.getFireInstanceId()); // TODO do some work }