[jboss-user] [JBoss jBPM] - Re: [jBPM][3.1.1] Get a timer instance with API

cpob do-not-reply at jboss.com
Mon Jul 24 10:19:15 EDT 2006

Create an action handler and register it with the task-create.

Have that handler create a new timer per whatever rules/data you need (which could be from your database, or an context variable).

Code to create a timer: (This is from the CreateTimerAction code - around line 72)
    Timer timer = new Timer(executionContext.getToken());
  |     timer.setName(timerName);
  |     timer.setRepeat(repeat);
  |     Duration duration = new Duration(dueDate);
  |     Date dueDate = businessCalendar.add( new Date(), duration );
  |     timer.setDueDate(dueDate);
  |     timer.setAction(timerAction);
  |     timer.setTransitionName(transitionName);
  |     timer.setGraphElement(executionContext.getEventSource());
  |     timer.setTaskInstance(executionContext.getTaskInstance());

Now, don't forget to create the cancel-timer action to end that timer if you finish the next task within the time limit, or else that timer will keep on ticking even if you finish the task.  You can find that code in JpdlXmlReader.java, in the readNodeTimer method (around line 479)

All this assumes there isn't a timer already configured on it.  This is programmatically creating a NEW timer. 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960400#3960400

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960400

More information about the jboss-user mailing list