Package org.jbpm.pvm

Examples of org.jbpm.pvm.ProcessDefinition


* @author Tom Baeyens
*/
public class _05_EventPropagationTest extends TestCase {

  public void testPropagationProcess(){
    ProcessDefinition processDefinition = ProcessFactory.build("propagate")
        .compositeNode("composite")
          .event(Node.EVENT_NODE_LEAVE)
            .listener(new DisplaySource())
          .node("a").initial().behaviour(new WaitState())
            .transition().to("b")
          .node("b").behaviour(new WaitState())
            .transition().to("c")
        .compositeEnd()
        .node("c").behaviour(new WaitState())
    .done();
   
    Execution execution = processDefinition.startExecution();
    execution.signal();
    execution.signal();
  }
View Full Code Here


    execution.signal();
    execution.signal();
  }

  public void testPropagationDisabledProcess(){
    ProcessDefinition processDefinition = ProcessFactory.build("propagate")
        .compositeNode("composite")
          .event(Node.EVENT_NODE_LEAVE)
            .listener(new DisplaySource())
            .propagationDisabled()
          .node("a").initial().behaviour(new WaitState())
            .transition().to("b")
          .node("b").behaviour(new WaitState())
            .transition().to("c")
        .compositeEnd()
        .node("c").behaviour(new WaitState())
    .done();
   
    Execution execution = processDefinition.startExecution();
    execution.signal();
    execution.signal();
  }
View Full Code Here

* @author Tom Baeyens
*/
public class _02_ExternalDecisionTest extends TestCase {

  public void testExternalTransitionDecision() {
    ProcessDefinition processDefinition = ProcessFactory.build()
        .node("initial").initial().behaviour(new WaitState())
          .transition().to("creditRate?")
        .node("creditRate?").behaviour(new ExternalSelection())
          .transition("good").to("a")
          .transition("average").to("b")
          .transition("bad").to("c")
        .node("a").behaviour(new WaitState())
        .node("b").behaviour(new WaitState())
        .node("c").behaviour(new WaitState())
    .done();
   
    Execution execution = processDefinition.startExecution();
    execution.signal();
    assertEquals("creditRate?", execution.getNode().getName());
    execution.signal("good");
    assertEquals("a", execution.getNode().getName());

    execution = processDefinition.startExecution();
    execution.signal();
    execution.signal("average");
    assertEquals("b", execution.getNode().getName());

    execution = processDefinition.startExecution();
    execution.signal();
    execution.signal("bad");
    assertEquals("c", execution.getNode().getName());
  }
View Full Code Here

* @author Tom Baeyens
*/
public class _03_BasicGraphExecutionText extends TestCase {

  public void testBuildFirstProcessGraph() {
    ProcessDefinition processDefinition = ProcessFactory.build()
        .node("accept loan request").initial().behaviour(new WaitState())
          .transition().to("loan evaluation")
        .node("loan evaluation").behaviour(new WaitState())
          .transition("approve").to("wire the money")
          .transition("reject").to("end")
        .node("wire the money").behaviour(new Display("automatic payment"))
          .transition().to("end")
        .node("end").behaviour(new WaitState())
    .done();
   
    Execution execution = processDefinition.startExecution();
    assertEquals("accept loan request", execution.getNode().getName());
    execution.signal();
    assertEquals("loan evaluation", execution.getNode().getName());
    execution.signal("approve");
    assertEquals("end", execution.getNode().getName());
   
    execution = processDefinition.startExecution();
    assertEquals("accept loan request", execution.getNode().getName());
    execution.signal();
    assertEquals("loan evaluation", execution.getNode().getName());
    execution.signal("reject");
    assertEquals("end", execution.getNode().getName());
View Full Code Here

* @author Tom Baeyens
*/
public class _04_EventTest extends TestCase {

  public void testEventAction() {
    ProcessDefinition processDefinition = ProcessFactory.build()
        .node("a").initial().behaviour(new WaitState())
          .event("node-leave")
            .listener(new Display("leaving a"))
            .listener(new Display("second message while leaving a"))
          .transition().to("b")
            .listener(new Display("taking transition"))
        .node("b").behaviour(new WaitState())
          .event("node-enter")
            .listener(new Display("entering b"))
    .done();

    Execution execution = processDefinition.startExecution();
    execution.signal();
  }
View Full Code Here

   
    Environment environment = environmentFactory.openEnvironment();
    try {
      PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
     
      ProcessDefinition processDefinition = ProcessFactory.build("persited process")
      .done();
     
      pvmDbSession.save(processDefinition);
     
    } finally {
View Full Code Here

  }

  public Object execute(Environment environment) throws Exception {
    PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);

    ProcessDefinition processDefinition = null;
   
    if (processDefinitionName!=null) {
      processDefinition = pvmDbSession.findProcessDefinition(processDefinitionName);
    } else {
      processDefinition = pvmDbSession.get(ProcessDefinitionImpl.class, processDefinitionDbid);
    }
   
    ExecutionImpl execution = (ExecutionImpl) processDefinition.startExecution(key, variables);
   
    pvmDbSession.save(execution);
    return execution;
  }
View Full Code Here

TOP

Related Classes of org.jbpm.pvm.ProcessDefinition

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.