AnsweredAssumed Answered

Adding TaskListener in custom BpmnParseHandler

Question asked by jwojtczak on Jul 26, 2013
Latest reply on Jun 23, 2017 by mprakash
Hi,

I'm trying to add TaskListener to UserTask in custom BpmnParseHandler. I implemented BpmnParsehandler interface and added my TestBpmnParseHandler to the processEngineConfiguration bean.


   <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
      …
      <property name="preBpmnParseHandlers">
         <list>
            <bean class="com.testowy.test.TestBpmnParseHandler" />
         </list>
      </property>
      …
   </bean>


I tried to add TaskListener by adding ExstensionElement to BaseElement that is being processed, but it does not work, TaskListener is not being executed when the UserTask is completed.

   public class TestBpmnParseHandler implements BpmnParseHandler {
   //…
      @Override
      public void parse(BpmnParse bpmnParse, BaseElement element) {
         //…
         ExtensionElement ee = new ExtensionElement();
         ee.setNamespacePrefix("activiti");
         ee.setName("taskListener");
         ExtensionAttribute ea = new ExtensionAttribute();
         ea.setName("event");
         ea.setValue("complete");
         ee.addAttribute(ea);
         ExtensionAttribute ea2 = new ExtensionAttribute();
         ea2.setName("class");
         ea2.setValue("com.testowy.common.AOTaskListener");
         ee.addAttribute(ea2);
         element.addExtensionElement(ee);
         //…
      }
   //…
   }

Do You have any ideas what am I doing wrong?

Outcomes