3 Replies Latest reply on Oct 25, 2011 2:45 AM by stone crasy

    Tasks definition extension points

    Marco Piraccini Newbie

      Hi Guys,


      I'm looking for a (smart) way of extending Tasks definitions with custom attributes, in a way similar to the one used with "drools" attributes.

      For instance, if we have:


      <bpmn2:task id="(...)" drools:taskName="Application" name="Task2">




      ...I'd like also to define:


      <bpmn2:task id="(...)" drools:taskName="Application" custom:group="test" name="Task2">




      ...where the "group" attibute is defined by me.

      Now, I'd like to get these values in my WorkItems, so that I can use them in my (custom) WorkItemHandler.


      Looking at the JBPM code, the correct strategy seems to be (correct me, if I'm wrong) to load them in the org.jbpm.bpmn2.xmlAbstractWorkHandler class and to put them as WorkItem "Metadata".

      Now the question is: Is my reasoning is correct ore there's a smarter way to obtain the same thing? Becaus if i'm not wrong, I have to modify the JBPM code to implement that...



        • 1. Re: Tasks definition extension points
          Kris Verlaenen Master

          If you want to define them as custom attributes, you would have to extend the jBPM code, yes.

          It's probably a lot easier to just define an additional task parameter that contains your data.  So it will be similar to properties like Comment and Priority, but the data will simply be stored as a task parameter, as part of the ioSpecification of the userTask.  This would not require you to extend the code itself, as tasks allow you to define additional task parameters out of the box.  You can then use this parameter in your handler by doing workItem.getParameter(name).


          Assuming you're defining your processes in XML, I would suggest taking a look at how properties like Comment and Priority get saved in the BPMN2 XML, so you can do something similar for your parameter.



          • 2. Re: Tasks definition extension points
            stone crasy Newbie


            I  edited jbpm-bpmn2-5.1.0.Final.jar\META-INF\BPMN2SemanticModule.conf,add codes:

            myuserTask=org.drools.bpmn2.xml.MyUserTaskHandler .MyUserTaskHandler.java extends TaskHandler,but bpmn file could not find myuserTask view.

            So,how can I set conf file to present myuserTask view.

            • 3. Re: Tasks definition extension points
              stone crasy Newbie

              why is it wrong when I do this


                  "name" : "myUserTask",

                  "parameters" : [

                    "ActorId" : new StringDataType("kris"),

                    "Content" : new StringDataType()


                  "displayName" : "My User Task",