[jboss-user] [jBPM] - Re: How to show process diagram displaying all nodes executed in that process instance?

roxy1987 do-not-reply at jboss.com
Fri Jan 18 16:49:44 EST 2013

roxy1987 [https://community.jboss.org/people/roxy1987] created the discussion

"Re: How to show process diagram displaying all nodes executed in that process instance?"

To view the discussion, visit: https://community.jboss.org/message/792865#792865

There you go :
//You probably have just the process instance id. so you need to get teh proc def id
  String processDefId = JPAProcessInstanceDbLog.findProcessInstance(Long.parseLong(processInstanceId)).getProcessId();
// And process name to get a process object. I maintain an XML file to map process ids with process names and process image file names. So that i dont have to hard code process id or name anywhere. You can get the name whichever way you like...
  String processName = ........
  logger.info("Process Name : "+processName);
// FInally you need a process object. using process def id and process name.. 
// read your knowledge base feeding it your process name
  process = kbase.getProcess(processDefId);
//Now you can get the nodes and coordinates using following code.  
  ArrayList<Object> coordinates = new ArrayList<Object>();
   List<NodeInstanceLog> nodeInstanceLogList;
   for (Node node : (Node[])((WorkflowProcessImpl) process).getNodes())
    nodeInstanceLogList = JPAProcessInstanceDbLog.findNodeInstances(Long.parseLong(processInstanceId), new Long(node.getId()).toString());
    if(nodeInstanceLogList.size() == 1)
     logger.info("Name of the Node : "+node.getName());

Code above gives you the coordinates of the active workitem.

In your jsp you can have an image of your process in a div and another div to create a box or an arrow or whatever using the coordinates from the method above.


Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130118/6f75858c/attachment.html 

More information about the jboss-user mailing list