Package org.jbpm.process.audit

Examples of org.jbpm.process.audit.ProcessInstanceLog


public class GraphViewerPluginImpl implements GraphViewerPlugin {
 
  private KnowledgeBase kbase;

  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


    delegate.removeProcess("312");
 
 
  @Test
  public void testStartInstance(){
    ProcessInstanceLog instance = delegate.startProcess("Minimal", null);
    assertEquals("Minimal", instance.getProcessId());
  }
View Full Code Here

    assertEquals("Minimal", instance.getProcessId());
  }
 
  @Test
  public void testGetProcessInstanceLog() {
    ProcessInstanceLog instance = delegate.startProcess("Minimal", null);
    assertEquals(instance.getId(), delegate.getProcessInstanceLog(instance.getId() + "").getId());
  }
View Full Code Here

  @Test
  public void testGetProcessInstanceVariables(){
    HashMap<String,Object> variables = new HashMap<String, Object>();
    variables.put("key", "value");
   
    ProcessInstanceLog instance = delegate.startProcess("UserTask", variables);
   
    assertEquals(variables, delegate.getProcessInstanceVariables(instance.getProcessInstanceId() + ""));
  }
View Full Code Here

    assertEquals(variables, delegate.getProcessInstanceVariables(instance.getProcessInstanceId() + ""));
  }
 
  @Test
  public void testSetProcessInstanceVariables(){
    ProcessInstanceLog instance = delegate.startProcess("UserTask", null);
    HashMap<String,Object> newVariables = new HashMap<String, Object>();
    newVariables.put("key", "value2");
    delegate.setProcessInstanceVariables(instance.getId() + "", newVariables);
    assertEquals(newVariables, delegate.getProcessInstanceVariables(instance.getId() + ""));
  }
View Full Code Here

  }
 
  @Test
  public void testProcessInstance(){
    String instanceID = Long.toString(delegate.startProcess("UserTask", null).getId());
    ProcessInstanceLog instanceLog =delegate.getProcessInstanceLog(instanceID);
    ProcessInstanceRef processInstanceRef = Transform.processInstance(instanceLog);
   
    assertEquals(instanceLog.getProcessInstanceId(),Long.parseLong(processInstanceRef.getId()));
    assertEquals(instanceLog.getProcessId(),processInstanceRef.getDefinitionId());
   
  }
View Full Code Here

    delegate.removeProcess(definitionId);
      return getProcessDefinitions();
  }

  public ProcessInstanceRef getProcessInstance(String instanceId) {
    ProcessInstanceLog processInstance = delegate.getProcessInstanceLog(instanceId);
    return Transform.processInstance(processInstance);
  }
View Full Code Here

    }
    return result;
  }

  public ProcessInstanceRef newInstance(String definitionId) {
    ProcessInstanceLog processInstance = delegate.startProcess(definitionId, null);
    return Transform.processInstance(processInstance);
  }
View Full Code Here

    ProcessInstanceLog processInstance = delegate.startProcess(definitionId, null);
    return Transform.processInstance(processInstance);
  }
 
  public ProcessInstanceRef newInstance(String definitionId, Map<String, Object> processVars) {
    ProcessInstanceLog processInstance = delegate.startProcess(definitionId, processVars);
    return Transform.processInstance(processInstance);
  }
View Full Code Here

        ProcessInstance processInstance = ksession.startProcess("agu.samples.sample1", params);

        AuditLogService logService = (AuditLogService) context.getBean("logService");
        DefaultTransactionDefinition def = new DefaultTransactionDefinition();
        TransactionStatus status = aptm.getTransaction(def);
        ProcessInstanceLog log = logService.findProcessInstance(processInstance.getId());
        assertNotNull(log);
        aptm.commit(status);

        List<TaskSummary> tasks = taskService.getTasksOwned("max", "en-UK");
        System.out.println("Found " + tasks.size() + " task(s) for user 'max'");
View Full Code Here

TOP

Related Classes of org.jbpm.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.