Package org.jbpm.scheduler.def

Examples of org.jbpm.scheduler.def.CreateTimerAction


      "    </event>" +
      "  </node>" +
      "</process-definition>"
    );
   
    CreateTimerAction createTimerAction =
        (CreateTimerAction) processDefinition
          .getNode("catch crooks")
          .getEvent("node-enter")
          .getActions()
          .get(0);
   
    assertEquals("reminder", createTimerAction.getTimerName());
    assertEquals("2 business hours", createTimerAction.getDueDate());
    assertEquals("10 business minutes", createTimerAction.getRepeat());
    assertEquals("time-out-transition", createTimerAction.getTransitionName());
    assertEquals("the-remainder-action-class-name", createTimerAction.getTimerAction().getActionDelegation().getClassName());
  }
View Full Code Here


    );
    TaskNode taskNode = (TaskNode) processDefinition.getNode("a");
    Task task = taskNode.getTask("clean ceiling");
    Event event = task.getEvent(Event.EVENTTYPE_TASK_CREATE);
    assertNotNull(event);
    CreateTimerAction createTimerAction = (CreateTimerAction) event.getActions().get(0);
    assertNotNull(createTimerAction);
    assertEquals("2 business minutes", createTimerAction.getDueDate());

    // test default cancel event
    event = task.getEvent(Event.EVENTTYPE_TASK_END);
    assertNotNull(event);
    CancelTimerAction cancelTimerAction = (CancelTimerAction) event.getActions().get(0);
View Full Code Here

  }

  protected void readNodeTimer(Element timerElement, Node node) {
    String name = timerElement.attributeValue("name", node.getName());
   
    CreateTimerAction createTimerAction = new CreateTimerAction();
    createTimerAction.read(timerElement, this);
    createTimerAction.setTimerName(name);
    createTimerAction.setTimerAction(readSingleAction(timerElement));
    addAction(node, Event.EVENTTYPE_NODE_ENTER, createTimerAction);
   
    CancelTimerAction cancelTimerAction = new CancelTimerAction();
    cancelTimerAction.setTimerName(name);
    addAction(node, Event.EVENTTYPE_NODE_LEAVE, cancelTimerAction);
View Full Code Here

  protected void readTaskTimer(Element timerElement, Task task) {
    String name = timerElement.attributeValue("name", task.getName());
    if (name==null) name = "timer-for-task-"+task.getId();
   
    CreateTimerAction createTimerAction = new CreateTimerAction();
    createTimerAction.read(timerElement, this);
    createTimerAction.setTimerName(name);
    createTimerAction.setTimerAction(readSingleAction(timerElement));
    addAction(task, Event.EVENTTYPE_TASK_CREATE, createTimerAction);

    // read the cancel-event types
    Collection cancelEventTypes = new ArrayList();
View Full Code Here

  }

  protected void readNodeTimer(Element timerElement, Node node) {
    String name = timerElement.attributeValue("name", node.getName());
   
    CreateTimerAction createTimerAction = new CreateTimerAction();
    createTimerAction.read(timerElement, this);
    createTimerAction.setTimerName(name);
    createTimerAction.setTimerAction(readSingleAction(timerElement));
    addAction(node, Event.EVENTTYPE_NODE_ENTER, createTimerAction);
   
    CancelTimerAction cancelTimerAction = new CancelTimerAction();
    cancelTimerAction.setTimerName(name);
    addAction(node, Event.EVENTTYPE_NODE_LEAVE, cancelTimerAction);
View Full Code Here

  protected void readTaskTimer(Element timerElement, Task task) {
    String name = timerElement.attributeValue("name", task.getName());
    if (name==null) name = "timer-for-task-"+task.getId();
   
    CreateTimerAction createTimerAction = new CreateTimerAction();
    createTimerAction.read(timerElement, this);
    createTimerAction.setTimerName(name);
    Action action = null;
    if ("timer".equals(timerElement.getName())) {
      action = readSingleAction(timerElement);
    } else {
      Delegation delegation = createMailDelegation("task-reminder", null, null, null, null);
      action = new Action(delegation);
    }
    createTimerAction.setTimerAction(action);
    addAction(task, Event.EVENTTYPE_TASK_CREATE, createTimerAction);

    // read the cancel-event types
    Collection cancelEventTypes = new ArrayList();
View Full Code Here

        }
    }

  public void executeAction(Action action, ExecutionContext executionContext) {
      if (action instanceof CreateTimerAction) {
          CreateTimerAction createTimerAction = (CreateTimerAction) action;
          String timerName = createTimerAction.getTimerName();
          TimerInstance timer = new TimerInstance();
          long delay = BUSINESS_CALENDAR.add(new Date(0),
                new Duration(createTimerAction.getDueDate())).getTime();
            timer.setDelay(delay);
            if (createTimerAction.getRepeat() != null) {
                long period = BUSINESS_CALENDAR.add(new Date(0),
                    new Duration(createTimerAction.getRepeat())).getTime();
                timer.setPeriod(period);
            }
          if (timerActions.isEmpty()) {
              addTimerListener();
          }
          getProcessInstance().getWorkingMemory().getTimerManager()
              .registerTimer(timer, getProcessInstance());
          timerActions.put(timer.getId(), createTimerAction.getTimerAction());
          List<TimerInstance> timerList = timers.get(timerName);
          if (timerList == null) {
              timerList = new ArrayList<TimerInstance>();
              timers.put(timerName, timerList);
          }
View Full Code Here

  }

  protected void readNodeTimer(Element timerElement, Node node) {
    String name = timerElement.attributeValue("name", node.getName());
   
    CreateTimerAction createTimerAction = new CreateTimerAction();
    createTimerAction.read(timerElement, this);
    createTimerAction.setTimerName(name);
    createTimerAction.setTimerAction(readSingleAction(timerElement));
    addAction(node, Event.EVENTTYPE_NODE_ENTER, createTimerAction);
   
    CancelTimerAction cancelTimerAction = new CancelTimerAction();
    cancelTimerAction.setTimerName(name);
    addAction(node, Event.EVENTTYPE_NODE_LEAVE, cancelTimerAction);
View Full Code Here

  protected void readTaskTimer(Element timerElement, Task task) {
    String name = timerElement.attributeValue("name", task.getName());
    if (name==null) name = "timer-for-task-"+task.getId();
   
    CreateTimerAction createTimerAction = new CreateTimerAction();
    createTimerAction.read(timerElement, this);
    createTimerAction.setTimerName(name);
    Action action = null;
    if ("timer".equals(timerElement.getName())) {
      action = readSingleAction(timerElement);
    } else {
      Delegation delegation = createMailDelegation("task-reminder", null, null, null, null);
      action = new Action(delegation);
    }
    createTimerAction.setTimerAction(action);
    addAction(task, Event.EVENTTYPE_TASK_CREATE, createTimerAction);

    // read the cancel-event types
    Collection cancelEventTypes = new ArrayList();
View Full Code Here

TOP

Related Classes of org.jbpm.scheduler.def.CreateTimerAction

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.