Compoze Software, Inc.

com.compoze.exchange
Class TaskRecurrencePattern


java.lang.Object

  |

  +--com.compoze.exchange.TaskRecurrencePattern


public class TaskRecurrencePattern
extends java.lang.Object

This class is used to represent the recurrence pattern for a task. Recurring Tasks have the ability to regenerate themselves. This functionality is available for Daily, Weekly, Monthly and Yearly tasks, but not Monthly Nth or Yearly Nth. Specifying a regenerative task will force an initially calculated end date, discarding any specified date, since the end date becomes variable.

Recurrence patterns are not necessarily static upon calling any of the createXXX methods. After a pattern is created, it is internally normalized. This is done because the recurrence pattern must contain fields for number of occurrences and end date, even if those fields are not used directly by the pattern. Normalization also adjusts start pattern start dates to make sure it falls on the pattern. So for example, creating a weekly pattern with a start date on Tuesday with a day mask of Wednesday will alter the start date to the next available Wednesday to match the pattern.

Additionally, if creating a monthly or yearly pattern with DayOfMonth or MonthOfYear set to zero, those fields will be reset to the day or month of the pattern start date. In other words, calling getDayOfMonth() will not return zero.


Field Summary
static TaskRecurrencePattern NONE
          This constant represents no recurrence, and may be passed in to clear the recurrence pattern on an existing task.
 
Method Summary
static TaskRecurrencePattern createDaily(java.util.Date startDate, java.util.Date endDate, int iInterval)
          Creates a daily recurring task with an end date.
static TaskRecurrencePattern createDaily(java.util.Date startDate, int iInterval)
          Creates a daily recurring task with no end date.
static TaskRecurrencePattern createDaily(java.util.Date startDate, int iInterval, int iOccurrences)
          Creates a daily recurrence pattern for a number of occurrences.
static TaskRecurrencePattern createDailyRegenerate(java.util.Date startDate, int iRegenerate)
          Creates a regenerating daily recurrence pattern with no end date.
static TaskRecurrencePattern createDailyRegenerate(java.util.Date startDate, int iRegenerate, int iOccurrences)
          Creates a regenerating daily recurrence pattern for a number of occurrences.
static TaskRecurrencePattern createMonthly(java.util.Date startDate, java.util.Date endDate, int iDayOfMonth, int iInterval)
          Creates a monthly recurrence pattern with an end date.
static TaskRecurrencePattern createMonthly(java.util.Date startDate, int iDayOfMonth, int iInterval)
          Creates a monthly recurring task with no end date.
static TaskRecurrencePattern createMonthly(java.util.Date startDate, int iDayOfMonth, int iInterval, int iOccurrences)
          Creates a monthly recurrence pattern for a number of occurrences.
static TaskRecurrencePattern createMonthlyNth(java.util.Date startDate, java.util.Date endDate, RecurrenceInstance instance, DaysOfWeek daysOfWeek, int iInterval)
          Creates a monthly nth recurrence pattern with an end date.
static TaskRecurrencePattern createMonthlyNth(java.util.Date startDate, RecurrenceInstance instance, DaysOfWeek daysOfWeek, int iInterval)
          Creates a monthly nth recurrence pattern with no end date.
static TaskRecurrencePattern createMonthlyNth(java.util.Date startDate, RecurrenceInstance instance, DaysOfWeek daysOfWeek, int iInterval, int iOccurrences)
          Creates a monthly nth recurrence pattern for occurrences.
static TaskRecurrencePattern createMonthlyRegenerate(java.util.Date startDate, int iRegenerate)
          Creates a regenerative monthly recurrence pattern with no end date.
static TaskRecurrencePattern createMonthlyRegenerate(java.util.Date startDate, int iRegenerate, int iOccurrences)
          Creates a regenerative monthly recurrence pattern with occurrences.
static TaskRecurrencePattern createWeekly(java.util.Date startDate, java.util.Date endDate, DaysOfWeek daysOfWeek, int iInterval)
          Creates a weekly recurrence pattern with an end date.
static TaskRecurrencePattern createWeekly(java.util.Date startDate, DaysOfWeek daysOfWeek, int iInterval)
          Creates a weekly recurrence pattern with no end date.
static TaskRecurrencePattern createWeekly(java.util.Date startDate, DaysOfWeek daysOfWeek, int iInterval, int iOccurrences)
          Creates a weekly recurrence pattern for a number of occurrences.
static TaskRecurrencePattern createWeeklyRegenerate(java.util.Date startDate, int iRegenerate)
          Creates a regenerative weekly recurrence pattern with no end date.
static TaskRecurrencePattern createWeeklyRegenerate(java.util.Date startDate, int iRegenerate, int iOccurrences)
          Creates a regenerative weekly recurrence pattern for a number of occurrences.
static TaskRecurrencePattern createYearly(java.util.Date startDate, java.util.Date endDate, int iMonthOfYear, int iDayOfMonth)
          Creates a yearly task recurrence pattern with an end date.
static TaskRecurrencePattern createYearly(java.util.Date startDate, int iMonthOfYear, int iDayOfMonth)
          Creates a yearly task recurrence pattern with no end date.
static TaskRecurrencePattern createYearly(java.util.Date startDate, int iMonthOfYear, int iDayOfMonth, int iOccurrences)
          Creates a yearly task recurrence pattern ending for a number of occurrences.
static TaskRecurrencePattern createYearlyNth(java.util.Date startDate, java.util.Date endDate, RecurrenceInstance instance, DaysOfWeek daysOfWeek, int iMonthOfYear)
          Creates a yearly nth recurrence pattern with an end date.
static TaskRecurrencePattern createYearlyNth(java.util.Date startDate, RecurrenceInstance instance, DaysOfWeek daysOfWeek, int iMonthOfYear)
          Creates a yearly nth recurrence pattern with no end date.
static TaskRecurrencePattern createYearlyNth(java.util.Date startDate, RecurrenceInstance instance, DaysOfWeek daysOfWeek, int iMonthOfYear, int iOccurrences)
          Creates a yearly nth recurrence pattern with a number of occurrences.
static TaskRecurrencePattern createYearlyRegenerate(java.util.Date startDate, int iRegenerate)
          Creates a regenerating yearly recurrence pattern with no end date.
static TaskRecurrencePattern createYearlyRegenerate(java.util.Date startDate, int iRegenerate, int iOccurrences)
          Creates a regenerating yearly recurrence pattern with a number of occurrences.
 boolean equals(java.lang.Object o)
          Compares equality of two patterns.
 int getDayOfMonth()
          Gets the day of the month for the pattern (only valid for RecurrenceType.MONTHLY and RecurrenceType.YEARLY)
 DaysOfWeek getDaysOfWeek()
          Gets the days of the week mask for the recurrence (only valid for RecurrenceType.WEEKLY, RecurrenceType.MONTHLY_NTH and RecurrenceType.YEARLY_NTH).
 RecurrenceInstance getInstance()
          Gets the instance of the day within the period (only valid for RecurrenceType.MONTHLY_NTH and RecurrenceType.YEARLY_NTH).
 int getInterval()
          Gets the number of recurrence units between instances.
 int getMonthOfYear()
          Gets the month of year for the pattern (only valid for types RecurrenceType.YEARLY and RecurrenceType.YEARLY_NTH).
 int getOccurrences()
          Gets the number of occurrences in the pattern.
 java.util.Date getPatternEndDate()
          Gets the date of the last recurring task.
 java.util.Date getPatternStartDate()
          Gets the date of the first recurring task.
 RecurrenceType getRecurrenceType()
          Gets the type of the recurrence.
 int getRegenerate()
          Gets the regeneration interval for the pattern type.
 boolean hasNoEndDate()
          Gets whether the pattern has an end date.
 boolean isRegenerating()
          Returns if this pattern is regenerative.
 java.lang.String toString()
          Gets the string representation of the pattern.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE


public static final TaskRecurrencePattern NONE
This constant represents no recurrence, and may be passed in to clear the recurrence pattern on an existing task.
Method Detail

createDaily


public static TaskRecurrencePattern createDaily(java.util.Date startDate,
                                                int iInterval)
Creates a daily recurring task with no end date.
Parameters:
startDate - the start date of the task
iInterval - the number of days between recurrences
Returns:
the pattern

createDaily


public static TaskRecurrencePattern createDaily(java.util.Date startDate,
                                                java.util.Date endDate,
                                                int iInterval)
Creates a daily recurring task with an end date.
Parameters:
startDate - the start date of the task
endDate - the end date of the task (or null if the pattern has no end)
iInterval - the number of days between recurrences
Returns:
the pattern

createDaily


public static TaskRecurrencePattern createDaily(java.util.Date startDate,
                                                int iInterval,
                                                int iOccurrences)
Creates a daily recurrence pattern for a number of occurrences.
Parameters:
startDate - the start date of the task
iInterval - the number of days between recurrences
iOccurrences - the number of times the task recurs (greater or equal to one)
Returns:
the pattern

createDailyRegenerate


public static TaskRecurrencePattern createDailyRegenerate(java.util.Date startDate,
                                                          int iRegenerate,
                                                          int iOccurrences)
Creates a regenerating daily recurrence pattern for a number of occurrences.
Parameters:
startDate - the start date of the task
iRegenerate - the number of days between recurrences
iOccurrences - the number of times the task recurs (greater or equal to one)
Returns:
the pattern

createDailyRegenerate


public static TaskRecurrencePattern createDailyRegenerate(java.util.Date startDate,
                                                          int iRegenerate)
Creates a regenerating daily recurrence pattern with no end date.
Parameters:
startDate - the start date of the task
iRegenerate - the number of days between recurrences
Returns:
the pattern

createWeekly


public static TaskRecurrencePattern createWeekly(java.util.Date startDate,
                                                 DaysOfWeek daysOfWeek,
                                                 int iInterval)
Creates a weekly recurrence pattern with no end date.
Parameters:
startDate - the start date of the task
daysOfWeek - the days of week to recur (or null to use the day of the week of the start date)
iInterval - the number of weeks between recurrences
Returns:
the pattern

createWeekly


public static TaskRecurrencePattern createWeekly(java.util.Date startDate,
                                                 java.util.Date endDate,
                                                 DaysOfWeek daysOfWeek,
                                                 int iInterval)
Creates a weekly recurrence pattern with an end date.
Parameters:
startDate - the start date of the task
endDate - the end date of the task (or null if the pattern has no end)
daysOfWeek - the days of week to recur (or null to use the day of the week of the start date)
iInterval - the number of weeks between recurrences
Returns:
the pattern

createWeekly


public static TaskRecurrencePattern createWeekly(java.util.Date startDate,
                                                 DaysOfWeek daysOfWeek,
                                                 int iInterval,
                                                 int iOccurrences)
Creates a weekly recurrence pattern for a number of occurrences.
Parameters:
startDate - the start date of the task
daysOfWeek - the days of week to recur (or null to use the day of the week of the start date)
iInterval - the number of weeks between recurrences
iOccurrences - the number of times the task recurs (greater or equal to one)
Returns:
the pattern

createWeeklyRegenerate


public static TaskRecurrencePattern createWeeklyRegenerate(java.util.Date startDate,
                                                           int iRegenerate,
                                                           int iOccurrences)
Creates a regenerative weekly recurrence pattern for a number of occurrences.
Parameters:
startDate - the start date of the task
iRegenerate - the interval at which to regenerate the task (any number but zero will cancel out any setting for endDate)
iOccurrences - the number of times the task recurs (greater or equal to one)
Returns:
the pattern

createWeeklyRegenerate


public static TaskRecurrencePattern createWeeklyRegenerate(java.util.Date startDate,
                                                           int iRegenerate)
Creates a regenerative weekly recurrence pattern with no end date.
Parameters:
startDate - the start date of the task
iRegenerate - the interval at which to regenerate the task (must be greater than zero)
Returns:
the pattern

createMonthly


public static TaskRecurrencePattern createMonthly(java.util.Date startDate,
                                                  int iDayOfMonth,
                                                  int iInterval)
Creates a monthly recurring task with no end date.
Parameters:
startDate - the start date of the task
iDayOfMonth - the day of the month to recur (or 0 to use the day of the month of the start date)
iInterval - the number of months between recurrences
Returns:
the pattern

createMonthly


public static TaskRecurrencePattern createMonthly(java.util.Date startDate,
                                                  java.util.Date endDate,
                                                  int iDayOfMonth,
                                                  int iInterval)
Creates a monthly recurrence pattern with an end date.
Parameters:
startDate - the start date of the task
endDate - the end date of the task (or null if the pattern has no end)
iDayOfMonth - the day of the month to recur (or 0 to use the day of the month of the start date)
iInterval - the number of months between recurrences
Returns:
the pattern

createMonthly


public static TaskRecurrencePattern createMonthly(java.util.Date startDate,
                                                  int iDayOfMonth,
                                                  int iInterval,
                                                  int iOccurrences)
Creates a monthly recurrence pattern for a number of occurrences.
Parameters:
startDate - the start date of the task
iDayOfMonth - the day of the month to recur (or 0 to use the day of the month of the start date)
iInterval - the number of months between recurrences
iOccurrences - the number of times the task recurs (greater or equal to one)
Returns:
the pattern

createMonthlyRegenerate


public static TaskRecurrencePattern createMonthlyRegenerate(java.util.Date startDate,
                                                            int iRegenerate)
Creates a regenerative monthly recurrence pattern with no end date.
Parameters:
startDate - the start date of the task
iRegenerate - the interval at which to regenerate the task (any number but zero will cancel out any setting for endDate)
Returns:
the pattern

createMonthlyRegenerate


public static TaskRecurrencePattern createMonthlyRegenerate(java.util.Date startDate,
                                                            int iRegenerate,
                                                            int iOccurrences)
Creates a regenerative monthly recurrence pattern with occurrences.
Parameters:
startDate - the start date of the task
iRegenerate - the interval at which to regenerate the task (any number but zero will cancel out any setting for endDate)
iOccurrences - the number of times the task recurs (greater or equal to one)
Returns:
the pattern

createMonthlyNth


public static TaskRecurrencePattern createMonthlyNth(java.util.Date startDate,
                                                     RecurrenceInstance instance,
                                                     DaysOfWeek daysOfWeek,
                                                     int iInterval)
Creates a monthly nth recurrence pattern with no end date.
Parameters:
startDate - the start date of the task
iInstance - the instance of the days of the week that the task recurs
daysOfWeek - the days of week (or null to use the day of the week of the start date)
iInterval - the number of months between recurrences
Returns:
the pattern

createMonthlyNth


public static TaskRecurrencePattern createMonthlyNth(java.util.Date startDate,
                                                     RecurrenceInstance instance,
                                                     DaysOfWeek daysOfWeek,
                                                     int iInterval,
                                                     int iOccurrences)
Creates a monthly nth recurrence pattern for occurrences.
Parameters:
startDate - the start date of the task
iInstance - the instance of the days of the week that the task recurs
daysOfWeek - the days of week (or null to use the day of the week of the start date)
iInterval - the number of months between recurrences
iOccurrences - the number of times the task recurs (greater or equal to one)
Returns:
the pattern

createMonthlyNth


public static TaskRecurrencePattern createMonthlyNth(java.util.Date startDate,
                                                     java.util.Date endDate,
                                                     RecurrenceInstance instance,
                                                     DaysOfWeek daysOfWeek,
                                                     int iInterval)
Creates a monthly nth recurrence pattern with an end date.
Parameters:
startDate - the start date of the task
endDate - the end date of the task (or null if the pattern has no end)
iInstance - the instance of the days of the week that the task recurs
daysOfWeek - the days of week (or null to use the day of the week of the start date)
iInterval - the number of months between recurrences
Returns:
the pattern

createYearly


public static TaskRecurrencePattern createYearly(java.util.Date startDate,
                                                 int iMonthOfYear,
                                                 int iDayOfMonth)
Creates a yearly task recurrence pattern with no end date.
Parameters:
startDate - the start date of the task
iMonthOfYear - the month of the year to recur (or 0 to use the month of the year of the start date)
iDayOfMonth - the day of the month to recur (or 0 to use the day of the month of the start date)
Returns:
the pattern

createYearly


public static TaskRecurrencePattern createYearly(java.util.Date startDate,
                                                 java.util.Date endDate,
                                                 int iMonthOfYear,
                                                 int iDayOfMonth)
Creates a yearly task recurrence pattern with an end date.
Parameters:
startDate - the start date of the task
endDate - the end date of the task (or null if the pattern has no end)
iMonthOfYear - the month of the year to recur (or 0 to use the month of the year of the start date)
iDayOfMonth - the day of the month to recur (or 0 to use the day of the month of the start date)
Returns:
the pattern

createYearly


public static TaskRecurrencePattern createYearly(java.util.Date startDate,
                                                 int iMonthOfYear,
                                                 int iDayOfMonth,
                                                 int iOccurrences)
Creates a yearly task recurrence pattern ending for a number of occurrences.
Parameters:
startDate - the start date of the task
iMonthOfYear - the month of the year to recur (or 0 to use the month of the year of the start date)
iDayOfMonth - the day of the month to recur (or 0 to use the day of the month of the start date)
iOccurrences - the number of times the task recurs (greater or equal to one)
Returns:
the pattern

createYearlyRegenerate


public static TaskRecurrencePattern createYearlyRegenerate(java.util.Date startDate,
                                                           int iRegenerate)
Creates a regenerating yearly recurrence pattern with no end date.
Parameters:
startDate - the start date of the task
iRegenerate - the interval at which to regenerate the task (any number but zero will cancel out any setting for endDate)
Returns:
the pattern

createYearlyRegenerate


public static TaskRecurrencePattern createYearlyRegenerate(java.util.Date startDate,
                                                           int iRegenerate,
                                                           int iOccurrences)
Creates a regenerating yearly recurrence pattern with a number of occurrences.
Parameters:
startDate - the start date of the task
iRegenerate - the interval at which to regenerate the task (any number but zero will cancel out any setting for endDate)
iOccurrences - the number of times the task recurs (greater or equal to one)
Returns:
the pattern

createYearlyNth


public static TaskRecurrencePattern createYearlyNth(java.util.Date startDate,
                                                    RecurrenceInstance instance,
                                                    DaysOfWeek daysOfWeek,
                                                    int iMonthOfYear)
Creates a yearly nth recurrence pattern with no end date.
Parameters:
startDate - the start date of the task
instance - the instance of the days of the week that the task recurs
daysOfWeek - the days of week (or null to use the day of the week of the start date)
iMonthOfYear - the month of the year to recur (or 0 to use the month of the year of the start date)
Returns:
the pattern

createYearlyNth


public static TaskRecurrencePattern createYearlyNth(java.util.Date startDate,
                                                    RecurrenceInstance instance,
                                                    DaysOfWeek daysOfWeek,
                                                    int iMonthOfYear,
                                                    int iOccurrences)
Creates a yearly nth recurrence pattern with a number of occurrences.
Parameters:
startDate - the start date of the task
instance - the instance of the days of the week that the task recurs
daysOfWeek - the days of week (or null to use the day of the week of the start date)
iMonthOfYear - the month of the year to recur (or 0 to use the month of the year of the start date)
iOccurrences - the number of times the task recurs (greater or equal to one)
Returns:
the pattern

createYearlyNth


public static TaskRecurrencePattern createYearlyNth(java.util.Date startDate,
                                                    java.util.Date endDate,
                                                    RecurrenceInstance instance,
                                                    DaysOfWeek daysOfWeek,
                                                    int iMonthOfYear)
Creates a yearly nth recurrence pattern with an end date.
Parameters:
startDate - the start date of the task
endDate - the end date of the task (or null if the pattern has no end)
instance - the instance of the days of the week that the task recurs
daysOfWeek - the days of week (or null to use the day of the week of the start date)
iMonthOfYear - the month of the year to recur (or 0 to use the month of the year of the start date)
Returns:
the pattern

getDayOfMonth


public int getDayOfMonth()
Gets the day of the month for the pattern (only valid for RecurrenceType.MONTHLY and RecurrenceType.YEARLY)
Returns:
the day of the month the task occurs

getDaysOfWeek


public DaysOfWeek getDaysOfWeek()
Gets the days of the week mask for the recurrence (only valid for RecurrenceType.WEEKLY, RecurrenceType.MONTHLY_NTH and RecurrenceType.YEARLY_NTH).
Returns:
the days of week mask

getInstance


public RecurrenceInstance getInstance()
Gets the instance of the day within the period (only valid for RecurrenceType.MONTHLY_NTH and RecurrenceType.YEARLY_NTH).
Returns:
the instance, or null if not set

getInterval


public int getInterval()
Gets the number of recurrence units between instances.
Returns:
the number of units between instances

getMonthOfYear


public int getMonthOfYear()
Gets the month of year for the pattern (only valid for types RecurrenceType.YEARLY and RecurrenceType.YEARLY_NTH).
Returns:
the month of the year the appointment recurs

hasNoEndDate


public boolean hasNoEndDate()
Gets whether the pattern has an end date. If this property is
Returns:
boolean indicating if there is an end date

getOccurrences


public int getOccurrences()
Gets the number of occurrences in the pattern.
Returns:
the number of occurrences

getRegenerate


public int getRegenerate()
Gets the regeneration interval for the pattern type.
Returns:
an integer indicating the regeneration period

isRegenerating


public boolean isRegenerating()
Returns if this pattern is regenerative.
Returns:
a boolean indicating if the pattern represents a regenerating pattern

getPatternStartDate


public java.util.Date getPatternStartDate()
Gets the date of the first recurring task.
Returns:
the pattern start date

getPatternEndDate


public java.util.Date getPatternEndDate()
Gets the date of the last recurring task.
Returns:
the pattern end date

getRecurrenceType


public RecurrenceType getRecurrenceType()
Gets the type of the recurrence.
Returns:
the recurrence type

toString


public java.lang.String toString()
Gets the string representation of the pattern.
Overrides:
toString in class java.lang.Object

equals


public boolean equals(java.lang.Object o)
Compares equality of two patterns.
Overrides:
equals in class java.lang.Object
Returns:
true if the two patterns are equal.

Compoze Software, Inc.

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.