Package org.jbpm.graph.exe

Examples of org.jbpm.graph.exe.ProcessInstance


      "  </state>" +
      "  <end-state name='end' />" +
      "</process-definition>"
    );
   
    ProcessInstance processInstance =
        new ProcessInstance(processDefinition);
    Token token = processInstance.getRootToken();
    assertSame(processDefinition.getStartState(), token.getNode());

    token.signal();
    assertSame(processDefinition.getNode("phase one"), token.getNode());
View Full Code Here


      "  </state>" +
      "  <end-state name='end' />" +
      "</process-definition>"
    );
   
    ProcessInstance processInstance =
      new ProcessInstance(processDefinition);

    // Fetch the context instance from the process instance
    // for working with the process variableInstances.
    ContextInstance contextInstance =
      processInstance.getContextInstance();
   
    // Before the process has left the start-state,
    // we are going to set some process variableInstances in the
    // context of the process instance.
    contextInstance.setVariable("amount", new Integer(500));
    contextInstance.setVariable("reason", "i met my deadline");
   
    // From now on, these variableInstances are associated with the
    // process instance.  The process variableInstances are now accessible
    // by user code via the API shown here, but also in the actions
    // and node implementations.  The process variableInstances are also 
    // stored into the database as a part of the process instance.
   
    processInstance.signal();
   
    // The variableInstances are accessible via the contextInstance.
   
    assertEquals(new Integer(500),
                 contextInstance.getVariable("amount"));
View Full Code Here

      "  <end-state name='end' />" +
      "</process-definition>"
    );
   
    // Create an execution of the process definition.
    ProcessInstance processInstance =
        new ProcessInstance(processDefinition);
    Token token = processInstance.getRootToken();
   
    // Let's start the process execution, leaving the start-state
    // over its default transition.
    token.signal();
    // The signal method will block until the process execution
    // enters a wait state.   In this case, that is the task-node.
    assertSame(processDefinition.getNode("t"), token.getNode());

    // When execution arrived in the task-node, a task 'change nappy'
    // was created and the NappyAssignmentHandler was called to determine
    // to whom the task should be assigned.  The NappyAssignmentHandler
    // returned 'papa'.

    // In a real environment, the tasks would be fetched from the
    // database with the methods in the org.jbpm.db.TaskMgmtSession.
    // Since we don't want to include the persistence complexity in
    // this example, we just take the first task-instance of this
    // process instance (we know there is only one in this test
    // scenario.
    TaskInstance taskInstance = (TaskInstance
        processInstance
          .getTaskMgmtInstance()
          .getTaskInstances()
          .iterator().next();

    // Now, we check if the taskInstance was actually assigned to 'papa'.
View Full Code Here

      "  </start-state>" +
      "  <state name='a' />" +
      "</process-definition>"
    );

    ProcessInstance processInstance;
    TaskMgmtInstance taskMgmtInstance;
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    jbpmContext.setActorId("the other guy");
    try {
      processInstance = new ProcessInstance(processDefinition);
      taskMgmtInstance = processInstance.getTaskMgmtInstance();
      taskMgmtInstance.createStartTaskInstance();
      processInstance.signal();
    } finally {
      jbpmContext.setActorId(null);
      jbpmContext.close();
    }
    assertEquals("the other guy", taskMgmtInstance.getSwimlaneInstance("initiator").getActorId());
View Full Code Here

      "    <task name='beauty sleep' swimlane='stalker' />" +
      "  </task-node>" +
      "</process-definition>"
    );
   
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    processInstance.signal();
   
    TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();
    TaskInstance changeNappy = (TaskInstance) taskMgmtInstance.getTaskInstances().iterator().next();
    SwimlaneInstance stalker = taskMgmtInstance.getSwimlaneInstance("stalker");
    assertNotNull(stalker);
    assertEquals(1, invocationCount);
    assertEquals("me", stalker.getActorId());
    assertEquals("me", changeNappy.getActorId());
   
    changeNappy.end();
   
    Token token = processInstance.getRootToken();
    TaskInstance beautySleep = (TaskInstance) taskMgmtInstance.getUnfinishedTasks(token).iterator().next();
    assertEquals("me", beautySleep.getActorId());
  }
View Full Code Here

      "    <task name='change nappy' swimlane='stalker' />" +
      "  </task-node>" +
      "</process-definition>"
    );
   
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    processInstance.signal();
   
    TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();
    TaskInstance changeNappy = (TaskInstance) taskMgmtInstance.getTaskInstances().iterator().next();
    SwimlaneInstance stalker = taskMgmtInstance.getSwimlaneInstance("stalker");
    assertNotNull(stalker);
    assertEquals("johndoe", stalker.getActorId());
    assertEquals("johndoe", changeNappy.getActorId());
View Full Code Here

      "    <task name='change nappy' swimlane='stalker' />" +
      "  </task-node>" +
      "</process-definition>"
    );
   
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    processInstance.signal();
   
    TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();
    TaskInstance changeNappy = (TaskInstance) taskMgmtInstance.getTaskInstances().iterator().next();
    SwimlaneInstance stalker = taskMgmtInstance.getSwimlaneInstance("stalker");
    assertNotNull(stalker);
    assertNull(stalker.getActorId());
    assertNull(changeNappy.getActorId());
View Full Code Here

      "    <task name='change nappy' swimlane='stalker' />" +
      "  </task-node>" +
      "</process-definition>"
    );
   
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    processInstance.signal();
   
    TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();
    TaskInstance changeNappy = (TaskInstance) taskMgmtInstance.getTaskInstances().iterator().next();
    SwimlaneInstance stalker = taskMgmtInstance.getSwimlaneInstance("stalker");
    assertNotNull(stalker);
    assertNull(stalker.getActorId());
    assertNull(changeNappy.getActorId());
View Full Code Here

      "    <task name='change nappy' swimlane='stalker' />" +
      "  </task-node>" +
      "</process-definition>"
    );
   
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    processInstance.signal();
   
    TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();
    TaskInstance changeNappy = (TaskInstance) taskMgmtInstance.getTaskInstances().iterator().next();
    SwimlaneInstance stalker = taskMgmtInstance.getSwimlaneInstance("stalker");
    assertNotNull(stalker);
    assertNull(stalker.getActorId());
    assertNull(changeNappy.getActorId());
View Full Code Here

      "    <task name='change nappy' swimlane='stalker' />" +
      "  </task-node>" +
      "</process-definition>"
    );
   
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    processInstance.signal();
   
    TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();
    TaskInstance changeNappy = (TaskInstance) taskMgmtInstance.getTaskInstances().iterator().next();
    SwimlaneInstance stalker = taskMgmtInstance.getSwimlaneInstance("stalker");
    assertNotNull(stalker);
    assertNull(stalker.getActorId());
    assertNull(changeNappy.getActorId());
View Full Code Here

TOP

Related Classes of org.jbpm.graph.exe.ProcessInstance

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.