public final class MonthlySchedule extends ConstrainedSchedule implements java.io.Serializable
The day of the month is given
as an number, normally 1 to 31. 0 and negative numbers can be used to specify
days from the end of the month. The words LAST and PENULTIMATE
(case insensitive) can also be
used as a convenience. Note that unlike the java
GregorianCalander
, 0 and negative numbers are taken to be
this month, not the previous month. i.e. on="0" is the last day of the month and
is equivalent to on="LAST".
Days and week of the month are given as the day number, 1 to 7, or as one of MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY (case insensitive). The week of the month is specified as a number, typically 1 to 5, or using one of FIRST, SECOND, THIRD, FOURTH, FIFTH, PENULTIMATE, or LAST (case insensitive).
If the week of the month is specified on it's own then the first week is taken to be the first complete week of the month.
<schedules:monthly fromDay="17" toDay="22" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"> <refinement> <schedules:daily at="10:00"/> </refinement> </schedules:monthly>This would schedule a job to run every day from the 17th of each month to the 25th of each month at 10am.
<schedules:monthly onDay="15" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"/>This will run a job on the 15th of every month.
<schedules:monthly onDayOfWeek="FRIDAY" inWeek="LAST" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"> <refinement> <schedules:time at="07:00"/> </refinement> </schedules:monthly>
Constructor and Description |
---|
MonthlySchedule() |
Modifier and Type | Method and Description |
---|---|
protected java.util.Calendar |
fromCalendar(java.util.Date referenceDate,
java.util.TimeZone timeZone)
Get a calendar for the from day.
|
DayOfMonth |
getFromDay() |
DayOfWeek |
getFromDayOfWeek() |
WeekOfMonth |
getFromWeek() |
DayOfMonth |
getToDay() |
DayOfWeek |
getToDayOfWeek() |
WeekOfMonth |
getToWeek() |
protected CalendarUnit |
intervalBetween()
Sub classes must provide a unit which is what must be
added to move the schedule on.
|
void |
setFromDay(DayOfMonth day) |
void |
setFromDayOfWeek(DayOfWeek fromDayOfWeek) |
void |
setFromWeek(WeekOfMonth fromWeek) |
void |
setInWeek(WeekOfMonth inWeek) |
void |
setOnDay(DayOfMonth on) |
void |
setOnDayOfWeek(DayOfWeek onDayOfWeek) |
void |
setToDay(DayOfMonth to) |
void |
setToDayOfWeek(DayOfWeek toDayOfWeek) |
void |
setToWeek(WeekOfMonth toWeek) |
protected java.util.Calendar |
shiftFromCalendar(java.util.Calendar calendar,
int intervals)
Shift the from Calendar by an interval.
|
protected java.util.Calendar |
shiftToCalendar(java.util.Calendar calendar,
int intervals)
Shift the to Calendar by an interval.
|
protected java.util.Calendar |
toCalendar(java.util.Date referenceDate,
java.util.TimeZone timeZone)
Get a calendar for the to day.
|
java.lang.String |
toString()
Override toString.
|
lastInterval, nextDue, nextInterval
getRefinement, setRefinement
public void setFromDay(DayOfMonth day)
Property: fromDay
Description: The from day of the month.
Required: No. Defaults to 1.
from
- The from date.public DayOfMonth getFromDay()
public void setToDay(DayOfMonth to)
Property: toDay
Description: The to day of the month.
Required: No. Defaults to the last day of the month.
to
- The to date.public DayOfMonth getToDay()
public void setOnDay(DayOfMonth on)
Property: onDay
Description: The day on which this schedule is for.
This has the same effect as setting fromDay
and toDay
to the same thing.
Required: No.
on
- The day on which this schedule is for.public DayOfWeek getFromDayOfWeek()
public void setFromDayOfWeek(DayOfWeek fromDayOfWeek)
Property: fromDayOfWeek
Description: The from day of the week. Used in conjunction with
fromWeekOfMonth
.
Required: No.
from
- The from date.public DayOfWeek getToDayOfWeek()
public void setToDayOfWeek(DayOfWeek toDayOfWeek)
Property: toDayOfWeek
Description: The to day of the week. Used in conjunction with
toDayOfWeek
.
Required: No.
from
- The from date.public void setOnDayOfWeek(DayOfWeek onDayOfWeek)
Property: onDayOfWeek
Description: The on day of the week. This is equivalent to
setting fromDayOfWeek
and toDayOfWeek
to the same thing.
Required: No.
from
- The from date.public WeekOfMonth getFromWeek()
public void setFromWeek(WeekOfMonth fromWeek)
Property: fromWeek
Description: The from week of the month.
Required: No.
from
- The from date.public WeekOfMonth getToWeek()
public void setToWeek(WeekOfMonth toWeek)
Property: toWeek
Description: The to week of the month.
Required: No.
from
- The from date.public void setInWeek(WeekOfMonth inWeek)
Property: inWeek
Description: The in week of the month. This is equivalent to
setting fromWeek
and toWeek
to the same thing.
Required: No.
from
- The from date.protected CalendarUnit intervalBetween()
ConstrainedSchedule
intervalBetween
in class ConstrainedSchedule
protected java.util.Calendar fromCalendar(java.util.Date referenceDate, java.util.TimeZone timeZone)
fromCalendar
in class ConstrainedSchedule
referenceDate
- The date to get month, year info from.timeZone
- The time zone.protected java.util.Calendar toCalendar(java.util.Date referenceDate, java.util.TimeZone timeZone)
toCalendar
in class ConstrainedSchedule
referenceDate
- The date to get month, yar info from.timeZone
- The time zone.protected java.util.Calendar shiftFromCalendar(java.util.Calendar calendar, int intervals)
ConstrainedSchedule
shiftFromCalendar
in class ConstrainedSchedule
protected java.util.Calendar shiftToCalendar(java.util.Calendar calendar, int intervals)
ConstrainedSchedule
ConstrainedSchedule.shiftFromCalendar(Calendar, int)
shiftToCalendar
in class ConstrainedSchedule
public java.lang.String toString()
toString
in class ConstrainedSchedule