|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.oddjob.schedules.ScheduleType
public class ScheduleType
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>
| Nested Class Summary | |
|---|---|
static class |
ScheduleType.Conversions
|
| Constructor Summary | |
|---|---|
ScheduleType()
|
|
| Method Summary | |
|---|---|
void |
configured()
The configuration for the bean has been fully configured. |
void |
destroy()
The configuration for the bean is about to be destroyed. |
Date |
getDate()
|
ScheduleResult |
getResult()
|
Schedule |
getSchedule()
|
String |
getTimeZone()
Get the time zone id to use in this schedule. |
void |
initialised()
The configuration for the bean has been initialised. |
void |
setDate(Date clock)
|
void |
setSchedule(Schedule schedule)
|
void |
setTimeZone(String timeZoneId)
Set the time zone. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ScheduleType()
| Method Detail |
|---|
public ScheduleResult getResult()
public Schedule getSchedule()
public void setSchedule(Schedule schedule)
public Date getDate()
public void setDate(Date clock)
public String getTimeZone()
public void setTimeZone(String timeZoneId)
timeZoneId - the timeZoneId.public void initialised()
ArooaLifeAware
initialised in interface ArooaLifeAwarepublic void configured()
ArooaLifeAware
configured in interface ArooaLifeAwarepublic void destroy()
ArooaLifeAware
destroy in interface ArooaLifeAwarepublic String toString()
toString in class Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||