/** Removes the task. */ public void remove() { startTask.cancel(); endTask.cancel(); calendarService.removeFromTaskMap(id); calendarService.removeFromCurrentItems(this); calendarService.updateStateFromCurrentItems(); }
/** This method is executed in the end of the calendar item. */ protected void stop() { calendarService.removeFromTaskMap(id); calendarService.removeFromCurrentItems(this); calendarService.updateStateFromCurrentItems(); if (pattern != null) { CalendarItemTimerTask nextTask = pattern.next(startDate, endDate); this.pattern = null; nextTask.scheduleTasks(); } }
/** * Constructs new <tt>CalendarItemTimerTask</tt> instance. * * @param state the state of the calendar item. * @param startDate the start date of the calendar item. * @param endDate the end date of the calendar item. * @param id the ID of the calendar item. * @param executeNow Indicates if the start task should be executed immediately or not * @param pattern the <tt>RecurringPattern</tt> instance associated with the calendar item. It * must be <tt>null</tt> if the calendar item is not recurring. */ public CalendarItemTimerTask( CalendarService.BusyStatusEnum state, Date startDate, Date endDate, String id, boolean executeNow, RecurringPattern pattern) { this.state = state; this.startDate = startDate; this.endDate = endDate; this.id = id; calendarService.addToTaskMap(id, this); this.executeNow = executeNow; this.pattern = pattern; }
/** This method is executed in the beginning of the calendar item. */ protected void start() { calendarService.addToCurrentItems(this); calendarService.updateStateFromCurrentItems(); }