Great. It is working now.
I mixed your two code frags to get the currently active task. Becuase the previous code gives me both type 0 and type 1 nodes and the other code gives me all the nodes of the process. So I am checking if a node has both type 0 and type 1 then it has definitely been completed. Otherwise it is pending. Btw. I am hoping that there are only 2 types for a task. Enter and Exit.
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(
"height"));coordinates.add(node.getMetaData().get(
"width"));}
}