AnsweredAssumed Answered

Implementing a ReceiveTask

Question asked by ungawunga on Mar 12, 2013
So I have an Alfresco receiveTask where I'd like to perform a custom action that requires me to implement it in Java. Javascript, no problem. Java, I could use some direction…

Here's the workflow snippet:

    <receiveTask id="IssuePost" name="Issue Post">
      <extensionElements>
        <activiti:executionListener event="start" class="com.blah.metadata.listeners.IssuePost"></activiti:executionListener>
      </extensionElements>
    </receiveTask>


I tried to use the TaskListener class from the JPotts PDF document, but that didn't work because of my BPMN uses executionListener instead of his taskListener. (anyone have a good document on the differences?) I got the following exception:

com.blah.metadata.listeners.IssuePost doesn't implement interface org.activiti.engine.delegate.ExecutionListener nor interface org.activiti.engine.delegate.JavaDelegate

Ok, so I switched over to the following:

Note: editing my question as we figured it out after spending a few more minutes on it…



public class IssuePost implements ExecutionListener
{
   @Override
   public void notify(DelegateExecution arg0) throws Exception {
         ActivitiScriptNode scriptNode = ( ActivitiScriptNode )task.getVariable(WorkflowNotificationUtils.PROP_PACKAGE );

   }
}


Which gets the ScriptNode, where I can then get at the associated files… and get my work done. Thanks.

Outcomes