}
}
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);
}