Compoze Software, Inc.

com.compoze.collab.domino
Class RepeatPattern

java.lang.Object
  |
  +--com.compoze.collab.domino.RepeatPattern
All Implemented Interfaces:
com.compoze.collab.util.IDigestSupport, java.io.Serializable

public class RepeatPattern
extends java.lang.Object
implements java.io.Serializable, com.compoze.collab.util.IDigestSupport

This class represents the repeating pattern. A repeating pattern defines how a calendar item or task repeats, for example, daily. Use the methods starting with create to create common repeating patterns.

See Also:
Serialized Form

Field Summary
static int BYWEEK_FIFTH
          The value that represents the 'fifth week'.
static int BYWEEK_FIRST
          The value that represents the 'first week'.
static int BYWEEK_FOURTH
          The value that represents the 'fourth week'.
static int BYWEEK_SECOND
          The value that represents the 'second week'.
static int BYWEEK_THIRD
          The value that represents the 'third week'.
static int FRIDAY
          The value that represents the day Friday.
static int MONDAY
          The value that represents the day Monday.
static int SATURDAY
          The value that represents the day Saturday.
static int SUNDAY
          The value that represents the day Sunday.
static int THURSDAY
          The value that represents the day Thursday.
static int TUESDAY
          The value that represents the day Tuesday.
static int UPDATE_ALL
          The value that represents the update all rule.
static int UPDATE_THIS_INSTANCE
          The value that represents the update this instance rule.
static int WEDNESDAY
          The value that represents the day Wednesday.
 
Constructor Summary
RepeatPattern(ISession session, RepeatType type, java.util.Date startDate, int iInterval, java.util.Date untilDate, RepeatForUnit forUnit, int iFor, RepeatWeekends weekends, java.util.Date[] customDates, RepeatAdjust adjust)
          Constructor.
 
Method Summary
static RepeatPattern createCustom(ISession session, java.util.Date[] dates)
          Creates a custom repeating pattern.
static RepeatPattern createDaily(ISession session, java.util.Date startDate, int iInterval, RepeatWeekends weekends, java.util.Date untilDate)
          Creates a daily repeating pattern.
static RepeatPattern createDaily(ISession session, java.util.Date startDate, int iInterval, RepeatWeekends weekends, RepeatForUnit forUnit, int iFor)
          Creates a daily repeating pattern.
static RepeatPattern createMonthlyByDate(ISession session, java.util.Date startDate, int iInterval, int[] daysOfMonth, RepeatWeekends weekends, java.util.Date untilDate)
          Creates a monthly by date repeating pattern.
static RepeatPattern createMonthlyByDate(ISession session, java.util.Date startDate, int iInterval, int[] daysOfMonth, RepeatWeekends weekends, RepeatForUnit forUnit, int iFor)
          Creates a monthly by date repeating pattern.
static RepeatPattern createMonthlyByDay(ISession session, java.util.Date startDate, int iInterval, int[] daysOfWeek, RepeatWeekends weekends, java.util.Date untilDate)
          Creates a monthly by day repeating pattern.
static RepeatPattern createMonthlyByDay(ISession session, java.util.Date startDate, int iInterval, int[] daysOfWeek, RepeatWeekends weekends, RepeatForUnit forUnit, int iFor)
          Creates a monthly by day repeating pattern.
static RepeatPattern createWeekly(ISession session, java.util.Date startDate, int iInterval, int[] daysOfWeek, RepeatWeekends weekends, java.util.Date untilDate)
          Creates a weekly repeating pattern.
static RepeatPattern createWeekly(ISession session, java.util.Date startDate, int iInterval, int[] daysOfWeek, RepeatWeekends weekends, RepeatForUnit forUnit, int iFor)
          Creates a weekly repeating pattern.
static RepeatPattern createYearly(ISession session, java.util.Date startDate, int iInterval, RepeatWeekends weekends, java.util.Date untilDate)
          Creates a yearly repeating pattern.
static RepeatPattern createYearly(ISession session, java.util.Date startDate, int iInterval, RepeatWeekends weekends, RepeatForUnit forUnit, int iFor)
          Creates a yearly repeating pattern.
 RepeatAdjust getAdjust()
          Gets the adjust for the repeat pattern.
static java.lang.String getDayByNumber(int iDay)
          Gets the localized string for a day.
static java.lang.String getDayByNumber(int iDay, int iFieldWidth, java.util.Calendar cal, java.util.Locale locale)
          Gets the localized string for a day.
static java.lang.String getDayByNumber(int iDay, java.util.Locale locale)
          Gets the localized string for a day.
 int getFor()
          Gets the repeat pattern for.
 RepeatForUnit getForUnit()
          Gets the repeat pattern for unit.
 RepeatHow getHow()
          Gets the repeat pattern how.
 java.util.Date[] getInstanceDates()
          Gets a list of the dates for the repeat pattern.
 int getInterval()
          Gets the repeat pattern interval.
 Key[] getKeys()
          Gets a list of the values from the repeat pattern.
 RepeatPattern getPatternInstance(java.util.Date startDate)
          Gets a new instance of the repeat pattern with the new start date.
 RepeatPattern getPatternInstance(java.util.Date startDate, java.util.Date untilDate)
          Gets a new instance of the repeat pattern with the new start date.
 RepeatWeekends getRepeatWeekends()
          Gets the repeat pattern weekends.
 java.util.Date getStartDate()
          Gets the start date for the repeat pattern.
 RepeatType getType()
          Gets the repeat pattern type.
 java.util.Date getUntilDate()
          Gets the until date for the repeat pattern.
 java.util.List getValues()
          Gets a list of the values from the repeat pattern.
 IValue[] getValuesArray()
          Gets a list of the values from the repeat pattern.
 void setStartDate(java.util.Date startDate)
          Sets the start date for the repeat pattern.
static void sliceDates(java.util.Date instanceDate, java.util.Date[] dates, java.util.List previousDates, java.util.List futureDates)
          Slices the specified dates into previous and future dates using the instance date.
 java.lang.String toString()
          Returns the string representation of this object.
 void updateDigest(java.security.MessageDigest digest)
          Updates the specified MessageDigest with the object's internal state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BYWEEK_FIRST

public static final int BYWEEK_FIRST
The value that represents the 'first week'.

BYWEEK_SECOND

public static final int BYWEEK_SECOND
The value that represents the 'second week'.

BYWEEK_THIRD

public static final int BYWEEK_THIRD
The value that represents the 'third week'.

BYWEEK_FOURTH

public static final int BYWEEK_FOURTH
The value that represents the 'fourth week'.

BYWEEK_FIFTH

public static final int BYWEEK_FIFTH
The value that represents the 'fifth week'.

SUNDAY

public static final int SUNDAY
The value that represents the day Sunday.

MONDAY

public static final int MONDAY
The value that represents the day Monday.

TUESDAY

public static final int TUESDAY
The value that represents the day Tuesday.

WEDNESDAY

public static final int WEDNESDAY
The value that represents the day Wednesday.

THURSDAY

public static final int THURSDAY
The value that represents the day Thursday.

FRIDAY

public static final int FRIDAY
The value that represents the day Friday.

SATURDAY

public static final int SATURDAY
The value that represents the day Saturday.

UPDATE_ALL

public static final int UPDATE_ALL
The value that represents the update all rule.

UPDATE_THIS_INSTANCE

public static final int UPDATE_THIS_INSTANCE
The value that represents the update this instance rule.
Constructor Detail

RepeatPattern

public RepeatPattern(ISession session,
                     RepeatType type,
                     java.util.Date startDate,
                     int iInterval,
                     java.util.Date untilDate,
                     RepeatForUnit forUnit,
                     int iFor,
                     RepeatWeekends weekends,
                     java.util.Date[] customDates,
                     RepeatAdjust adjust)
              throws java.lang.IllegalArgumentException,
                     CollaborationException
Constructor.
Parameters:
session - the session (not null)
type - the repeat type
iInterval - the interval
startDate - the start date (may not be null)
untilDate - the repeat until date or null to repeat 'for'
forUnit - the for unit
iFor - the number of for units
weekends - the weekends rule (see WEEKENDS_ constants)
customDates - the custom dates (ignored if not CUSTOM type)
adjust - the date adjustment
Method Detail

getPatternInstance

public RepeatPattern getPatternInstance(java.util.Date startDate)
                                 throws java.lang.IllegalArgumentException,
                                        CollaborationException
Gets a new instance of the repeat pattern with the new start date. All other characteristics of the repeat pattern are preserved.
Parameters:
startDate - the start date (may not be null)
Returns:
the newly created repeat pattern

getPatternInstance

public RepeatPattern getPatternInstance(java.util.Date startDate,
                                        java.util.Date untilDate)
                                 throws java.lang.IllegalArgumentException,
                                        CollaborationException
Gets a new instance of the repeat pattern with the new start date. All other characteristics of the repeat pattern are preserved.
Parameters:
startDate - the start date (may not be null)
untilDate - the until date (may not be null)
Returns:
the newly created repeat pattern

getAdjust

public RepeatAdjust getAdjust()
Gets the adjust for the repeat pattern.
Returns:
the repeat adjust

getType

public RepeatType getType()
Gets the repeat pattern type.
Returns:
the repeat pattern type

getUntilDate

public java.util.Date getUntilDate()
Gets the until date for the repeat pattern.
Returns:
the until date or null if the repeat how is until

getInterval

public int getInterval()
Gets the repeat pattern interval.
Returns:
the repeat pattern interval

getFor

public int getFor()
Gets the repeat pattern for.
Returns:
the repeat pattern for

getHow

public RepeatHow getHow()
Gets the repeat pattern how. This tell how long the repeat pattern will occur for either: until a specified date or for a certain amount of time.
Returns:
the repeat pattern how
See Also:
getUntilDate(), getFor(), getForUnit()

getForUnit

public RepeatForUnit getForUnit()
Gets the repeat pattern for unit.
Returns:
the repeat pattern for unit

getStartDate

public java.util.Date getStartDate()
Gets the start date for the repeat pattern.
Returns:
the start date

setStartDate

public void setStartDate(java.util.Date startDate)
                  throws java.lang.IllegalArgumentException,
                         CollaborationException
Sets the start date for the repeat pattern.
Parameters:
startDate - the start date (may not be null)

getRepeatWeekends

public RepeatWeekends getRepeatWeekends()
Gets the repeat pattern weekends.
Returns:
the repeat pattern weekends

getInstanceDates

public java.util.Date[] getInstanceDates()
Gets a list of the dates for the repeat pattern. These are the instance dates for this repeating pattern.
Returns:
an array of dates

getValues

public java.util.List getValues()
Gets a list of the values from the repeat pattern.
Returns:
a list of IValue objects (unmodifiable)

getValuesArray

public IValue[] getValuesArray()
Gets a list of the values from the repeat pattern.
Returns:
an array of IValue objects (not null)

getKeys

public Key[] getKeys()
Gets a list of the values from the repeat pattern.
Returns:
a list of Key objects

createDaily

public static RepeatPattern createDaily(ISession session,
                                        java.util.Date startDate,
                                        int iInterval,
                                        RepeatWeekends weekends,
                                        java.util.Date untilDate)
                                 throws java.lang.IllegalArgumentException,
                                        CollaborationException
Creates a daily repeating pattern.
Parameters:
session - the session (not null)
startDate - the start date (may not be null)
iInterval - the interval (i.e. every=1, every other=2, every third=3, etc)
weekends - the weekends rule (may not be null
untilDate - the until date (may not be null and must be after the start date)
Returns:
the repeating pattern
Throws:
java.lang.IllegalArgumentException - if the specified rule is invalid

createDaily

public static RepeatPattern createDaily(ISession session,
                                        java.util.Date startDate,
                                        int iInterval,
                                        RepeatWeekends weekends,
                                        RepeatForUnit forUnit,
                                        int iFor)
                                 throws java.lang.IllegalArgumentException,
                                        CollaborationException
Creates a daily repeating pattern.
Parameters:
session - the session (not null)
startDate - the start date (may not be null)
iInterval - the interval (i.e. every=1, every other=2, every third=3, etc)
weekends - the weekends rule (may not be null
forUnit - the for unit
iFor - the number of for units
Returns:
the repeating pattern
Throws:
java.lang.IllegalArgumentException - if the specified rule is invalid

createCustom

public static RepeatPattern createCustom(ISession session,
                                         java.util.Date[] dates)
                                  throws java.lang.IllegalArgumentException,
                                         CollaborationException
Creates a custom repeating pattern.
Parameters:
session - the session (not null)
dates - the dates for the repeating pattern
Returns:
the repeating pattern
Throws:
java.lang.IllegalArgumentException - if the specified rule is invalid

createYearly

public static RepeatPattern createYearly(ISession session,
                                         java.util.Date startDate,
                                         int iInterval,
                                         RepeatWeekends weekends,
                                         java.util.Date untilDate)
                                  throws java.lang.IllegalArgumentException,
                                         CollaborationException
Creates a yearly repeating pattern.
Parameters:
session - the session (not null)
startDate - the start date (may not be null)
iInterval - the interval (i.e. every=1, every other=2, every third=3, etc)
weekends - the weekends rule (may not be null
untilDate - the until date (may not be null and must be after the start date)
Returns:
the repeating pattern
Throws:
java.lang.IllegalArgumentException - if the specified rule is invalid

createYearly

public static RepeatPattern createYearly(ISession session,
                                         java.util.Date startDate,
                                         int iInterval,
                                         RepeatWeekends weekends,
                                         RepeatForUnit forUnit,
                                         int iFor)
                                  throws java.lang.IllegalArgumentException,
                                         CollaborationException
Creates a yearly repeating pattern.

When setting the for unit and number of units, since this is a yearly repeating pattern, the for unit must be at a minimum RepeatForUnitEnum.YEARS. If not, there could potentially be no instance dates for the pattern therefore creating an invalid pattern. If you pass in a for unit less than RepeatForUnitEnum.YEARS, the for unit is automatically adjusted.

Parameters:
session - the session (not null)
startDate - the start date (may not be null)
iInterval - the interval (i.e. every=1, every other=2, every third=3, etc)
weekends - the weekends rule (may not be null
forUnit - the for unit (minimum RepeatForUnitEnum.YEARS)
iFor - the number of for units
Returns:
the repeating pattern
Throws:
java.lang.IllegalArgumentException - if the specified rule is invalid

createWeekly

public static RepeatPattern createWeekly(ISession session,
                                         java.util.Date startDate,
                                         int iInterval,
                                         int[] daysOfWeek,
                                         RepeatWeekends weekends,
                                         java.util.Date untilDate)
                                  throws java.lang.IllegalArgumentException,
                                         CollaborationException
Creates a weekly repeating pattern.
Parameters:
session - the session (not null)
startDate - the start date (may not be null)
iInterval - the interval (i.e. every=1, every other=2, every third=3, etc)
daysOfWeek - the days of week (array of int of SUNDAY-SATURDAY constants)
weekends - the weekends rule (may not be null
untilDate - the until date (may not be null and must be after the start date)
Returns:
the repeating pattern
Throws:
java.lang.IllegalArgumentException - if the specified rule is invalid

createWeekly

public static RepeatPattern createWeekly(ISession session,
                                         java.util.Date startDate,
                                         int iInterval,
                                         int[] daysOfWeek,
                                         RepeatWeekends weekends,
                                         RepeatForUnit forUnit,
                                         int iFor)
                                  throws java.lang.IllegalArgumentException,
                                         CollaborationException
Creates a weekly repeating pattern.

When setting the for unit and number of units, since this is a weekly repeating pattern, the for unit must be at a minimum RepeatForUnitEnum.WEEKS. If not, there could potentially be no instance dates for the pattern therefore creating an invalid pattern. If you pass in a for unit less than RepeatForUnitEnum.WEEKS, the for unit is automatically adjusted.

Parameters:
session - the session (not null)
startDate - the start date (may not be null)
iInterval - the interval (i.e. every=1, every other=2, every third=3, etc)
daysOfWeek - the days of week (array of int of SUNDAY-SATURDAY constants)
weekends - the weekends rule (may not be null
forUnit - the for unit (minimum RepeatForUnitEnum.WEEKS)
iFor - the number of for units
Returns:
the repeating pattern
Throws:
java.lang.IllegalArgumentException - if the specified rule is invalid

createMonthlyByDate

public static RepeatPattern createMonthlyByDate(ISession session,
                                                java.util.Date startDate,
                                                int iInterval,
                                                int[] daysOfMonth,
                                                RepeatWeekends weekends,
                                                java.util.Date untilDate)
                                         throws java.lang.IllegalArgumentException,
                                                CollaborationException
Creates a monthly by date repeating pattern.
Parameters:
session - the session (not null)
startDate - the start date (may not be null)
iInterval - the interval (i.e. every=1, every other=2, every third=3, etc)
daysOfMonth - the days of month (array of days, 1-31)
weekends - the weekends rule (may not be null
untilDate - the until date (may not be null and must be after the start date)
Returns:
the repeating pattern
Throws:
java.lang.IllegalArgumentException - if the specified rule is invalid

createMonthlyByDate

public static RepeatPattern createMonthlyByDate(ISession session,
                                                java.util.Date startDate,
                                                int iInterval,
                                                int[] daysOfMonth,
                                                RepeatWeekends weekends,
                                                RepeatForUnit forUnit,
                                                int iFor)
                                         throws java.lang.IllegalArgumentException,
                                                CollaborationException
Creates a monthly by date repeating pattern.

When setting the for unit and number of units, since this is a monthly repeating pattern, the for unit must be at a minimum RepeatForUnitEnum.MONTHS. If not, there could potentially be no instance dates for the pattern therefore creating an invalid pattern. If you pass in a for unit less than RepeatForUnitEnum.MONTHS, the for unit is automatically adjusted.

Parameters:
session - the session (not null)
startDate - the start date (may not be null)
iInterval - the interval (i.e. every=1, every other=2, every third=3, etc)
daysOfMonth - the days of month (array of days, 1-31)
weekends - the weekends rule (may not be null
forUnit - the for unit (minimum RepeatForUnitEnum.MONTHS)
iFor - the number of for units
Returns:
the repeating pattern
Throws:
java.lang.IllegalArgumentException - if the specified rule is invalid

createMonthlyByDay

public static RepeatPattern createMonthlyByDay(ISession session,
                                               java.util.Date startDate,
                                               int iInterval,
                                               int[] daysOfWeek,
                                               RepeatWeekends weekends,
                                               java.util.Date untilDate)
                                        throws java.lang.IllegalArgumentException,
                                               CollaborationException
Creates a monthly by day repeating pattern.
Parameters:
session - the session (not null)
startDate - the start date (may not be null)
iInterval - the interval (i.e. every=1, every other=2, every third=3, etc)
daysOfWeek - the days of week (array of SUNDAY-SATURDAY constants possibly or'd with one of the BYWEEK_ constants)
weekends - the weekends rule (may not be null
untilDate - the until date (may not be null and must be after the start date)
Returns:
the repeating pattern
Throws:
java.lang.IllegalArgumentException - if the specified rule is invalid

createMonthlyByDay

public static RepeatPattern createMonthlyByDay(ISession session,
                                               java.util.Date startDate,
                                               int iInterval,
                                               int[] daysOfWeek,
                                               RepeatWeekends weekends,
                                               RepeatForUnit forUnit,
                                               int iFor)
                                        throws java.lang.IllegalArgumentException,
                                               CollaborationException
Creates a monthly by day repeating pattern.

When setting the for unit and number of units, since this is a monthly repeating pattern, the for unit must be at a minimum RepeatForUnitEnum.MONTHS. If not, there could potentially be no instance dates for the pattern therefore creating an invalid pattern. If you pass in a for unit less than RepeatForUnitEnum.MONTHS, the for unit is automatically adjusted.

Parameters:
session - the session (not null)
startDate - the start date (may not be null)
iInterval - the interval (i.e. every=1, every other=2, every third=3, etc)
daysOfWeek - the days of week (array of SUNDAY-SATURDAY constants possibly or'd with one of the BYWEEK_ constants)
weekends - the weekends rule (may not be null
forUnit - the for unit (minimum RepeatForUnitEnum.MONTHS)
iFor - the number of for units
Returns:
the repeating pattern
Throws:
java.lang.IllegalArgumentException - if the specified rule is invalid

getDayByNumber

public static java.lang.String getDayByNumber(int iDay)
Gets the localized string for a day.
Parameters:
iDay - day number (see SUNDAY-SATURDAY constants)
Returns:
localized string for a day

getDayByNumber

public static java.lang.String getDayByNumber(int iDay,
                                              java.util.Locale locale)
Gets the localized string for a day.
Parameters:
iDay - day number (see SUNDAY-SATURDAY constants)
locale - locale to use
Returns:
localized string for a day

getDayByNumber

public static java.lang.String getDayByNumber(int iDay,
                                              int iFieldWidth,
                                              java.util.Calendar cal,
                                              java.util.Locale locale)
Gets the localized string for a day.
Parameters:
iDay - day number (see SUNDAY-SATURDAY constants)
iFieldWidth - width of day field
locale - locale to use
cal - calendar to use
Returns:
localized string for a day

sliceDates

public static void sliceDates(java.util.Date instanceDate,
                              java.util.Date[] dates,
                              java.util.List previousDates,
                              java.util.List futureDates)
Slices the specified dates into previous and future dates using the instance date.
Parameters:
instanceDate - the instance date
dates - the array of dates to slice
previousDates - a list of java.util.Dates before the instance date
futureDates - a list of java.util.Dates after the instance date

toString

public java.lang.String toString()
Returns the string representation of this object.
Overrides:
toString in class java.lang.Object
Returns:
the string representation of this object

updateDigest

public void updateDigest(java.security.MessageDigest digest)
Updates the specified MessageDigest with the object's internal state.
Specified by:
updateDigest in interface com.compoze.collab.util.IDigestSupport
Parameters:
digest - the digest to update (not null)

Compoze Software, Inc.

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