BPS C++ API  2.24.4
BpsSchedule Class Reference

Schedule object processing. More...

#include <bpsschedule.h>

Public Member Functions

 BpsSchedule ()
 Default constructor.
 
 BpsSchedule (const BpsSchedule &aOther)
 Copy constructor. More...
 
 BpsSchedule (const QString &aCronText)
 
void clearExceptionDays ()
 Clear the list of exception days.
 
QString cronText () const
 
bool dayOfMonth (int aDayOfMonth) const
 
QDateTime firstDateTime (const QDate &aDate) const
 Find the first date/time for a given date. More...
 
QTime firstTime () const
 
bool hour (int aHour) const
 
bool isDateIncluded (const QDate &aDate) const
 Check if a date is included in the schedule. More...
 
bool isDateTimeIncluded (const QDateTime &aDateTime) const
 Check if a date/time is included in the schedule. More...
 
QDateTime lastDateTime (const QDate &aDate) const
 Find the last date/time for a given date. More...
 
QTime lastTime () const
 
void loadExceptionDays (BpsDatastore *aDatastore, const QVariant &aPartnerKey=QVariant())
 Load exception days from datastore. More...
 
void loadExceptionDays (BpsDatastore *aDatastore, const QVariantList &aPartnerKeys)
 Load exception days from datastore. More...
 
bool minute (int aMinute) const
 
bool month (const QString &aMonth) const
 
bool month (int aMonth) const
 
QDate nextDate (const QDate &aStart) const
 Find the next schedule date after the given start date. More...
 
QDateTime nextDateTime (const QDateTime &aStart) const
 Find the next schedule date/time after the given start date/time. More...
 
BpsScheduleoperator= (const BpsSchedule &aOther)
 Assign from other schedule. More...
 
QDate previousDate (const QDate &aStart) const
 Find the previous schedule date before the given start date. More...
 
QDateTime previousDateTime (const QDateTime &aStart) const
 Find the previous schedule date/time before the given start date/time. More...
 
void setCronText (const QString &aCronText)
 Set schedule by a CRON text. More...
 
void setDayOfMonth (int aDayOfMonth, bool aEnable)
 Change the enable state of a day of month. More...
 
void setHour (int aHour, bool aEnable)
 Change the enable state of a hour. More...
 
void setMinute (int aMinute, bool aEnable)
 Change the enable state of a minute. More...
 
void setMonth (const QString &aMonth, bool aEnable)
 Change the enable state of a month. More...
 
void setMonth (int aMonth, bool aEnable)
 Change the enable state of a month. More...
 
void setWeekday (const QString &aWeekday, bool aEnable)
 Change the enable state of a weekday. More...
 
void setWeekday (int aWeekday, bool aEnable)
 Change the enable state of a weekday. More...
 
bool weekday (const QString &aWeekday) const
 
bool weekday (int aWeekday) const
 

Detailed Description

Schedule object processing.

Constructor & Destructor Documentation

◆ BpsSchedule() [1/2]

BpsSchedule::BpsSchedule ( const BpsSchedule aOther)

Copy constructor.

Parameters
aOtherThe other schedule to clone.

◆ BpsSchedule() [2/2]

BpsSchedule::BpsSchedule ( const QString aCronText)
Parameters
aCronTextThe CRON text representation.

Member Function Documentation

◆ cronText()

QString BpsSchedule::cronText ( ) const
Returns
The CRON text representation of the schedule.

◆ dayOfMonth()

bool BpsSchedule::dayOfMonth ( int  aDayOfMonth) const
Parameters
aDayOfMonthMust be in the range 1 ... 31
Returns
Element enable status.

◆ firstDateTime()

QDateTime BpsSchedule::firstDateTime ( const QDate aDate) const

Find the first date/time for a given date.

Parameters
aDateThe date.
Returns
The first date/time, or an invalid date/time if not found.

◆ firstTime()

QTime BpsSchedule::firstTime ( ) const
Returns
The first time, or an invalid time if none.

◆ hour()

bool BpsSchedule::hour ( int  aHour) const
Parameters
aHourMust be in the range 0 ... 23
Returns
Element enable status.

◆ isDateIncluded()

bool BpsSchedule::isDateIncluded ( const QDate aDate) const

Check if a date is included in the schedule.

Parameters
aDateThe date to check.
Returns
True if the date is included in the schedule

◆ isDateTimeIncluded()

bool BpsSchedule::isDateTimeIncluded ( const QDateTime aDateTime) const

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

Parameters
aDateTimeThe date/time to check.
Returns
True if the date/time is included in the schedule

◆ lastDateTime()

QDateTime BpsSchedule::lastDateTime ( const QDate aDate) const

Find the last date/time for a given date.

Parameters
aDateThe date.
Returns
The last date/time, or an invalid date/time if not found.

◆ lastTime()

QTime BpsSchedule::lastTime ( ) const
Returns
The last time, or an invalid time if none.

◆ loadExceptionDays() [1/2]

void BpsSchedule::loadExceptionDays ( BpsDatastore aDatastore,
const QVariant aPartnerKey = QVariant() 
)

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 not null, 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 partner key is NULL, only the global exception days are loaded.

Parameters
aDatastoreThe datastore object to use.
aPartnerKeyKey of the partner, or omit to only load global exception days.
Exceptions
BpsExceptionon database errors.

◆ loadExceptionDays() [2/2]

void BpsSchedule::loadExceptionDays ( BpsDatastore aDatastore,
const QVariantList &  aPartnerKeys 
)

Load exception days from datastore.

This overload combines the exception days of multiple partners. Workdays and scheduledays present for all partners are included, where a date being workday for some partners and scheduleday for others becomes a scheduleday. The restdays of all partners are all included and override any workdays or scheduledays.

If the list of partner keys is empty no exception days are loaded. For invalid partner key values and keys of not existing partners the global exception days are used.

Parameters
aDatastoreThe datastore object to use.
aPartnerKeysList of the partner keys.
Exceptions
BpsExceptionon database errors.

◆ minute()

bool BpsSchedule::minute ( int  aMinute) const
Parameters
aMinuteMust be in the range 0 ... 59
Returns
Element enable status.

◆ month() [1/2]

bool BpsSchedule::month ( const QString aMonth) const
Parameters
aMonthMust be one of: jan feb mar apr may jun jul aug sep oct nov dec
Returns
Element enable status.

◆ month() [2/2]

bool BpsSchedule::month ( int  aMonth) const
Parameters
aMonthMust be in the range 1 ... 12
Returns
Element enable status.

◆ nextDate()

QDate BpsSchedule::nextDate ( const QDate aStart) const

Find the next schedule date after the given start date.

Parameters
aStartThe date to start searching from.
Returns
The next date found, or an invalid date if no next date found.

◆ nextDateTime()

QDateTime BpsSchedule::nextDateTime ( const QDateTime aStart) const

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

Parameters
aStartThe date/time to start searching from.
Returns
The next date and time found, or an invalid date/time if none found.

◆ operator=()

BpsSchedule& BpsSchedule::operator= ( const BpsSchedule aOther)

Assign from other schedule.

Parameters
aOtherThe other schedule to copy.
Returns
Reference to the current object.

◆ previousDate()

QDate BpsSchedule::previousDate ( const QDate aStart) const

Find the previous schedule date before the given start date.

Parameters
aStartThe date to start searching from.
Returns
The previous date found, or an invalid date if no next date found.

◆ previousDateTime()

QDateTime BpsSchedule::previousDateTime ( const QDateTime aStart) const

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

Parameters
aStartThe date/time to start searching from.
Returns
The previous date found, or an invalid date/time if none found.

◆ setCronText()

void BpsSchedule::setCronText ( const QString aCronText)

Set schedule by a CRON text.

Parameters
aCronTextThe CRON text.

◆ setDayOfMonth()

void BpsSchedule::setDayOfMonth ( int  aDayOfMonth,
bool  aEnable 
)

Change the enable state of a day of month.

Parameters
aDayOfMonthMust be in the range 1 ... 31
aEnableThe new enable state to set.

◆ setHour()

void BpsSchedule::setHour ( int  aHour,
bool  aEnable 
)

Change the enable state of a hour.

Parameters
aHourMust be in the range 0 ... 23
aEnableThe new enable state to set.

◆ setMinute()

void BpsSchedule::setMinute ( int  aMinute,
bool  aEnable 
)

Change the enable state of a minute.

Parameters
aMinuteMust be in the range 0 ... 59
aEnableThe new enable state to set.

◆ setMonth() [1/2]

void BpsSchedule::setMonth ( const QString aMonth,
bool  aEnable 
)

Change the enable state of a month.

Parameters
aMonthMust be one of: jan feb mar apr may jun jul aug sep oct nov dec
aEnableThe new enable state to set.

◆ setMonth() [2/2]

void BpsSchedule::setMonth ( int  aMonth,
bool  aEnable 
)

Change the enable state of a month.

Parameters
aMonthMust be in the range 1 ... 12
aEnableThe new enable state to set.

◆ setWeekday() [1/2]

void BpsSchedule::setWeekday ( const QString aWeekday,
bool  aEnable 
)

Change the enable state of a weekday.

Parameters
aWeekdayMust be one of: sun mon tue wed thu fri sat
aEnableThe new enable state to set.

◆ setWeekday() [2/2]

void BpsSchedule::setWeekday ( int  aWeekday,
bool  aEnable 
)

Change the enable state of a weekday.

Parameters
aWeekdayMust be in the range 0 ... 7, where 0/7 = sun, 1 = mon, 2 = tue, etc.
aEnableThe new enable state to set.

◆ weekday() [1/2]

bool BpsSchedule::weekday ( const QString aWeekday) const
Parameters
aWeekdayMust be one of: sun mon tue wed thu fri sat
Returns
Element enable status.

◆ weekday() [2/2]

bool BpsSchedule::weekday ( int  aWeekday) const
Parameters
aWeekdayMust be in the range 0 ... 7, where 0/7 = sun, 1 = mon, 2 = tue, etc.
Returns
Element enable status.

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