Package org.jbpm.graph.exe

Examples of org.jbpm.graph.exe.Token


      "  </task-node>" +
      "  <state name='b' />" +
      "</process-definition>"
    );
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    Token token = processInstance.getRootToken();
    processInstance.signal();

    TaskMgmtInstance tmi = (TaskMgmtInstance) processInstance.getInstance(TaskMgmtInstance.class);
    assertNotNull(tmi);
    assertEquals(3, tmi.getTaskInstances().size());
   
    Iterator iter = tmi.getTaskInstances().iterator();
    while (iter.hasNext()) {
      // before every task is completed, check if the token is still in node a
      assertSame(processDefinition.getNode("a"), token.getNode());
      TaskInstance taskInstance = (TaskInstance) iter.next();
      taskInstance.end();
    }

    // after the 3 tasks have been completed, check if the token has moved to b
    assertSame(processDefinition.getNode("b"), token.getNode());
  }
View Full Code Here


      "  </task-node>" +
      "  <state name='b' />" +
      "</process-definition>"
    );
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    Token token = processInstance.getRootToken();
    processInstance.signal();

    TaskMgmtInstance tmi = (TaskMgmtInstance) processInstance.getInstance(TaskMgmtInstance.class);
    assertNotNull(tmi);
    assertEquals(3, tmi.getTaskInstances().size());
   
    // only before the first task, the token should be in a
    assertSame(processDefinition.getNode("a"), token.getNode());

    Iterator iter = tmi.getTaskInstances().iterator();
    while (iter.hasNext()) {
      // before every task is completed, check if the token is still in node a
      TaskInstance taskInstance = (TaskInstance) iter.next();
      taskInstance.end();

      // after each task, check if the token has moved to b
      assertSame(processDefinition.getNode("b"), token.getNode());
    }

  }
View Full Code Here

      "  </task-node>" +
      "  <state name='b' />" +
      "</process-definition>"
    );
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    Token token = processInstance.getRootToken();
    processInstance.signal();

    TaskMgmtInstance tmi = (TaskMgmtInstance) processInstance.getInstance(TaskMgmtInstance.class);
    assertNotNull(tmi);
    assertEquals(3, tmi.getTaskInstances().size());
   
    // only before the first task, the token should be in a
    assertSame(processDefinition.getNode("a"), token.getNode());

    Iterator iter = tmi.getTaskInstances().iterator();
    while (iter.hasNext()) {
      // before every task is completed, check if the token is still in node a
      TaskInstance taskInstance = (TaskInstance) iter.next();
      taskInstance.end();

      // after each task, check if the token remains in a
      assertSame(processDefinition.getNode("a"), token.getNode());
    }
    // signal='never' is used when an external trigger should trigger execution, without
    // any relation to the tasks finishing
    processInstance.signal();
    assertSame(processDefinition.getNode("b"), token.getNode());
  }
View Full Code Here

      "  </task-node>" +
      "  <state name='b' />" +
      "</process-definition>"
    );
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    Token token = processInstance.getRootToken();
    processInstance.signal();

    TaskMgmtInstance tmi = (TaskMgmtInstance) processInstance.getInstance(TaskMgmtInstance.class);
    assertNotNull(tmi);
    assertEquals(3, tmi.getTaskInstances().size());
   
    // unsyncronized means that after creation of the tasks, execution should just continue.
    assertSame(processDefinition.getNode("b"), token.getNode());

    Iterator iter = tmi.getTaskInstances().iterator();
    while (iter.hasNext()) {
      // before every task is completed, check if the token is still in node a
      TaskInstance taskInstance = (TaskInstance) iter.next();
      taskInstance.end();

      // after each task, check if the token remains in b
      assertSame(processDefinition.getNode("b"), token.getNode());
    }
  }
View Full Code Here

   
    return entity;
  }

  protected Object getVariable(String variableName) {
    Token token = executionContext.getToken();
    return executionContext.getContextInstance().getVariable(variableName, token);
  }
View Full Code Here

      "    </task>" +
      "  </task-node>" +
      "</process-definition>"
    );
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    Token token = processInstance.getRootToken();
    assertEquals(0, counter);
    processInstance.signal();
    assertEquals(0, counter);
   
    TaskMgmtInstance tmi = processInstance.getTaskMgmtInstance();
View Full Code Here

      "    </task>" +
      "  </task-node>" +
      "</process-definition>"
    );
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    Token token = processInstance.getRootToken();
    assertEquals(0, counter);
    processInstance.signal();
    assertEquals(0, counter);
   
    TaskMgmtInstance tmi = processInstance.getTaskMgmtInstance();
View Full Code Here

      "    <transition to='a' />" +
      "  </task-node>" +
      "</process-definition>"
    );
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    Token token = processInstance.getRootToken();
    assertEquals(0, counter);
    processInstance.signal();
    assertEquals(0, counter);
   
    TaskMgmtInstance tmi = processInstance.getTaskMgmtInstance();
View Full Code Here

    graphSession.saveProcessDefinition(processDefinition);
   
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    processInstance.signal();
    Token tokenA = processInstance.findToken("/a");
    Token tokenB = processInstance.findToken("/b");
   
    ContextInstance contextInstance = processInstance.getContextInstance();
    contextInstance.setVariable("r", "rrrrrr");
    contextInstance.createVariable("a", "aaaaaa", tokenA);
    contextInstance.createVariable("b", "bbbbbb", tokenB);
View Full Code Here

      "</process-definition>"
    );

    ProcessInstance pi = new ProcessInstance( pd );
    pi.signal();
    Token token = pi.getRootToken();
    assertSame( pd.getNode("a"), token.getNode() );
   
    token.signal();
    assertSame( pd.getNode("b"), token.getNode() );

    token.signal();
    assertSame( pd.getNode("c"), token.getNode() );

    token.signal();
    assertSame( pd.getNode("end"), token.getNode() );
  }
View Full Code Here

TOP

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

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.