1 Reply Latest reply on Oct 30, 2013 3:31 AM by quangtin3

    how to get completed tasks with nodeids for current running processinstance

    shivarajud dasaraju Newbie

      how to get completed tasks with nodeids for current running processinstance

        • 1. Re: how to get completed tasks with nodeids for current running processinstance
          quangtin3 Newbie

          Hi Shivarajud Dasaraju

          In one of our project uses the jBpm 5.4.0.Final embedded, We needed to map between Task (completed, running and all other Task's states) and its NodeInstanceId (and NodeId) for drawing the process instance history (activities) diagram. Something like the one in the official jbpm-console, but we need to know WHO does WHAT (Task input parameters and Task output parameters) on each NodeInstance in the diagram. As you can see on the Tooltip when I move the mouse over a NodeInstance in the diagram below:

          process_history_diagram_screenshot.png

          I'm no jbpm5 expert, but I did look around and came up with a solution for Local Human Task Service (again, jBPM 5.4.0.Final):

          1. In jbpm-human-task-core (5.4.0.Final):

          • add nodeInstanceId variable to org.jbpm.task.TaskData
          private long processInstanceId = -1; /** looking for this line, then add: */
          private long nodeInstanceId = -1;
          
          
          
          • searching for all processInstanceId in the org.jbpm.task package, adding another one for nodeInstanceId

          2. In org.jbpm.process.workitem.wsht.AbstractHTWorkItemHandler

          • add methods, thoes look for NodeInstanceId when a Task instance was created from a WorkItem,
          • set nodeInstanceId for TaskData
          taskData.setProcessInstanceId(workItem.getProcessInstanceId());
          taskData.setNodeInstanceId(getNodeInstance(workItem).getId());
          
          
          

          3. Recreate your Human Task database, or manual add nodeInstanceId for the Task table.

          After this we will have nodeInstanceId in Task table. By the information in nodeInstanceId, we can connect two worlds.

           

          In hope this helps, and any feedback would be greatly appreciated!