SchedulerService schedulerService = (SchedulerService) Services.getCurrentService(Services.SERVICENAME_SCHEDULER);
schedulerService.createTimer(timer);
}
protected Timer createTimer(ExecutionContext executionContext) {
Timer timer = new Timer(executionContext.getToken());
timer.setName(timerName);
timer.setRepeat(repeat);
if (dueDate!=null) {
Duration duration = new Duration(dueDate);
Date dueDateDate = businessCalendar.add( Clock.getCurrentTime(), duration );
timer.setDueDate(dueDateDate);
}
timer.setAction(timerAction);
timer.setTransitionName(transitionName);
timer.setGraphElement(executionContext.getEventSource());
timer.setTaskInstance(executionContext.getTaskInstance());
// if this action was executed for a graph element
if ( (getEvent()!=null)
&& (getEvent().getGraphElement()!=null)
) {