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
  readKnowledgeBase(processName);
  process = kbase.getProcess(processDefId);
 
//Now you can get the nodes and coordinates using following code.  
  ArrayList<Object> coordinates = new ArrayList<Object>();
  try
  {
   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());
     coordinates.add(node.getMetaData().get("x"));
     coordinates.add(node.getMetaData().get("y"));
     coordinates.add(node.getMetaData().get("height"));
     coordinates.add(node.getMetaData().get("width"));
    }
   }
   coordinates.add(processName);
  }
 

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.

Regards.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792865#792865]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to