org.oddjob.schedules.schedules
Class WeeklySchedule

java.lang.Object
  extended by org.oddjob.schedules.AbstractSchedule
      extended by org.oddjob.schedules.ConstrainedSchedule
          extended by org.oddjob.schedules.schedules.WeeklySchedule
All Implemented Interfaces:
Serializable, RefineableSchedule, Schedule

public final class WeeklySchedule
extends ConstrainedSchedule
implements Serializable

Description

A schedule for weekly intervals specified by days of the week. This schedule will typically be used with a TimeSchedule refinement property.

The days of the week are specified according to the ISO 8601 standard with Monday being day 1 and Sunday being day 7, or as one of MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY (case insensitive).

Example

A schedule for all day Tuesday. This schedule defines an interval between midnight Tuesday morning and up to midnight Tuesday night.
<schedules:weekly on="Tuesday" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"/>

Example

A schedule between Friday and the following Monday inclusive. This schedule is refined by a time that will define the schedule to be each of the days Friday, Saturday, Sunday, Monday at 3:45pm.
<schedules:weekly from="Friday" to="Monday" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules">
    <refinement>
        <schedules:daily at="15:45"/>
    </refinement>
</schedules:weekly>
See Also:
Serialized Form
Author:
Rob Gordon

Constructor Summary
WeeklySchedule()
           
 
Method Summary
protected  Calendar fromCalendar(Date referenceDate, TimeZone timeZone)
          Provide a Calendar for the start of the constraint.
 DayOfWeek getFrom()
           
 DayOfWeek getTo()
           
protected  CalendarUnit intervalBetween()
          Sub classes must provide a unit which is what must be added to move the schedule on.
 void setFrom(DayOfWeek from)
           
 void setOn(DayOfWeek on)
           
 void setTo(DayOfWeek to)
           
protected  Calendar toCalendar(Date referenceDate, TimeZone timeZone)
          Provide a Calendar for the end of the constraint.
 String toString()
          Override toString.
 
Methods inherited from class org.oddjob.schedules.ConstrainedSchedule
lastInterval, nextDue, nextInterval, shiftFromCalendar, shiftToCalendar
 
Methods inherited from class org.oddjob.schedules.AbstractSchedule
getRefinement, setRefinement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WeeklySchedule

public WeeklySchedule()
Method Detail

setFrom

public void setFrom(DayOfWeek from)

Property: from

Description: The from day of the week.

Required: No. Defaults to Monday.

Parameters:
from - The from date.

getFrom

public DayOfWeek getFrom()

setTo

public void setTo(DayOfWeek to)

Property: to

Description: The to day of the week.

Required: No. Defaults to Sunday.

Parameters:
to - The to day.

getTo

public DayOfWeek getTo()

setOn

public void setOn(DayOfWeek on)

Property: on

Description: The on day of week. This has the same effect as setting from and to to the same thing.

Required: No.

Parameters:
on - The on text.

intervalBetween

protected CalendarUnit intervalBetween()
Description copied from class: ConstrainedSchedule
Sub classes must provide a unit which is what must be added to move the schedule on. I.e. the equivalent of a day, week, month etc.

Specified by:
intervalBetween in class ConstrainedSchedule
Returns:

fromCalendar

protected Calendar fromCalendar(Date referenceDate,
                                TimeZone timeZone)
Description copied from class: ConstrainedSchedule
Provide a Calendar for the start of the constraint.

Specified by:
fromCalendar in class ConstrainedSchedule
Parameters:
referenceDate - The date/time now.
timeZone - The time zone.
Returns:
A calendar for the from time.

toCalendar

protected Calendar toCalendar(Date referenceDate,
                              TimeZone timeZone)
Description copied from class: ConstrainedSchedule
Provide a Calendar for the end of the constraint.

Specified by:
toCalendar in class ConstrainedSchedule
Parameters:
referenceDate - The date/time now.
timeZone - The time zone.
Returns:
A calendar for the end time.

toString

public String toString()
Override toString.

Specified by:
toString in class ConstrainedSchedule
Returns:
A description of the schedule.