//@PersistenceUnit(unitName = "org.jbpm.domain")
  private EntityManagerFactory emf;
  public List<ActiveNodeInfo> getActiveNodeInfo(String instanceId) {
      AuditLogService auditLogService = new JPAAuditLogService(emf);
    ProcessInstanceLog processInstance = auditLogService.findProcessInstance(new Long(instanceId));
    if (processInstance == null) {
      throw new IllegalArgumentException("Could not find process instance " + instanceId);
    } 
    Map<String, NodeInstanceLog> nodeInstances = new HashMap<String, NodeInstanceLog>();
    for (NodeInstanceLog nodeInstance: auditLogService.findNodeInstances(new Long(instanceId))) {
      if (nodeInstance.getType() == NodeInstanceLog.TYPE_ENTER) {
        nodeInstances.put(nodeInstance.getNodeInstanceId(), nodeInstance);
      } else {
        nodeInstances.remove(nodeInstance.getNodeInstanceId());
      }
    }
    if (!nodeInstances.isEmpty()) {
      List<ActiveNodeInfo> result = new ArrayList<ActiveNodeInfo>();
      for (NodeInstanceLog nodeInstance: nodeInstances.values()) {
        boolean found = false;
        DiagramInfo diagramInfo = getDiagramInfo(processInstance.getProcessId());
        if (diagramInfo != null) {
            for (DiagramNodeInfo nodeInfo: diagramInfo.getNodeList()) {
              if (nodeInfo.getName().equals("id=" + nodeInstance.getNodeId())) {
                result.add(new ActiveNodeInfo(diagramInfo.getWidth(), diagramInfo.getHeight(), nodeInfo));
                found = true;
                break;
              }
            }
        } else {
            throw new IllegalArgumentException("Could not find info for diagram for process " + processInstance.getProcessId());
        }
        if (!found) {
          throw new IllegalArgumentException("Could not find info for node "
            + nodeInstance.getNodeId() + " of process " + processInstance.getProcessId());
        }
      }
      return result;
    }
    return null;