public class BrokenSchedule extends java.lang.Object implements java.io.Serializable, Schedule
This schedule works by moving the schedule forward if the start time of the next interval falls within the next interval defined by the break. In the example below for a time of Midday on 24th of December the logic is as follows:
The optional alternative property defines a schedule to be used during the breaks, instead of simply moving the interval forward.
<schedules:broken xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"> <schedule> <schedules:daily at="10:00"/> </schedule> <breaks> <schedules:yearly fromDate="12-25" toDate="12-26"/> </breaks> </schedules:broken>The logic is explained above.
<schedules:broken xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"> <schedule> <schedules:daily from="10:00"/> </schedule> <breaks> <schedules:list> <schedules> <schedules:weekly from="Saturday" to="Sunday"/> <schedules:date on="2011-12-26"/> <schedules:date on="2011-12-27"/> </schedules> </schedules:list> </breaks> <alternative> <schedules:time from="11:00"/> </alternative> </schedules:broken>
AfterSchedule
documentation has an example that uses the
broken
schedule to calculate the day after the next
working day.ScheduleType
documentation shows a broken
schedule being used to calculate the next working day.DayAfterSchedule
and DayBeforeSchedule
documentation
shows a broken
schedule being used to move the last day of the month.Constructor and Description |
---|
BrokenSchedule() |
Modifier and Type | Method and Description |
---|---|
Schedule |
getAlternative() |
Schedule |
getBreaks()
Get the breaks which will break up the schedule.
|
Schedule |
getSchedule()
Get the schedule to break up.
|
ScheduleResult |
nextDue(ScheduleContext context)
Implement the schedule.
|
void |
setAlternative(Schedule alternative) |
void |
setBreaks(Schedule breaks)
Set the breaks which will break up the schedule.
|
void |
setSchedule(Schedule schedule)
Set the schedule to break up.
|
java.lang.String |
toString()
Provide a simple string description.
|
public void setSchedule(Schedule schedule)
schedule
- The schedule to break up.public Schedule getSchedule()
public void setBreaks(Schedule breaks)
breaks
- The breaks schedule.public Schedule getBreaks()
public Schedule getAlternative()
public void setAlternative(Schedule alternative)
public ScheduleResult nextDue(ScheduleContext context)
public java.lang.String toString()
toString
in class java.lang.Object