Documents > BPS V2 Script API
bps::Schedule Class Reference

This class implements the BPS schedule object. More...

List of all members.

Public Member Functions

Boolean dayOfMonth (Number aDayOfMonth) const
Date firstDateTime (Date aDate) const
 Find the first date/time for a given date.
Boolean hour (Number aHour) const
Boolean isDateIncluded (Date aDate) const
 Check if a date is included in the schedule.
Boolean isDateTimeIncluded (Date aDateTime) const
 Check if a date/time is included in the schedule.
Date lastDateTime (Date aDate) const
 Find the last date/time for a given date.
Boolean minute (Number aMinute) const
Boolean month (Mixed aMonth) const
Date nextDate (Date aStart) const
 Find the next schedule date after the given start date.
Date nextDateTime (Date aStart) const
 Find the next schedule date/time after the given start date/time.
Date previousDate (Date aStart) const
 Find the previous schedule date before the given start date.
Date previousDateTime (Date aStart) const
 Find the previous schedule date/time before the given start date/time.
 Schedule (String aCronText)
void setDayOfMonth (Number aDayOfMonth, Boolean aEnable)
 Change the enable state of a day of month.
void setHour (Number aHour, Boolean aEnable)
 Change the enable state of a hour.
void setMinute (Number aMinute, Boolean aEnable)
 Change the enable state of a minute.
void setMonth (Mixed aMonth, Boolean aEnable)
 Change the enable state of a month.
void setWeekday (Mixed aWeekday, Boolean aEnable)
 Change the enable state of a weekday.
String toString () const
Boolean weekday (Mixed aWeekday) const

Properties

String cronText
 The schedule string.

Detailed Description

This class implements the BPS schedule object.

Example usage:

 importExtension('bps');
 
 var sched = new bps.Schedule('0 8,12 * mon,wed,fri *');
 var d = new Date;
 print('Next 10 dates for schedule '+sched.cronText+' after '+d+':');
 for (var i = 0; i < 10; ++i) {
     print(d);
     d = sched.nextDateTime(d);
 } // for

Constructor & Destructor Documentation

bps::Schedule::Schedule ( String  aCronText)
Parameters:
aCronTextThe CRON text representation.

Member Function Documentation

Boolean bps::Schedule::dayOfMonth ( Number  aDayOfMonth) const
Parameters:
[in]aDayOfMonthMust be in the range 1 ... 31
Returns:
Element enable status.
Date bps::Schedule::firstDateTime ( Date  aDate) const

Find the first date/time for a given date.

Parameters:
[in]aDateThe date.
Returns:
The first date/time, or an invalid date/time if not found.
Boolean bps::Schedule::hour ( Number  aHour) const
Parameters:
[in]aHourMust be in the range 0 ... 23
Returns:
Element enable status.
Boolean bps::Schedule::isDateIncluded ( Date  aDate) const

Check if a date is included in the schedule.

Parameters:
[in]aDateThe date to check.
Returns:
True if the date is included in the schedule
Boolean bps::Schedule::isDateTimeIncluded ( Date  aDateTime) const

Check if a date/time is included in the schedule.

Parameters:
[in]aDateTimeThe date/time to check.
Returns:
True if the date/time is included in the schedule
Date bps::Schedule::lastDateTime ( Date  aDate) const

Find the last date/time for a given date.

Parameters:
[in]aDateThe date.
Returns:
The last date/time, or an invalid date/time if not found.
Boolean bps::Schedule::minute ( Number  aMinute) const
Parameters:
[in]aMinuteMust be in the range 0 ... 59
Returns:
Element enable status.
Boolean bps::Schedule::month ( Mixed  aMonth) const
Parameters:
[in]aMonthMust either be a string of: jan feb mar apr may jun jul aug sep oct nov dec, or a number in the range 1 ... 12
Returns:
Element enable status.
Date bps::Schedule::nextDate ( Date  aStart) const

Find the next schedule date after the given start date.

Parameters:
[in]aStartThe date to start searching from.
Returns:
The next date found, or an invalid date if no next date found.
Date bps::Schedule::nextDateTime ( Date  aStart) const

Find the next schedule date/time after the given start date/time.

Parameters:
[in]aStartThe date/time to start searching from.
Returns:
The next date and time found, or an invalid date/time if none found.
Date bps::Schedule::previousDate ( Date  aStart) const

Find the previous schedule date before the given start date.

Parameters:
[in]aStartThe date to start searching from.
Returns:
The previous date found, or an invalid date if no next date found.
Date bps::Schedule::previousDateTime ( Date  aStart) const

Find the previous schedule date/time before the given start date/time.

Parameters:
[in]aStartThe date/time to start searching from.
Returns:
The previous date found, or an invalid date/time if none found.
void bps::Schedule::setDayOfMonth ( Number  aDayOfMonth,
Boolean  aEnable 
)

Change the enable state of a day of month.

Parameters:
[in]aDayOfMonthMust be in the range 1 ... 31
[in]aEnableThe new enable state to set.
void bps::Schedule::setHour ( Number  aHour,
Boolean  aEnable 
)

Change the enable state of a hour.

Parameters:
[in]aHourMust be in the range 0 ... 23
[in]aEnableThe new enable state to set.
void bps::Schedule::setMinute ( Number  aMinute,
Boolean  aEnable 
)

Change the enable state of a minute.

Parameters:
[in]aMinuteMust be in the range 0 ... 59
[in]aEnableThe new enable state to set.
void bps::Schedule::setMonth ( Mixed  aMonth,
Boolean  aEnable 
)

Change the enable state of a month.

Parameters:
[in]aMonthMust either be a string of: jan feb mar apr may jun jul aug sep oct nov dec, or a number in the range 1 ... 12
[in]aEnableThe new enable state to set.
void bps::Schedule::setWeekday ( Mixed  aWeekday,
Boolean  aEnable 
)

Change the enable state of a weekday.

Parameters:
[in]aWeekdayMust either me a string of: sun mon tue wed thu fri sat, or a number in the range 0 ... 7, where 0/7 = sun, 1 = mon, 2 = tue, etc.
[in]aEnableThe new enable state to set.
String bps::Schedule::toString ( ) const
Returns:
Returns "Schedule(cronText)"
Boolean bps::Schedule::weekday ( Mixed  aWeekday) const
Parameters:
[in]aWeekdayMust either me a string of: sun mon tue wed thu fri sat, or a number in the range 0 ... 7, where 0/7 = sun, 1 = mon, 2 = tue, etc.
Returns:
Element enable status.

Property Documentation

String bps::Schedule::cronText [read, write]

The schedule string.