Package org.drools.process.audit

Examples of org.drools.process.audit.ProcessInstanceLog


* @author Kris Verlaenen
*/
public class GraphViewerPluginImpl implements GraphViewerPlugin {

  public List<ActiveNodeInfo> getActiveNodeInfo(String instanceId) {
    ProcessInstanceLog processInstance = ProcessInstanceDbLog.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: ProcessInstanceDbLog.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());
        for (DiagramNodeInfo nodeInfo: diagramInfo.getNodeList()) {
          if (nodeInfo.getName().equals("id=" + nodeInstance.getNodeId())) {
            result.add(new ActiveNodeInfo(diagramInfo.getWidth(), diagramInfo.getHeight(), nodeInfo));
            found = true;
            break;
          }
        }
        if (!found) {
          throw new IllegalArgumentException("Could not find info for node "
            + nodeInstance.getNodeId() + " of process " + processInstance.getProcessId());
        }
      }
      return result;
    }
    return null;
View Full Code Here

TOP

Related Classes of org.drools.process.audit.ProcessInstanceLog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.