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).
Modifier and Type | Field and Description |
---|---|
protected com.webmethods.rtl.date.DateFields |
m_at
Relative starting date for the interval.
|
protected com.webmethods.rtl.date.DateFields |
m_interval
Interval at which schedule repeats.
|
Constructor and Description |
---|
Schedule()
New schedule with no interval or relative start.
|
Schedule(com.webmethods.rtl.date.DateFields interval)
New schedule with an interval and no relative start.
|
Schedule(com.webmethods.rtl.date.DateFields interval,
com.webmethods.rtl.date.DateFields at)
New schedule with an interval and a relative start.
|
Modifier and Type | Method and Description |
---|---|
com.webmethods.rtl.date.DateFields |
getAt()
Relative starting date for the interval.
|
com.webmethods.rtl.date.DateFields |
getInterval()
Interval at which schedule repeats.
|
Date |
nextDate(Date d)
Calculates the next date on the schedule, relative to the specified date.
|
Date |
previousDate(Date d)
Calculates the previous date on the schedule, relative to the specified date.
|
void |
setAt(com.webmethods.rtl.date.DateFields at)
Relative starting date for the interval.
|
void |
setInterval(com.webmethods.rtl.date.DateFields interval)
Interval at which schedule repeats.
|
protected com.webmethods.rtl.date.DateFields m_at
nextDate(java.util.Date)
and previousDate(java.util.Date)
may produce inconsistent results.protected com.webmethods.rtl.date.DateFields m_interval
public Schedule()
nextDate(java.util.Date)
or the #prevDate
.public Schedule(com.webmethods.rtl.date.DateFields interval)
public Schedule(com.webmethods.rtl.date.DateFields interval, com.webmethods.rtl.date.DateFields at)
public Date nextDate(Date d)
d
- Current date.public Date previousDate(Date d)
d
- Current date.public com.webmethods.rtl.date.DateFields getAt()
nextDate(java.util.Date)
and previousDate(java.util.Date)
may produce inconsistent results.public void setAt(com.webmethods.rtl.date.DateFields at)
nextDate(java.util.Date)
and previousDate(java.util.Date)
may produce inconsistent results.
param at Relative starting date for the interval.public com.webmethods.rtl.date.DateFields getInterval()
public void setInterval(com.webmethods.rtl.date.DateFields interval)