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... | |
BpsSchedule & | operator= (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 |
Schedule object processing.
BpsSchedule::BpsSchedule | ( | const BpsSchedule & | aOther | ) |
Copy constructor.
aOther | The other schedule to clone. |
BpsSchedule::BpsSchedule | ( | const QString & | aCronText | ) |
aCronText | The CRON text representation. |
QString BpsSchedule::cronText | ( | ) | const |
bool BpsSchedule::dayOfMonth | ( | int | aDayOfMonth | ) | const |
aDayOfMonth | Must be in the range 1 ... 31 |
Find the first date/time for a given date.
aDate | The date. |
QTime BpsSchedule::firstTime | ( | ) | const |
bool BpsSchedule::hour | ( | int | aHour | ) | const |
aHour | Must be in the range 0 ... 23 |
bool BpsSchedule::isDateIncluded | ( | const QDate & | aDate | ) | const |
Check if a date is included in the schedule.
aDate | The date to check. |
bool BpsSchedule::isDateTimeIncluded | ( | const QDateTime & | aDateTime | ) | const |
Check if a date/time is included in the schedule.
aDateTime | The date/time to check. |
Find the last date/time for a given date.
aDate | The date. |
QTime BpsSchedule::lastTime | ( | ) | const |
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.
aDatastore | The datastore object to use. |
aPartnerKey | Key of the partner, or omit to only load global exception days. |
BpsException | on database errors. |
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.
aDatastore | The datastore object to use. |
aPartnerKeys | List of the partner keys. |
BpsException | on database errors. |
bool BpsSchedule::minute | ( | int | aMinute | ) | const |
aMinute | Must be in the range 0 ... 59 |
bool BpsSchedule::month | ( | const QString & | aMonth | ) | const |
aMonth | Must be one of: jan feb mar apr may jun jul aug sep oct nov dec |
bool BpsSchedule::month | ( | int | aMonth | ) | const |
aMonth | Must be in the range 1 ... 12 |
Find the next schedule date after the given start date.
aStart | The date to start searching from. |
Find the next schedule date/time after the given start date/time.
aStart | The date/time to start searching from. |
BpsSchedule& BpsSchedule::operator= | ( | const BpsSchedule & | aOther | ) |
Assign from other schedule.
aOther | The other schedule to copy. |
Find the previous schedule date before the given start date.
aStart | The date to start searching from. |
Find the previous schedule date/time before the given start date/time.
aStart | The date/time to start searching from. |
void BpsSchedule::setCronText | ( | const QString & | aCronText | ) |
Set schedule by a CRON text.
aCronText | The CRON text. |
void BpsSchedule::setDayOfMonth | ( | int | aDayOfMonth, |
bool | aEnable | ||
) |
Change the enable state of a day of month.
aDayOfMonth | Must be in the range 1 ... 31 |
aEnable | The new enable state to set. |
void BpsSchedule::setHour | ( | int | aHour, |
bool | aEnable | ||
) |
Change the enable state of a hour.
aHour | Must be in the range 0 ... 23 |
aEnable | The new enable state to set. |
void BpsSchedule::setMinute | ( | int | aMinute, |
bool | aEnable | ||
) |
Change the enable state of a minute.
aMinute | Must be in the range 0 ... 59 |
aEnable | The new enable state to set. |
void BpsSchedule::setMonth | ( | const QString & | aMonth, |
bool | aEnable | ||
) |
Change the enable state of a month.
aMonth | Must be one of: jan feb mar apr may jun jul aug sep oct nov dec |
aEnable | The new enable state to set. |
void BpsSchedule::setMonth | ( | int | aMonth, |
bool | aEnable | ||
) |
Change the enable state of a month.
aMonth | Must be in the range 1 ... 12 |
aEnable | The new enable state to set. |
void BpsSchedule::setWeekday | ( | const QString & | aWeekday, |
bool | aEnable | ||
) |
Change the enable state of a weekday.
aWeekday | Must be one of: sun mon tue wed thu fri sat |
aEnable | The new enable state to set. |
void BpsSchedule::setWeekday | ( | int | aWeekday, |
bool | aEnable | ||
) |
Change the enable state of a weekday.
aWeekday | Must be in the range 0 ... 7, where 0/7 = sun, 1 = mon, 2 = tue, etc. |
aEnable | The new enable state to set. |
bool BpsSchedule::weekday | ( | const QString & | aWeekday | ) | const |
aWeekday | Must be one of: sun mon tue wed thu fri sat |
bool BpsSchedule::weekday | ( | int | aWeekday | ) | const |
aWeekday | Must be in the range 0 ... 7, where 0/7 = sun, 1 = mon, 2 = tue, etc. |