Class Schedule
- java.lang.Object
-
- mondrian.util.Schedule
-
public class Schedule extends Object
ASchedulegenerates a series of time events.Create a schedule using one of the factory methods:
createOnce(java.util.Date, java.util.TimeZone),createDaily(java.util.Date, java.util.Date, java.util.TimeZone, java.sql.Time, int),createWeekly(java.util.Date, java.util.Date, java.util.TimeZone, java.sql.Time, int, int),createMonthlyByDay(java.util.Date, java.util.Date, java.util.TimeZone, java.sql.Time, int, int),createMonthlyByWeek(java.util.Date, java.util.Date, java.util.TimeZone, java.sql.Time, int, int, int).
Then use the
nextOccurrence(java.util.Date, boolean)method to find the next occurrence after a particular point in time.The
beginandendparameters represent the points in time between which the schedule is active. Both are optional. However, if a schedule type supports aperiodparameter, and you supply a value greater than 1,beginis used to determine the start of the cycle. Ifbeginis not specified, the cycle starts at the epoch (January 1st, 1970).The
Dateparameters in this API --beginandend, thetimeparameter tocreateOnce(java.util.Date, java.util.TimeZone), and theearliestDateparameter and value returned fromnextOccurrence(java.util.Date, boolean)-- always represent a point in time (GMT), not a local time. If a schedule is to start at 12 noon Tokyo time, April 1st, 2002, it is the application's reponsibility to convert this into a UTCDatevalue.- Since:
- May 7, 2002
- Author:
- jhyde
-
-
Field Summary
Fields Modifier and Type Field Description static intLAST_DAY_OF_MONTHIndicates that a schedule should fire on the last day of the month.static intLAST_WEEK_OF_MONTHIndicates that a schedule should fire on the last week of the month.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SchedulecreateDaily(Date begin, Date end, TimeZone tz, Time timeOfDay, int period)Creates a calendar which fires every day.static SchedulecreateMonthlyByDay(Date begin, Date end, TimeZone tz, Time timeOfDay, int period, int daysOfMonthBitmap)Creates a calendar which fires on particular days of each month.static SchedulecreateMonthlyByWeek(Date begin, Date end, TimeZone tz, Time timeOfDay, int period, int daysOfWeekBitmap, int weeksOfMonthBitmap)Creates a calendar which fires on particular days of particular weeks of a month.static SchedulecreateOnce(Date date, TimeZone tz)Creates a calendar which fires only once.static SchedulecreateWeekly(Date begin, Date end, TimeZone tz, Time timeOfDay, int period, int daysOfWeekBitmap)Creates a calendar which fires on particular days each week.DatenextOccurrence(Date after, boolean strict)Returns the next occurrence of this schedule after a given date.
-
-
-
Method Detail
-
createOnce
public static Schedule createOnce(Date date, TimeZone tz)
Creates a calendar which fires only once.- Parameters:
date- date and time to fire, must be UTCtz- timezone
-
createDaily
public static Schedule createDaily(Date begin, Date end, TimeZone tz, Time timeOfDay, int period)
Creates a calendar which fires every day.- Parameters:
begin- open lower bound, may be null, must be UTCend- closed upper bound, may be null, must be UTCtz- timezonetimeOfDay- time at which to fireperiod- causes the schedule to fire everyperioddays. Ifperiodis greater than 1, the cycle starts at the begin point of the schedule, or at the epoch (1 January, 1970) ifbeginis not specified.
-
createWeekly
public static Schedule createWeekly(Date begin, Date end, TimeZone tz, Time timeOfDay, int period, int daysOfWeekBitmap)
Creates a calendar which fires on particular days each week.- Parameters:
tz- timezonedaysOfWeekBitmap- a bitmap of day values, for example(1 <<to fire on Tuesdays and ThursdaysCalendar.TUESDAY) | (1 <<Calendar.THURSDAY)timeOfDay- time at which to firebegin- open lower bound, may be nullend- closed upper bound, may be nullperiod- causes the schedule to be active everyperiodweeks. Ifperiodis greater than 1, the cycle starts at the begin point of the schedule, or at the epoch (1 January, 1970) ifbeginis not specified.
-
createMonthlyByDay
public static Schedule createMonthlyByDay(Date begin, Date end, TimeZone tz, Time timeOfDay, int period, int daysOfMonthBitmap)
Creates a calendar which fires on particular days of each month. For example,
creates a schedule which fires on the 12th, 14th and last day of the month.createMonthlyByDay( null, null, TimeZone.getTimeZone("PST"), 1, (1 << 12) | (1 << 14) | (1 <<LAST_DAY_OF_MONTH))- Parameters:
begin- open lower bound, may be nullend- closed upper bound, may be nulltz- timezonedaysOfMonthBitmap- a bitmap of day values, may includeLAST_DAY_OF_MONTHtimeOfDay- time at which to fireperiod- causes the schedule to be active everyperiodmonths. Ifperiodis greater than 1, the cycle starts at the begin point of the schedule, or at the epoch (1 January, 1970) ifbeginis not specified.
-
createMonthlyByWeek
public static Schedule createMonthlyByWeek(Date begin, Date end, TimeZone tz, Time timeOfDay, int period, int daysOfWeekBitmap, int weeksOfMonthBitmap)
Creates a calendar which fires on particular days of particular weeks of a month. For example,
creates a schedule which fires on the 2nd and last Tuesday and Thursday of the month.createMonthlyByWeek( null, null, TimeZone.getTimeZone("PST"), (1 << Calendar.TUESDAY) | (1 << Calendar.THURSDAY), (1 << 2) | (1 <<LAST_WEEK_OF_MONTH)- Parameters:
begin- open lower bound, may be nullend- closed upper bound, may be nulltz- timezonedaysOfWeekBitmap- a bitmap of day values, for example(1 << Calendar.TUESDAY) | (1 << Calendar.THURSDAY)weeksOfMonthBitmap- a bitmap of week values (may includeLAST_WEEK_OF_MONTHtimeOfDay- time at which to fireperiod- causes the schedule be active everyperiodmonths. Ifperiodis greater than 1, the cycle starts at the begin point of the schedule, or at the epoch (1 January, 1970) ifbeginis not specified.
-
nextOccurrence
public Date nextOccurrence(Date after, boolean strict)
Returns the next occurrence of this schedule after a given date. Ifafteris null, returns the first occurrence. If there are no further occurrences, returns null.- Parameters:
after- if not null, returns the first occurrence after this point in time; if null, returns the first occurrence ever.strict- Ifafteris an occurrence,strictdetermines whether this method returns it, or the next occurrence. Ifstrictis true, the value returned is strictly greater thanafter.
-
-