eventType = new ScheduledEventType(vo.getId());
if (!vo.isReturnToNormal())
eventType.setDuplicateHandling(EventType.DuplicateHandling.ALLOW);
// Schedule the active event.
TimerTrigger activeTrigger = createTrigger(true);
activeTask = new ModelTimeoutTask<Boolean>(activeTrigger, this, true);
if (vo.isReturnToNormal()) {
TimerTrigger inactiveTrigger = createTrigger(false);
inactiveTask = new ModelTimeoutTask<Boolean>(inactiveTrigger, this, false);
if (vo.getScheduleType() != ScheduledEventVO.TYPE_ONCE) {
// Check if we are currently active.
if (inactiveTrigger.getNextExecutionTime() < activeTrigger.getNextExecutionTime())
raiseEvent(System.currentTimeMillis());
}
}
}