BPS Script API  2.24.4
bps::Schedule Class Reference

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

Public Member Functions

void clearExceptionDays ()
 Clear the list of exception days.
 
Boolean dayOfMonth (Number aDayOfMonth) const
 
Date firstDateTime (Date aDate) const
 Find the first date/time for a given date. More...
 
Boolean hour (Number aHour) const
 
Boolean isDateIncluded (Date aDate) const
 Check if a date is included in the schedule. More...
 
Boolean isDateTimeIncluded (Date aDateTime) const
 Check if a date/time is included in the schedule. More...
 
Date lastDateTime (Date aDate) const
 Find the last date/time for a given date. More...
 
void loadExceptionDays (Datastore aDatastore, Number aPartnerKey)
 Load exception days from datastore. More...
 
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. More...
 
Date nextDateTime (Date aStart) const
 Find the next schedule date/time after the given start date/time. More...
 
Date previousDate (Date aStart) const
 Find the previous schedule date before the given start date. More...
 
Date previousDateTime (Date aStart) const
 Find the previous schedule date/time before the given start date/time. More...
 
 Schedule (String aCronText)
 
void setDayOfMonth (Number aDayOfMonth, Boolean aEnable)
 Change the enable state of a day of month. More...
 
void setHour (Number aHour, Boolean aEnable)
 Change the enable state of a hour. More...
 
void setMinute (Number aMinute, Boolean aEnable)
 Change the enable state of a minute. More...
 
void setMonth (Mixed aMonth, Boolean aEnable)
 Change the enable state of a month. More...
 
void setWeekday (Mixed aWeekday, Boolean aEnable)
 Change the enable state of a weekday. More...
 
String toString () const
 
Boolean weekday (Mixed aWeekday) const
 

Properties

String cronText
 The schedule string. More...
 

Detailed Description

This class implements the BPS schedule object.

Example usage:

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
void print(...)
Print the expressions (applying toString() if necessary) to the console standard output (stdout),...
void importExtension(String aExtensionName)
Imports the named extension into the script engine.
This class implements the BPS schedule object.
Definition: bps.Schedule.js:20
The bps extension is a namespace assembling general BPS properties and functions.
Definition: bps.AsyncIO.js:1

Constructor & Destructor Documentation

◆ Schedule()

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

Member Function Documentation

◆ dayOfMonth()

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

◆ firstDateTime()

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.

◆ hour()

Boolean bps::Schedule::hour ( Number  aHour) const
Parameters
[in]aHourMust be in the range 0 ... 23
Returns
Element enable status.

◆ isDateIncluded()

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

◆ isDateTimeIncluded()

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

◆ lastDateTime()

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.

◆ loadExceptionDays()

void bps::Schedule::loadExceptionDays ( Datastore  aDatastore,
Number  aPartnerKey 
)

Load exception days from datastore.

Exception days can be defined to override the schedule of distinct dates.

Exception days are stored as global list and for each partner. If aPartnerKey is given, first all exception days of the given partner are loaded. Then those exception days of the parent partner are added which are not yet in the list, and so on until the parent is NULL. Finally those global exception days are added which are not yet in the list.

If the aPartnerKey is NULL, only the global exception days are loaded.

Parameters
[in]aDatastoreThe datastore object to use.
[in]aPartnerKeyKey of the partner, or omit to only load global exception days.
Exceptions
Ondatabase errors.

◆ minute()

Boolean bps::Schedule::minute ( Number  aMinute) const
Parameters
[in]aMinuteMust be in the range 0 ... 59
Returns
Element enable status.

◆ month()

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.

◆ nextDate()

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.

◆ nextDateTime()

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.

◆ previousDate()

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.

◆ previousDateTime()

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.

◆ setDayOfMonth()

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.

◆ setHour()

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.

◆ setMinute()

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.

◆ setMonth()

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.

◆ setWeekday()

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.

◆ toString()

String bps::Schedule::toString ( ) const
Returns
Returns "Schedule(cronText)"

◆ weekday()

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

◆ cronText

String bps::Schedule::cronText
readwrite

The schedule string.

 


The documentation for this class was generated from the following file: