JBoss Community

Re: Implementing "Where Is the Process Now" feature

created by roxy1987 in jBPM - View the full discussion

To get the status of a process graphically, you need to find out the coordinates of the activity which is currently pending. The coordinates are saved in the bpmn file and can be retrieved as following :

process = kbase.getProcess(processDefId);
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);
}
catch(Exception e)
{
CustomExceptionHandler.handleException(e);
}
 


Once you have the coordinates you can use div tags in html to relatively places images of process and arrow.

Reply to this message by going to Community

Start a new discussion in jBPM at Community