Package org.jbpm

Examples of org.jbpm.JbpmContext


    );

    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();

    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    jbpmContext.setActorId("cookie monster");
    try {
      taskMgmtInstance.createStartTaskInstance().end();
    } finally {
      jbpmContext.setActorId(null);
      jbpmContext.close();
    }

    SwimlaneInstance swimlaneInstance = taskMgmtInstance.getSwimlaneInstance("initiator");
    assertNotNull(swimlaneInstance);
    assertEquals("cookie monster", swimlaneInstance.getActorId());
View Full Code Here


  static {
    jbpmConfiguration.createSchema();
  }
 
  public static void deploy(ProcessDefinition processDefinition) {
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      jbpmContext.deployProcessDefinition(processDefinition);
    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

      "    </timer>" +
      "  </state>" +
      "</process-definition>"
    );

    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      TestSchedulerService testSchedulerService = (TestSchedulerService) jbpmContext.getServices().getSchedulerService();
     
      ProcessInstance processInstance = new ProcessInstance(processDefinition);
      processInstance.signal();
     
      assertEquals(1, testSchedulerService.createdTimers.size());
      Timer scheduledTimer = (Timer) testSchedulerService.createdTimers.get(0);
      assertEquals("reminder", scheduledTimer.name);
      assertEquals(processDefinition.getNode("catch crooks"), scheduledTimer.graphElement);
      System.out.println("due date: "+scheduledTimer.dueDate);
      assertNotNull(scheduledTimer.dueDate);
      assertEquals("10 business minutes", scheduledTimer.repeat);
      assertEquals("the-remainder-action-class-name", scheduledTimer.action.getActionDelegation().getClassName());
      assertSame(processInstance.getRootToken(), scheduledTimer.token);
      assertEquals("time-out-transition", scheduledTimer.transitionName);
    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

      "  </state>" +
      "  <end-state name='end'/>" +
      "</process-definition>"
    );
   
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      TestSchedulerService testSchedulerService = (TestSchedulerService) jbpmContext.getServices().getSchedulerService();
     
      ProcessInstance processInstance = new ProcessInstance(processDefinition);
      processInstance.signal();
     
      assertEquals(1, testSchedulerService.createdTimers.size());
      Timer scheduledTimer = (Timer) testSchedulerService.createdTimers.get(0);
      assertEquals("reminder", scheduledTimer.name);
      assertEquals(processDefinition.getNode("catch crooks"), scheduledTimer.graphElement);
      System.out.println("due date: "+scheduledTimer.dueDate);
      assertNotNull(scheduledTimer.dueDate);
      assertEquals("10 business minutes", scheduledTimer.repeat);
      assertEquals("the-remainder-action-class-name", scheduledTimer.action.getActionDelegation().getClassName());
      assertSame(processInstance.getRootToken(), scheduledTimer.token);
      assertEquals("time-out-transition", scheduledTimer.transitionName);
 
      // while we are at it, i might as well check if the cancel timer is not executed ;)
      processInstance.signal();
      assertEquals(0, testSchedulerService.cancelledTimersByName.size());
     
    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

      "  </state>" +
      "  <end-state name='end'/>" +
      "</process-definition>"
    );
   
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      TestSchedulerService testSchedulerService = (TestSchedulerService) jbpmContext.getServices().getSchedulerService();
     
      ProcessInstance processInstance = new ProcessInstance(processDefinition);
      processInstance.signal();
      processInstance.signal();
     
      List cancelledTimerNames = testSchedulerService.cancelledTimersByName;
      assertEquals(1, cancelledTimerNames.size());
      Object[] cancelledTimer = (Object[]) cancelledTimerNames.get(0);
      assertEquals("reminder", cancelledTimer[0]);
      assertSame(processInstance.getRootToken(), cancelledTimer[1]);
     
    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

      "  </state>" +
      "  <end-state name='end'/>" +
      "</process-definition>"
    );
   
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      ProcessInstance processInstance = new ProcessInstance(processDefinition);
      assertNull(TimerCreateAction.timer);
      processInstance.signal();
      assertNotNull(TimerCreateAction.timer);
      assertEquals("the-timer-create-event-class-name", TimerCreateAction.timer.action.getActionDelegation().getClassName());

    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

      "    </timer>" +
      "  </state>" +
      "</process-definition>"
    );
   
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    TestSchedulerService testSchedulerService = (TestSchedulerService) jbpmContext.getServices().getSchedulerService();
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    try {
      processInstance.signal();
      processInstance.suspend();
      jbpmContext.save(processInstance);
    } finally {
      jbpmContext.close();
    }

    assertEquals(1, testSchedulerService.suspendedTimerTokens.size());
    Token suspendedToken = (Token) testSchedulerService.suspendedTimerTokens.get(0);
    assertSame(processInstance.getRootToken(), suspendedToken);

    jbpmContext = jbpmConfiguration.createJbpmContext();
    testSchedulerService = (TestSchedulerService) jbpmContext.getServices().getSchedulerService();
    try {
      processInstance.resume();
      jbpmContext.save(processInstance);
    } finally {
      jbpmContext.close();
    }

    Token resumedToken = (Token) testSchedulerService.resumedTimerTokens.get(0);
    assertSame(processInstance.getRootToken(), resumedToken);
  }
View Full Code Here

      "    </task>" +
      "  </task-node>" +
      "</process-definition>"
    );
   
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      TestSchedulerService testSchedulerService = (TestSchedulerService) jbpmContext.getServices().getSchedulerService();
      ProcessInstance processInstance = new ProcessInstance(processDefinition);
      processInstance.signal();
     
      List scheduledTimers = testSchedulerService.createdTimers;
      assertEquals(1, scheduledTimers.size());

    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

      "    </task>" +
      "  </task-node>" +
      "</process-definition>"
    );
   
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      ProcessInstance processInstance = new ProcessInstance(processDefinition);
      processInstance.signal();
      assertTrue(isCustomized);

    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

    if (session!=null) {
      userBean = (UserBean) session.getAttribute("userBean");
    }
    if (userBean!=null) {
      String actorId = userBean.getUserName();
      JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
      jbpmContext.setActorId(actorId);
    }
    filterChain.doFilter(servletRequest, servletResponse);
  }
View Full Code Here

TOP

Related Classes of org.jbpm.JbpmContext

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.