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.