|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sas.hls.schedule.ScheduleTrigger
public class ScheduleTrigger
ScheduleTrigger defines when the schedule will run.
Examples:
To define a schedule trigger that runs once at a specified time:
ScheduleTrigger trigger = new ScheduleTrigger();
trigger.setTriggerType(TriggerType.ONCE);
trigger.setStartDate(todayDate);
To define a schedule trigger that runs every two days with a scheduled end date:
ScheduleTrigger trigger = new ScheduleTrigger();
trigger.setTriggerType(TriggerType.DAILY);
trigger.setStartDate(startDate);
trigger.setInterval(2);
trigger.setEndDate(endDate);
To define a schedule trigger that runs every week on Monday for the next 8 weeks:
ScheduleTrigger trigger = new ScheduleTrigger();
trigger.setTriggerType(TriggerType.WEEKLY);
trigger.setStartDate(todayDate);
List
daysOfWeek.add(DayOfWeek.MON);
trigger.setDaysOfWeek(daysOfWeek);
trigger.setNumOccurrences(8);
trigger.setTimeZone(Calendar.getInstance(TimeZone.getTimeZone("CST")).getTimeZone().getID());
To define a schedule trigger that runs every 5 minutes indefinitely:
ScheduleTrigger trigger = new ScheduleTrigger();
trigger.setTriggerType(TriggerType.MINUTELY);
trigger.setStartDate(todayDate);
trigger.setInterval(5);
trigger.setRepeatForever(true);
There are several options for defining how or if a recurring schedule ends. Here is the order in which the options take precedence. If repeateForever is set to true, that takes precedence, and the other options are ignored. If repeateForever is false, and numOccurrences is specified, endDate is ignored.
repeatForever numOccurrences endDate
Nested Class Summary | |
---|---|
static class |
ScheduleTrigger.DayOfWeek
DayOfWeek is an enumeration representing the days of a week to use in weekly schedules. |
static class |
ScheduleTrigger.TriggerType
TriggerType is an enumeration representing the possible intervals in which the schedule can run. |
Constructor Summary | |
---|---|
ScheduleTrigger()
|
Method Summary | |
---|---|
List<ScheduleTrigger.DayOfWeek> |
getDaysOfWeek()
For WEEKLY trigger types, this returns the days of the week that this schedule will execute. |
Date |
getEndDate()
Gets the end date and time of the schedule which specifies when the schedule will stop executing. |
int |
getInterval()
Gets the interval number for the schedule. |
int |
getNumOccurrences()
Gets the number of occurrences for the which the schedule should execute. |
boolean |
getRepeatForever()
Gets whether to repeat the schedule indefinitely. |
Date |
getStartDate()
Gets the start date and time of the schedule |
String |
getTimeZone()
Gets the timeZone for the schedule. |
ScheduleTrigger.TriggerType |
getTriggerType()
Gets the trigger type for the schedule. |
void |
setDaysOfWeek(List<ScheduleTrigger.DayOfWeek> daysOfWeek)
Sets the days of week. |
void |
setEndDate(Date endDate)
Sets the end date and time of the schedule. |
void |
setInterval(int interval)
Sets the interval number for the schedule. |
void |
setNumOccurrences(int numOccurrences)
Sets the number of occurrences for the which the schedule should execute. |
void |
setRepeatForever(boolean repeatForever)
Sets whether to repeat the schedule indefinitely. |
void |
setStartDate(Date startDate)
Sets the start date and time of the schedule. |
void |
setTimeZone(String timeZone)
Sets the timeZone for the schedule. |
void |
setTriggerType(ScheduleTrigger.TriggerType triggerType)
Sets the trigger type for the schedule. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScheduleTrigger()
Method Detail |
---|
public Date getStartDate()
public void setStartDate(Date startDate)
startDate
- The startDate to set.public Date getEndDate()
public void setEndDate(Date endDate)
endDate
- The endDate to set.public boolean getRepeatForever()
public void setRepeatForever(boolean repeatForever)
repeatForever
- The repeatForever to set.public int getInterval()
public void setInterval(int interval)
interval
- The interval to set.public ScheduleTrigger.TriggerType getTriggerType()
public void setTriggerType(ScheduleTrigger.TriggerType triggerType)
triggerType
- The triggerType to set.public int getNumOccurrences()
public void setNumOccurrences(int numOccurrences)
numOccurrences
- The numOccurrences to set.public List<ScheduleTrigger.DayOfWeek> getDaysOfWeek()
public void setDaysOfWeek(List<ScheduleTrigger.DayOfWeek> daysOfWeek)
daysOfWeek
- The daysOfWeek to set.public String getTimeZone()
public void setTimeZone(String timeZone)
timeZone
- the timeZone to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |