Class CalendarDAO

java.lang.Object
com.almis.awe.config.ServiceConfig
com.almis.awe.scheduler.dao.CalendarDAO
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

public class CalendarDAO extends ServiceConfig
DAO to manage schedule calendars
  • Constructor Details

    • CalendarDAO

      public CalendarDAO(org.quartz.Scheduler scheduler, QueryService queryService, QueryUtil queryUtil, com.fasterxml.jackson.databind.ObjectMapper mapper)
      Autowired constructor
      Parameters:
      scheduler - Scheduler
      queryService - Query service
      queryUtil - Query utilities
      mapper - Object mapper
  • Method Details

    • loadSchedulerCalendar

      public void loadSchedulerCalendar() throws AWException
      Load calendars from the database to the scheduler
      Throws:
      AWException - Error loading scheduler calendar
    • getCalendar

      public Calendar getCalendar(String alias, Integer calendarId) throws AWException
      Get calendar for the given ID on the given database
      Parameters:
      alias - Calendar alias
      calendarId - Calendar identifier
      Returns:
      Calendar
      Throws:
      AWException - Error retrieving calendar
    • insertSchedulerCalendar

      public ServiceData insertSchedulerCalendar(Integer calendarIde, boolean replace, boolean updateTriggers) throws AWException
      Insert and schedule a new calendar
      Parameters:
      calendarIde - Calendar identifier
      replace - Replace calendar
      updateTriggers - Update task triggers
      Returns:
      ServiceData
      Throws:
      AWException - Error inserting scheduler calendar
    • insertSchedulerCalendar

      public ServiceData insertSchedulerCalendar(String alias, Integer calendarId, boolean replace, boolean updateTriggers) throws AWException
      Insert and schedule a new calendar
      Parameters:
      calendarId - Calendar identifier
      replace - Replace calendar
      updateTriggers - Update task triggers
      alias - Calendar alias
      Returns:
      ServiceData
      Throws:
      AWException - Error inserting scheduler calendar
    • updateSchedulerCalendar

      public ServiceData updateSchedulerCalendar(Integer calendarIde) throws AWException
      Update and schedule a new calendar
      Parameters:
      calendarIde - Calendar identifier
      Returns:
      ServiceData
      Throws:
      AWException - Error updating scheduler calendar
    • deleteSchedulerCalendar

      public ServiceData deleteSchedulerCalendar(List<Integer> calendarIdList) throws AWException
      Delete selected calendars
      Parameters:
      calendarIdList - Calendar identifier list
      Returns:
      ServiceData
      Throws:
      AWException - Error deleting calendars
    • rescheduleTaskWithCalendar

      public void rescheduleTaskWithCalendar(Task task, String calendarId) throws AWException
      Reschedule task with the new calendar id
      Parameters:
      task - Task to reschedule
      calendarId - Calendar identifier
      Throws:
      AWException - Error rescheduling task with calendar
    • checkTriggersContainsCalendar

      public ServiceData checkTriggersContainsCalendar(Integer... calendarIdList) throws AWException
      Check if the scheduler contains the selected calendar
      Parameters:
      calendarIdList - Calendar identifier list
      Returns:
      ServiceData
      Throws:
      AWException - Error checking triggers with calendars
    • yearSelectService

      public ServiceData yearSelectService()
      Retrieves next 100 years
      Returns:
      ServiceData
    • computeNextFireTimes

      public ServiceData computeNextFireTimes(int times, Schedule schedule) throws AWException
      Compute next fire times
      Parameters:
      times - # of fire times to compute
      schedule - Schedule
      Returns:
      Service data
      Throws:
      AWException - Error computing next fire times
    • activateCalendars

      public ServiceData activateCalendars(List<Integer> calendarIdList) throws AWException
      Retrieve all tasks with the calendar set and set the calendar to their triggers
      Parameters:
      calendarIdList - Calendar identifier list
      Returns:
      Service data
      Throws:
      AWException
    • deactivateCalendars

      public ServiceData deactivateCalendars(List<Integer> calendarIdList) throws AWException
      Retrieve all tasks with the calendar set and remove the calendar from their triggers
      Parameters:
      calendarIdList - Calendar identifier list
      Returns:
      Service data
      Throws:
      AWException