2 Replies Latest reply on Jun 5, 2012 11:40 PM by jett

    Registering WorkItemHandler for bpmn:Task

    jett

      From several samples that I've looked at, it is possible to register a handler to Human Tasks and Service Tasks by calling registerWorkItemHandler and passing the handler.

       

      For Human Tasks it's, registerWorkItemHandler("Human Task", humantaskworkitemhandlergoeshere)

      For Service Tasks it's, registerWorkItemHandler("Service Task", servicetaskworkitemhandlergoeshere)

       

      Is it possible to assign a generic handler to a bpmn2:Task node? I tried registerWorkItemHandler("Task" ...  but it does not work. The only way I can get it to work is if I pass along the tasks Id.

       

      Is there a way add a generic handler to generic nodes of a particular type?

        • 1. Re: Registering WorkItemHandler for bpmn:Task
          salaboy21

          Yes, with a generic <Task> you can use the drools:taskName="<your type name here>" attribute and then when you register your work item handler registerWorkItemHandler("<your type name here>", servicetaskworkitemhandlergoeshere). This attribute is generated automatically by the Process Designer if you fill the TaskName attr in the palete.

          Cheers

          • 2. Re: Registering WorkItemHandler for bpmn:Task
            jett

            Thanks for answer Mauricio.

             

            That is actually what I was able to get to work (added taskName attribue) and then did a registerWorkItemHandler. What I want is something similar to what happens when I do a registerWorkItemHandler("Human Task", ...) or registerWorkItemHandler("Service Task", ...). In those two cases, what happens is that all Human Tasks -or- all Service Tasks get assigned to the handler specified. For both, the API does not require you to register a handler for each Human Task/Service Task that is in the process.

             

            Is there a way I can programatically get a list of all the nodes in a process? (I can read the xml file directly but I prefer to go through the API).