platform module archetype updates
This commit is contained in:
parent
e1cd5245ef
commit
f8b92d5c35
@ -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
|
||||
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user