Package org.jbpm.graph.def

Examples of org.jbpm.graph.def.ProcessDefinition


    super.setUp();
    counter = 0;
  }

  public void testTimerCreation() {
    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
      "<process-definition>" +
      "  <start-state>" +
      "    <transition to='a' />" +
      "  </start-state>" +
      "  <task-node name='a'>" +
View Full Code Here


    Timer timer = (Timer) timersIter.next();
    assertEquals("ceiling-timer", timer.getName());
  }

  public void testTimerDeletion() {
    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
      "<process-definition>" +
      "  <start-state>" +
      "    <transition to='a' />" +
      "  </start-state>" +
      "  <task-node name='a'>" +
View Full Code Here

    Iterator timersIter = schedulerSession.findTimersByDueDate();
    assertFalse(timersIter.hasNext());
  }

  public void testTimerExecution() {
    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
      "<process-definition>" +
      "  <start-state>" +
      "    <transition to='a' />" +
      "  </start-state>" +
      "  <task-node name='a'>" +
View Full Code Here

    new SchedulerThread().executeTimers();
    assertEquals(1, counter);
  }

  public void testTimerExecutionRepeat() {
    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
      "<process-definition>" +
      "  <start-state>" +
      "    <transition to='a' />" +
      "  </start-state>" +
      "  <task-node name='a'>" +
View Full Code Here

 
  private String doDeployment(FileItem fileItem) {
    try {
       ZipInputStream zipInputStream = new ZipInputStream(fileItem.getInputStream());
       JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
       ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(zipInputStream)
       log.debug("Created a processdefinition : " + processDefinition.getName() );
       jbpmContext.deployProcessDefinition(processDefinition);
       zipInputStream.close();
       return "Deployed archive " + processDefinition.getName() + " successfully";
    } catch (IOException e) {
      return "IOException";
    }
  }
View Full Code Here

    // 3 nodes: an unnamed start-state, a state 's' and an
    // end-state named 'end'.
    // The next line parses a piece of xml text into a
    // ProcessDefinition.  A ProcessDefinition is the formal
    // description of a process represented as a java object.
    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
      "<process-definition>" +
      "  <start-state>" +
      "    <transition to='s' />" +
      "  </start-state>" +
      "  <state name='s'>" +
      "    <transition to='end' />" +
      "  </state>" +
      "  <end-state name='end' />" +
      "</process-definition>"
    );
   
    // The next line creates one execution of the process definition.
    // After construction, the process execution has one main path
    // of execution (=the root token) that is positioned in the
    // start-state.
    ProcessInstance processInstance =
        new ProcessInstance(processDefinition);
   
    // After construction, the process execution has one main path
    // of execution (=the root token).
    Token token = processInstance.getRootToken();
   
    // Also after construction, the main path of execution is positioned
    // in the start-state of the process definition.
    assertSame(processDefinition.getStartState(), token.getNode());
   
    // 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.

    // The process execution will have entered the first wait state
    // in state 's'. So the main path of execution is not
    // positioned in state 's'
    assertSame(processDefinition.getNode("s"), token.getNode());

    // Let's send another signal.  This will resume execution by
    // leaving the state 's' over its default transition.
    token.signal();
    // Now the signal method returned because the process instance
    // has arrived in the end-state.
   
    assertSame(processDefinition.getNode("end"), token.getNode());
  }
View Full Code Here

 
  public void testThreeStateProcess() {
    // This test shows a process similar to the simplest process
    // above, but now there are 3 states instead of one, which will
    // result in 2 extra signals to be given by the test.
    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
      "<process-definition>" +
      "  <start-state>" +
      "    <transition to='phase one' />" +
      "  </start-state>" +
      "  <state name='phase one'>" +
      "    <transition to='phase two' />" +
      "  </state>" +
      "  <state name='phase two'>" +
      "    <transition to='phase three' />" +
      "  </state>" +
      "  <state name='phase three'>" +
      "    <transition to='end' />" +
      "  </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());

    token.signal();
    assertSame(processDefinition.getNode("phase two"), token.getNode());

    token.signal();
    assertSame(processDefinition.getNode("phase three"), token.getNode());

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

    PrintWriter writer = response.getWriter();
    try {
      URL archiveUrl = new URL(archive);
      ZipInputStream zis = new ZipInputStream(archiveUrl.openStream());
      JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
      ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(zis);
      jbpmContext.deployProcessDefinition(processDefinition);
      zis.close();
     
      writer.write("Deployed archive "+archive+" successfully");
     
View Full Code Here

public class ContextTest extends TestCase {
 
  public void testContext() {
    // Also this example starts from the hello world process.
    // This time even without modification.
    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
      "<process-definition>" +
      "  <start-state>" +
      "    <transition to='s' />" +
      "  </start-state>" +
      "  <state name='s'>" +
View Full Code Here

  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    long processDefinitionId = Long.parseLong( request.getParameter( "definitionId" ) );
    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    ProcessDefinition processDefinition = jbpmContext.getGraphSession().loadProcessDefinition(processDefinitionId);
    byte[] bytes = processDefinition.getFileDefinition().getBytes("processimage.jpg");
    OutputStream out = response.getOutputStream();
    out.write(bytes);
    out.flush();
   
    // leave this in.  it is in case we want to set the mime type later.
View Full Code Here

TOP

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