public class ScheduleType extends java.lang.Object implements ArooaValue, ArooaLifeAware
The ScheduleResult
is also available and this can be used to calculate
recurring schedules as in the example below.
<oddjob id="this"> <job> <sequential> <jobs> <variables id="time"> <now> <schedule> <date> <value value="${date}"/> </date> <schedule> <schedules:now xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"/> </schedule> </schedule> </now> <formatted> <format date="${time.now}" format="hh:mm a"/> </formatted> </variables> <echo id="echo-time">The time now is ${time.formatted}</echo> </jobs> </sequential> </job> </oddjob>
<oddjob id="this"> <job> <sequential> <jobs> <variables id="time"> <now> <schedule timeZone="Asia/Hong_Kong"> <date> <value value="${date}"/> </date> <schedule> <schedules:day-after xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"/> </schedule> </schedule> </now> <formatted> <format date="${time.now}" format="hh:mm a"/> </formatted> </variables> <echo id="echo-time">Tomorrow in Hong Kong starts at ${time.formatted} our time.</echo> </jobs> </sequential> </job> </oddjob>Note that to display the current time in Hong Kong we would use a Time Zone on the format type, not on the now schedule because dates internally use UTC (Coordinated Universal Time) so now will always be the same regardless of time zone.
<oddjob xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"> <job> <sequential> <jobs> <variables id="time"> <tomorrow> <schedule> <date> <value value="${date}"/> </date> <schedule> <schedules:day-after/> </schedule> </schedule> </tomorrow> <nextBusinessDay> <schedule> <date> <value value="${time.tomorrow}"/> </date> <schedule> <schedules:broken> <schedule> <schedules:weekly from="Monday" to="Friday"> <refinement> <schedules:daily/> </refinement> </schedules:weekly> </schedule> <breaks> <schedules:list> <schedules> <schedules:date on="2011-12-26"/> <schedules:date on="2011-12-27"/> </schedules> </schedules:list> </breaks> </schedules:broken> </schedule> </schedule> </nextBusinessDay> </variables> <echo id="echo-time">The next business date is ${time.nextBusinessDay}</echo> </jobs> </sequential> </job> </oddjob>
<oddjob id="this"> <job> <sequential> <jobs> <variables id="vars"> <date> <value value="${date}"/> </date> </variables> <foreach> <values> <tokenizer text="1,2,3,4,5"/> </values> <configuration> <xml> <foreach> <job> <sequential> <jobs> <variables id="time"> <schedule> <schedule> <date> <value value="${vars.date}"/> </date> <schedule> <schedules:weekly from="Monday" to="Friday" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"> <refinement> <schedules:daily from="10:30"/> </refinement> </schedules:weekly> </schedule> </schedule> </schedule> </variables> <echo>Next due: ${time.schedule.result}</echo> <set> <values> <value key="vars.date" value="${time.schedule.result.useNext}"/> </values> </set> </jobs> </sequential> </job> </foreach> </xml> </configuration> </foreach> </jobs> </sequential> </job> </oddjob>
Modifier and Type | Class and Description |
---|---|
static class |
ScheduleType.Conversions |
Constructor and Description |
---|
ScheduleType() |
Modifier and Type | Method and Description |
---|---|
void |
configured()
The configuration for the bean has been fully configured.
|
void |
destroy()
The configuration for the bean is about to be destroyed.
|
java.util.Date |
getDate() |
ScheduleResult |
getResult() |
Schedule |
getSchedule() |
java.lang.String |
getTimeZone()
Get the time zone id to use in this schedule.
|
void |
initialised()
The configuration for the bean has been initialised.
|
void |
setDate(java.util.Date clock) |
void |
setSchedule(Schedule schedule) |
void |
setTimeZone(java.lang.String timeZoneId)
Set the time zone.
|
java.lang.String |
toString() |
public ScheduleResult getResult()
public Schedule getSchedule()
public void setSchedule(Schedule schedule)
public java.util.Date getDate()
public void setDate(java.util.Date clock)
public java.lang.String getTimeZone()
public void setTimeZone(java.lang.String timeZoneId)
timeZoneId
- the timeZoneId.public void initialised()
ArooaLifeAware
initialised
in interface ArooaLifeAware
public void configured()
ArooaLifeAware
configured
in interface ArooaLifeAware
public void destroy()
ArooaLifeAware
destroy
in interface ArooaLifeAware
public java.lang.String toString()
toString
in class java.lang.Object