com.ibm.itim.scheduling

Class RecurringTimeSchedule

  • java.lang.Object
    • com.ibm.itim.scheduling.RecurringTimeSchedule
  • All Implemented Interfaces:
    Schedulable, com.ibm.itim.util.xml.objectstream.Importable, java.io.Serializable


    public class RecurringTimeSchedule
    extends java.lang.Object
    implements Schedulable, com.ibm.itim.util.xml.objectstream.Importable
    RecurringTimeSchedule is a class used to represent a recurring time that can be used for scheduling when implementing the Schedulable interface. This class has the flexibility to define the time based on hours, minutes, month, day of the week, day of the month, quarterly, and semi-annually. The following values are the example values for the different typs of schedules(all the remaining values of the schedule should be set to 0)
    • Hourly : hour = -1.
    • Daily at 6.30 AM : minute = 30, hour = 6, dayOfMonth = -1.
    • Every Monday (Weekly) at 6.30 AM : minute = 30, hour = 6, daysOfWeek = 2.
    • 10th day of every month(Monthly) at 6.30 AM : minute = 30, hour = 6, month = -1, dayOfMonth = 10.
    • Annually April 1 at 6.30 AM : minute = 30, hour = 6, month = 4, dayOfMonth = 1.
    • Daily during March(specific month) at 6.30 AM : minute = 30, hour = 6, month = 3, dayOfWeek = -1.
    • 10th day of each quarter(Quarterly) at 6.30 AM : minute = 30, hour = 6, dayOfQuarter = 10.
    • 10th day of half year(Semi-Annually) at 6.30 AM : minute = 30, hour = 6, dayOfSemiAnnually = 10.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      RecurringTimeSchedule(int minute, int hour, int dayOfMonth, int month, int dayOfWeek)
      Constructs the RecurringTimeSchedule with the given schedule parameters.
      RecurringTimeSchedule(int minute, int hour, int dayOfMonth, int month, int dayOfWeek, int dayOfQuarter, int dayOfSemiAnnual)
      Constructs the RecurringTimeSchedule with the given schedule parameters.
      RecurringTimeSchedule(int minute, int hour, int dayOfMonth, int month, java.lang.String daysOfWeek)
      Constructs the RecurringTimeSchedule with the given schedule parameters.
      RecurringTimeSchedule(int minute, int hour, int dayOfMonth, int month, java.lang.String daysOfWeek, int dayOfQuarter, int dayOfSemiAnnual)
      Constructs the RecurringTimeSchedule with the given schedule parameters.
      RecurringTimeSchedule(int minute, int hour, int dayOfMonth, int month, java.lang.String daysOfWeek, int dayOfWeek, int dayOfQuarter, int dayOfSemiAnnual)
      Constructs the RecurringTimeSchedule with the given schedule parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int getDayOfMonth()
      Returns the day of the month of the RecurringTimeSchedule as configured.
      int getDayOfMonth(int month)
      Returns the day of the month of the RecurringTimeSchedule during runtime that interpret settings greater than 28 correctly by month
      int getDayOfQuarter()
      Returns the day of the quarter of the RecurringTimeSchedule.
      int getDayOfSemiAnnual()
      Returns the day of the semi-annual of the RecurringTimeSchedule.
      int getDayOfWeek()
      Returns the day of the week of the RecurringTimeSchedule.
      java.lang.String getDaysOfWeek()
      Returns the days of the week of the RecurringTimeSchedule.
      int getHour()
      Returns the hour of the RecurringTimeSchedule.
      int getMinute()
      Returns the minute of the RecurringTimeSchedule.
      int getMonth()
      Returns the month of the RecurringTimeSchedule.
      java.util.TimeZone getTimeZone()
      Returns the timezone that the schedule is configured with.
      boolean isDaily()
      Method to check if the schedule is daily.
      boolean isHourly()
      Method to check if the schedule is hourly.
      boolean isMinutely()
      Method to check if the schedule is minutely.
      boolean isMonthly()
      Method to check if the schedule is monthly.
      boolean isQuarterly()
      Method to check if the schedule is quarterly.
      boolean isSemiAnnually()
      Method to check if the schedule is semi-annually.
      boolean isWeekly()
      Method to check if the schedule is weekly.
      boolean isWeeklyWithSpecificDays()
      Method to check if the schedule is weekly with specific days selected.
      long schedule(long time)
      Returns the next scheduled date in milliseconds since the epoch.
      void setDayOfMonth(int dayOfMonth)
      Changes the day of the month of the RecurringTimeSchedule.
      void setDayOfQuarter(int dayOfQuarter)
      Changes the day of the quarter of the RecurringTimeSchedule.
      void setDayOfSemiAnnual(int dayOfSemiAnnual)
      Changes the day of the semi-annual of the RecurringTimeSchedule.
      void setDayOfWeek(int dayOfWeek)
      Changes the day of the week of the RecurringTimeSchedule.
      void setDaysOfWeek(java.lang.String daysOfWeek)
      Changes the days of the week of the RecurringTimeSchedule.
      void setHour(int hour)
      Changes the hour of the RecurringTimeSchedule.
      void setMinute(int minute)
      Changes the minute of the RecurringTimeSchedule.
      void setMonth(int month)
      Changes the month of the RecurringTimeSchedule.
      void setTimeZone(java.util.TimeZone timeZone)
      Method to set the schedule time zone.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RecurringTimeSchedule

        public RecurringTimeSchedule(int minute,
                                     int hour,
                                     int dayOfMonth,
                                     int month,
                                     int dayOfWeek)
        Constructs the RecurringTimeSchedule with the given schedule parameters.
        Parameters:
        minute - minute of the schedule. Allowed values are 0-59.
        hour - hour of the schedule. Allowed values are 0-23.
        dayOfMonth - day of month of the schedule (-1 if every day). This attribute is exclusive with dayOfWeek. To set the dayOfMonth value other than -1(daily), the month value must be set either to specific month or -1(monthly). Allowed values are 1-28, if the schedule is set to monthly otherwise the allowed value varies according to the month value.
        month - month of the alarm (-1 if every month). Allowed values are 1-12 (1 = January, 2 = February, ...).
        dayOfWeek - day of week of the alarm (-1 if every day). This attribute is exclusive with dayOfMonth. Allowed values are 1-7 (1 = Sunday, 2 = Monday, ...). java.util.Calendar constants can be used.
      • RecurringTimeSchedule

        public RecurringTimeSchedule(int minute,
                                     int hour,
                                     int dayOfMonth,
                                     int month,
                                     java.lang.String daysOfWeek)
        Constructs the RecurringTimeSchedule with the given schedule parameters.
        Parameters:
        minute - minute of the schedule. Allowed values are 0-59.
        hour - hour of the schedule. Allowed values are 0-23.
        dayOfMonth - day of month of the schedule (-1 if every day). This attribute is exclusive with dayOfWeek. To set the dayOfMonth value other than -1(daily), the month value must be set either to specific month or -1(monthly). Allowed values are 1-28, if the schedule is set to monthly otherwise the allowed value varies according to the month value.
        month - month of the alarm (-1 if every month). Allowed values are 1-12 (1 = January, 2 = February, ...).
        daysOfWeek - days of week of the alarm. This attribute is exclusive with dayOfMonth. Allowed values are 1-7 (1 = Sunday, 2 = Monday, ...). java.util.Calendar constants can be used and multiple values are specified in pipe-separated format (1|2 = Sunday and Monday).
      • RecurringTimeSchedule

        public RecurringTimeSchedule(int minute,
                                     int hour,
                                     int dayOfMonth,
                                     int month,
                                     int dayOfWeek,
                                     int dayOfQuarter,
                                     int dayOfSemiAnnual)
        Constructs the RecurringTimeSchedule with the given schedule parameters. This also takes the parameter for day of quarter and day of semi-annual. If the dayOfSemiAnnual value is set to the schedule, then it ignores the dayOfQuarter value.
        Parameters:
        minute - minute of the schedule. Allowed values are 0-59.
        hour - hour of the schedule. Allowed values are 0-23.
        dayOfMonth - day of month of the schedule (-1 if every day). This attribute is exclusive with dayOfWeek. To set the dayOfMonth value other than -1(daily), the month value should be set either to a specific month or -1(monthly). Allowed values are 1-28, if schedule is set to monthly, otherwise the allowed value varies according to the month value.
        month - month of the alarm (-1 if every month). Allowed values are 1-12 (1 = January, 2 = February, ...).
        dayOfWeek - day of week of the alarm (-1 if every day). This attribute is exclusive with dayOfMonth. Allowed values are 1-7 (1 = Sunday, 2 = Monday, ...). java.util.Calendar constants can be used.
        dayOfQuarter - (0 for disabled by quarterly, otherwise 1-90) dayOfQuarter is exclusive with dayOfMonth, dayOfWeek and dayOfSemiAnnual, therefore value of dayOfMonth, dayOfWeek and dayOfSemiAnnual is set to ignore.
        dayOfSemiAnnual - (0 for disabled by semi-annually, otherwise 1-180) dayOfSemiAnnual is exclusive with dayOfMonth, dayOfWeek and dayOfQuarter therefore value of dayOfMonth, dayOfWeek and dayOfQuarter is set to ignore.
      • RecurringTimeSchedule

        public RecurringTimeSchedule(int minute,
                                     int hour,
                                     int dayOfMonth,
                                     int month,
                                     java.lang.String daysOfWeek,
                                     int dayOfQuarter,
                                     int dayOfSemiAnnual)
        Constructs the RecurringTimeSchedule with the given schedule parameters. This also takes the parameter for day of quarter and day of semi-annual. If the dayOfSemiAnnual value is set to the schedule, then it ignores the dayOfQuarter value.
        Parameters:
        minute - minute of the schedule. Allowed values are 0-59.
        hour - hour of the schedule. Allowed values are 0-23.
        dayOfMonth - day of month of the schedule (-1 if every day). This attribute is exclusive with dayOfWeek. To set the dayOfMonth value other than -1(daily), the month value should be set either to a specific month or -1(monthly). Allowed values are 1-28, if schedule is set to monthly, otherwise the allowed value varies according to the month value.
        month - month of the alarm (-1 if every month). Allowed values are 1-12 (1 = January, 2 = February, ...).
        daysOfWeek - days of week of the alarm. This attribute is exclusive with dayOfMonth. Allowed values are 1-7 (1 = Sunday, 2 = Monday, ...). java.util.Calendar constants can be used and multiple values are specified in pipe-separated format (1|2 = Sunday and Monday).
        dayOfQuarter - (0 for disabled by quarterly, otherwise 1-90) dayOfQuarter is exclusive with dayOfMonth, dayOfWeek and dayOfSemiAnnual, therefore value of dayOfMonth, dayOfWeek and dayOfSemiAnnual is set to ignore.
        dayOfSemiAnnual - (0 for disabled by semi-annually, otherwise 1-180) dayOfSemiAnnual is exclusive with dayOfMonth, dayOfWeek and dayOfQuarter therefore value of dayOfMonth, dayOfWeek and dayOfQuarter is set to ignore.
      • RecurringTimeSchedule

        public RecurringTimeSchedule(int minute,
                                     int hour,
                                     int dayOfMonth,
                                     int month,
                                     java.lang.String daysOfWeek,
                                     int dayOfWeek,
                                     int dayOfQuarter,
                                     int dayOfSemiAnnual)
        Constructs the RecurringTimeSchedule with the given schedule parameters. This also takes the parameter for day of quarter and day of semi-annual. If the dayOfSemiAnnual value is set to the schedule, then it ignores the dayOfQuarter value.
        Parameters:
        minute - minute of the schedule. Allowed values are 0-59.
        hour - hour of the schedule. Allowed values are 0-23.
        dayOfMonth - day of month of the schedule (-1 if every day). This attribute is exclusive with dayOfWeek. To set the dayOfMonth value other than -1(daily), the month value should be set either to a specific month or -1(monthly). Allowed values are 1-28, if schedule is set to monthly, otherwise the allowed value varies according to the month value.
        month - month of the alarm (-1 if every month). Allowed values are 1-12 (1 = January, 2 = February, ...).
        daysOfWeek - days of week of the alarm. This attribute is exclusive with dayOfMonth. Allowed values are 1-7 (1 = Sunday, 2 = Monday, ...). java.util.Calendar constants can be used and multiple values are specified in pipe-separated format (1|2 = Sunday and Monday).
        dayOfWeek - days of week of the alarm. This is deprecated and can not be used along with daysOfWeek. Value is ignored if daysOfWeek contains not null value. This attribute is exclusive with dayOfMonth. Allowed values are 1-7 (1 = Sunday, 2 = Monday, ...). java.util.Calendar constants can be used and multiple values are specified in pipe-separated format (1|2 = Sunday and Monday).
        dayOfQuarter - (0 for disabled by quarterly, otherwise 1-90) dayOfQuarter is exclusive with dayOfMonth, dayOfWeek and dayOfSemiAnnual, therefore value of dayOfMonth, dayOfWeek and dayOfSemiAnnual is set to ignore.
        dayOfSemiAnnual - (0 for disabled by semi-annually, otherwise 1-180) dayOfSemiAnnual is exclusive with dayOfMonth, dayOfWeek and dayOfQuarter therefore value of dayOfMonth, dayOfWeek and dayOfQuarter is set to ignore.
    • Method Detail

      • getMinute

        public int getMinute()
        Returns the minute of the RecurringTimeSchedule.
        Returns:
        the configured minute.
      • setMinute

        public void setMinute(int minute)
        Changes the minute of the RecurringTimeSchedule.
        Parameters:
        minute - new minute to configure. Allowed values are 0-59.
        Throws:
        java.lang.IllegalArgumentException - Thrown if argument is not within the range.
      • getHour

        public int getHour()
        Returns the hour of the RecurringTimeSchedule.
        Returns:
        the configured hour.
      • setHour

        public void setHour(int hour)
        Changes the hour of the RecurringTimeSchedule.
        Parameters:
        hour - new hour to configure. Allowed values are 0-23. (-1 if every hour.)
        Throws:
        java.lang.IllegalArgumentException - Thrown if argument is not within the range.
      • getMonth

        public int getMonth()
        Returns the month of the RecurringTimeSchedule.
        Returns:
        the configured month or -1 if it is every month.
      • setMonth

        public void setMonth(int month)
        Changes the month of the RecurringTimeSchedule.
        Parameters:
        month - new month to configure (-1 if every month). (0 if ignore) Allowed values are 0-12 (1 = January, 2 = February, ...).
        Throws:
        java.lang.IllegalArgumentException - Thrown if argument is not within the range.
      • getDayOfWeek

        public int getDayOfWeek()
        Returns the day of the week of the RecurringTimeSchedule.
        Returns:
        the configured day of the week or -1 if it is every day.
      • getDaysOfWeek

        public java.lang.String getDaysOfWeek()
        Returns the days of the week of the RecurringTimeSchedule.
        Returns:
        the configured days of the week or null in case no days of the week specified.
      • setDayOfWeek

        public void setDayOfWeek(int dayOfWeek)
        Changes the day of the week of the RecurringTimeSchedule.
        Parameters:
        dayOfWeek - new day of the week to configure (-1 if every day) (0 if ignore). This attribute is exclusive with dayOfMonth. Allowed values are 1-7 (1 = Sunday, 2 = Monday, ...). java.util.Calendar constants can be used.
        Throws:
        java.lang.IllegalArgumentException - Thrown if argument is not within the range.
      • setDaysOfWeek

        public void setDaysOfWeek(java.lang.String daysOfWeek)
        Changes the days of the week of the RecurringTimeSchedule.
        Parameters:
        daysOfWeek - new days of the week to configure This attribute is exclusive with dayOfMonth. Allowed values 1-7 (1 = Sunday, 2 = Monday, ...) and multiple values are specified in pipe-separated format (1|2 = Sunday and Monday)
        Throws:
        java.lang.IllegalArgumentException - Thrown if argument is not within the range.
      • setDayOfQuarter

        public void setDayOfQuarter(int dayOfQuarter)
        Changes the day of the quarter of the RecurringTimeSchedule. dayOfQuarter is exclusive with dayOfMonth, dayOfWeek and dayOfSemiAnnual therefore value of dayOfMonth, dayOfWeek and dayOfSemiAnnual is set to ignore.
        Parameters:
        dayOfQuarter - day of the quarter(0 for disabled by quarterly, otherwise 1-90).
        Throws:
        java.lang.IllegalArgumentException - Thrown if argument is not within the range.
      • getDayOfQuarter

        public int getDayOfQuarter()
        Returns the day of the quarter of the RecurringTimeSchedule.
        Returns:
        the configured day of the quarter.
      • setDayOfSemiAnnual

        public void setDayOfSemiAnnual(int dayOfSemiAnnual)
        Changes the day of the semi-annual of the RecurringTimeSchedule. dayOfSemiAnnual is exclusive with dayOfMonth, dayOfWeek and dayOfQuarter therefore value of dayOfMonth, dayOfWeek and dayOfQuarter is set to ignore.
        Parameters:
        dayOfSemiAnnual - day of the semi-annual(0 for disabled by semi-annually, otherwise 1-180).
        Throws:
        java.lang.IllegalArgumentException - Thrown if argument is not within the range.
      • getDayOfSemiAnnual

        public int getDayOfSemiAnnual()
        Returns the day of the semi-annual of the RecurringTimeSchedule.
        Returns:
        the configured day of the semi-annual.
      • getDayOfMonth

        public int getDayOfMonth()
        Returns the day of the month of the RecurringTimeSchedule as configured.
        Returns:
        the configured day of the month or -1 if it is every day.
      • getDayOfMonth

        public int getDayOfMonth(int month)
        Returns the day of the month of the RecurringTimeSchedule during runtime that interpret settings greater than 28 correctly by month
        Returns:
        the configured day of the month .
      • setDayOfMonth

        public void setDayOfMonth(int dayOfMonth)
        Changes the day of the month of the RecurringTimeSchedule.
        Parameters:
        dayOfMonth - new day of the month to configure (-1 if it is every day). This attribute is exclusive with dayOfWeek therefore value of dayOfWeek is set to ignore. To set the dayOfMonth value other than -1(daily), the month value must be set either to specific month or -1(monthly). Allowed values are 1-28 if the schedule is set to monthly. If the month value is set to the schedule, then the value can be set according to month.
        Throws:
        java.lang.IllegalArgumentException - Thrown if argument is not within the range.
      • setTimeZone

        public void setTimeZone(java.util.TimeZone timeZone)
        Method to set the schedule time zone.
        Parameters:
        timeZone -
      • getTimeZone

        public java.util.TimeZone getTimeZone()
        Returns the timezone that the schedule is configured with.
        Returns:
        TimeZone the timezone used for this schedule.
      • schedule

        public long schedule(long time)
        Returns the next scheduled date in milliseconds since the epoch.
        Specified by:
        schedule in interface Schedulable
        Parameters:
        time - the current time in milliseconds since the epoch.
        Returns:
        the scheduled date in milliseconds since the epoch.
      • isDaily

        public boolean isDaily()
        Method to check if the schedule is daily.
        Returns:
        boolean true if schedule is set to daily.
      • isMonthly

        public boolean isMonthly()
        Method to check if the schedule is monthly.
        Returns:
        boolean true if schedule is set to monthly.
      • isWeekly

        public boolean isWeekly()
        Method to check if the schedule is weekly.
        Returns:
        boolean true if schedule is set to weekly.
      • isWeeklyWithSpecificDays

        public boolean isWeeklyWithSpecificDays()
        Method to check if the schedule is weekly with specific days selected.
        Returns:
        boolean true if schedule is set to weekly.
      • isHourly

        public boolean isHourly()
        Method to check if the schedule is hourly.
        Returns:
        boolean true if schedule is set to hourly.
      • isMinutely

        public boolean isMinutely()
        Method to check if the schedule is minutely.
        Returns:
        boolean true if schedule is set to minutely.
      • isQuarterly

        public boolean isQuarterly()
        Method to check if the schedule is quarterly.
        Returns:
        boolean true if the schedule is set to quarterly.
      • isSemiAnnually

        public boolean isSemiAnnually()
        Method to check if the schedule is semi-annually.
        Returns:
        boolean true if the schedule is set to semi-annually.