[jboss-user] [jBPM] - Re: How track JBPM5 flow diagram?

Shobhit Tyagi do-not-reply at jboss.com
Thu Mar 14 11:11:58 EDT 2013


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

"Re: How track JBPM5 flow diagram?"

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

--------------------------------------------------------------
Zhao,

I believe you only have process instance id.
So you can use the following to get the coordinates of the current node :
public static ArrayList<String> getProcessGraphicalStatus(String processInstanceId) throws Exception
 {
  String processDefId = JPAProcessInstanceDbLog.findProcessInstance(Long.parseLong(processInstanceId)).getProcessId();
    kbase = readKnowledgeBase();  // Method to get the KnowledgeBase object.
     Process process = kbase.getProcess(processDefId);
 
 
  ArrayList<String> coordinates = new ArrayList<String>();
  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)
    {
     coordinates.add(node.getMetaData().get("x")+"");
     coordinates.add(node.getMetaData().get("y")+"");
     coordinates.add(node.getMetaData().get("height")+"");
     coordinates.add(node.getMetaData().get("width")+"");
    }
   }
  }
  catch(Exception e)
  {
   e.printStackTrace();
  }
  return coordinates;
 }


Once you have the coordinates you can put the following in your view : 


<div style="position:relative;width:1024px; height:768px;">
        <img src="ProcessImageUrl" style="position:absolute;top:0;left:0" />
       <ui:repeat value="CoordinateArrayList" var="item">
                 <div style="position:absolute;top:YCoordinatepx;left:XCoordinatepx;height:HeightCoordinatepx;width:WidthCoordinatepx;border:3px solid red; z-index:1000;"></div>
             </ui:repeat>
      </div>



Just reduce the height coordinate and width coordinate values by 6 before you put them in the view part. 

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

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

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130314/8d5eae51/attachment-0001.html 


More information about the jboss-user mailing list