Class Schedule

java.lang.Object
com.webmethods.caf.faces.data.object.Schedule
All Implemented Interfaces:
Serializable

public class Schedule extends Object implements Serializable

Schedule that encapsulates an interval of time, plus an optional relative starting date (the "at" property). For example, to create a schedule that repeats every 5 days, set the interval property to "5D" and don't set the at property. To create a schedule that repeats at 12:30 AM every 5 days, set the interval property to "5D" and the at property to "00:30".

When storing a schedule for repeated execution, you'd usually store the interval and the previous/next date of execution. To calculate the next date on the schedule at a later time, restore the interval as a DateFields object, and invoke DateFields.addToDate(java.util.Date) with the previous date, looping until the resulting date is greater than the current date (in case you missed some dates on the schedule between the date stored and the current date).

See Also:
  • Field Details

    • m_at

      protected DateFields m_at
      Relative starting date for the interval. For example, if the interval is "5D", a relative start of "00:30" sets the schedule to repeat at 12:30 AM every 5th day. If the interval is more fine-grained than the start (for example, the interval is "5H" and the start is "00:30"), nextDate(java.util.Date) and previousDate(java.util.Date) may produce inconsistent results.
    • m_interval

      protected DateFields m_interval
      Interval at which schedule repeats. For example, "5D" sets the schedule to repeat every five days; "5H" sets the schedule to repeat every five hours; "5m" sets the schedule to repeat every five minutes.
  • Constructor Details

    • Schedule

      public Schedule()
      New schedule with no interval or relative start. You must set an interval before calculating the nextDate(java.util.Date) or the #prevDate.
    • Schedule

      public Schedule(DateFields interval)
      New schedule with an interval and no relative start.
    • Schedule

      public Schedule(DateFields interval, DateFields at)
      New schedule with an interval and a relative start.
  • Method Details

    • nextDate

      public Date nextDate(Date d)
      Calculates the next date on the schedule, relative to the specified date.
      Parameters:
      d - Current date.
      Returns:
      Next date.
    • previousDate

      public Date previousDate(Date d)
      Calculates the previous date on the schedule, relative to the specified date.
      Parameters:
      d - Current date.
      Returns:
      Previous date.
    • getAt

      public DateFields getAt()
      Relative starting date for the interval. For example, if the interval is "5D", a relative start of "00:30" sets the schedule to repeat at 12:30 AM every 5th day. If the interval is more fine-grained than the start (for example, the interval is "5H" and the start is "00:30"), nextDate(java.util.Date) and previousDate(java.util.Date) may produce inconsistent results.
      Returns:
      Relative starting date for the interval.
    • setAt

      public void setAt(DateFields at)
      Relative starting date for the interval. For example, if the interval is "5D", a relative start of "00:30" sets the schedule to repeat at 12:30 AM every 5th day. If the interval is more fine-grained than the start (for example, the interval is "5H" and the start is "00:30"), nextDate(java.util.Date) and previousDate(java.util.Date) may produce inconsistent results. param at Relative starting date for the interval.
    • getInterval

      public DateFields getInterval()
      Interval at which schedule repeats. For example, "5D" sets the schedule to repeat every five days; "5H" sets the schedule to repeat every five hours; "5m" sets the schedule to repeat every five minutes.
      Returns:
      Interval at which schedule repeats.
    • setInterval

      public void setInterval(DateFields interval)
      Interval at which schedule repeats. For example, "5D" sets the schedule to repeat every five days; "5H" sets the schedule to repeat every five hours; "5m" sets the schedule to repeat every five minutes. param interval Interval at which schedule repeats.