com.silverpeas.calendar
Class CalendarEventRecurrence

java.lang.Object
  extended by com.silverpeas.calendar.CalendarEventRecurrence

public class CalendarEventRecurrence
extends Object

It defines the recurrence rules of a calendar event. An event recurrence is defined by a frequence (secondly, minutly, hourly, daily, weekly, monthly, or yearly) and optionally by some days of week on which the event should frequently occur, and by a terminaison condition.


Field Summary
static CalendarEventRecurrence NO_RECURRENCE
          A constant that defines a specific value for an empty recurrence.
static int NO_RECURRENCE_COUNT
          A constant that defines a specific value for no recurrence count limit.
static Datable<?> NO_RECURRENCE_END_DATE
          A constant that defines a specific value for no recurrence end date.
 
Method Summary
static CalendarEventRecurrence anEventRecurrence(RecurrencePeriod period)
          Creates a new event recurrence by specifying the recurrence period at which the event should recur.
static CalendarEventRecurrence every(int frequencyValue, TimeUnit frequencyUnit)
          Creates a new event recurrence from the specified frequency.
static CalendarEventRecurrence every(TimeUnit frequencyUnit)
          Creates a new event recurrence from the specified frequency.
 CalendarEventRecurrence excludeEventOccurrencesStartingAt(Datable<?>... datables)
          Excludes from this recurrence rule the occurrences of the event starting at the specified dates.
 List<DayOfWeekOccurrence> getDaysOfWeek()
          Gets the days of week on which the event should recur each time.
 Datable<?> getEndDate()
          Gets the end date of the recurrence.
 List<Datable<?>> getExceptionDates()
          Gets the date/time exceptions to this recurrence rule.
 RecurrencePeriod getFrequency()
          Gets the frequency at which the event should recur.
 int getRecurrenceCount()
          Gets the number of time the event should occur.
 CalendarEventRecurrence on(DayOfWeek... days)
          Sets some specific days of week at which the event should periodically occur.
 CalendarEventRecurrence on(DayOfWeekOccurrence... days)
          Sets some specific occurrences of day of week at which the event should periodically occur within monthly or yearly period.
 CalendarEventRecurrence on(List<DayOfWeekOccurrence> days)
          Sets some specific occurrences of day of week at which the event should periodically occur within monthly or yearly period.
 CalendarEventRecurrence upTo(Datable<?> endDate)
          Sets a terminaison to this recurrence by specifying an end date of the recurrence.
 CalendarEventRecurrence upTo(int recurrenceCount)
          Sets a terminaison to this recurrence by specifying the number of time the event should recur.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_RECURRENCE

public static final CalendarEventRecurrence NO_RECURRENCE
A constant that defines a specific value for an empty recurrence.


NO_RECURRENCE_COUNT

public static final int NO_RECURRENCE_COUNT
A constant that defines a specific value for no recurrence count limit.

See Also:
Constant Field Values

NO_RECURRENCE_END_DATE

public static final Datable<?> NO_RECURRENCE_END_DATE
A constant that defines a specific value for no recurrence end date.

Method Detail

every

public static CalendarEventRecurrence every(TimeUnit frequencyUnit)
Creates a new event recurrence from the specified frequency.

Parameters:
frequencyUnit - the frequency in which the event should recur: SECOND means SECONDLY, MINUTE means minutly, HOUR means hourly, WEEK means weekly, DAY means dayly, WEEK means weekly, MONTH means monthly or YEAR means YEARLY.
Returns:
the event recurrence instance.

every

public static CalendarEventRecurrence every(int frequencyValue,
                                            TimeUnit frequencyUnit)
Creates a new event recurrence from the specified frequency. For example every(2, MONTH) means every 2 month.

Parameters:
frequencyValue - the value of the event frequency. every two weeks.
frequencyUnit - the frequency unit.
Returns:
the event recurrence instance.

anEventRecurrence

public static CalendarEventRecurrence anEventRecurrence(RecurrencePeriod period)
Creates a new event recurrence by specifying the recurrence period at which the event should recur.

Parameters:
period - the recurrence period of the event.
Returns:
the event recurrence instance.

excludeEventOccurrencesStartingAt

public CalendarEventRecurrence excludeEventOccurrencesStartingAt(Datable<?>... datables)
Excludes from this recurrence rule the occurrences of the event starting at the specified dates.

Parameters:
datables - a list of dates at which the occurrences to exclude start.
Returns:
itself.

on

public CalendarEventRecurrence on(DayOfWeek... days)
Sets some specific days of week at which the event should periodically occur. For example, recur every weeks on monday and on thuesday. For a monthly or an yearly recurrence, the day of week occurrence is the first one of the month or the year.

Parameters:
days - the days of week at which an event should occur. Theses days replace the ones already set in the recurrence.
Returns:
itself.

on

public CalendarEventRecurrence on(DayOfWeekOccurrence... days)
Sets some specific occurrences of day of week at which the event should periodically occur within monthly or yearly period. For example, recur every month on the third monday and on the first thuesday. The days of week for a weekly recurrence can also be indicated if, and only if, the nth occurrence of the day is the first one or all occurrences (as there is actually only one possible occurrence of a day in a week); any value other than 1 or ALL_OCCURRENCES is considered as an error and an IllegaleArgumentException is thrown.

Parameters:
days - the occurrences of day of week at which an event should occur. Theses days replace the ones already set in the recurrence.
Returns:
itself.

on

public CalendarEventRecurrence on(List<DayOfWeekOccurrence> days)
Sets some specific occurrences of day of week at which the event should periodically occur within monthly or yearly period. For example, recur every month on the third monday and on the first thuesday. The days of week for a weekly recurrence can also be indicated if, and only if, the nth occurrence of the day is the first one or all occurrences (as there is actually only one possible occurrence of a day in a week); any value other than 1 or ALL_OCCURRENCES is considered as an error and an IllegaleArgumentException is thrown.

Parameters:
days - a list of days of week at which an event should occur. Theses days replace the ones already set in the recurrence.
Returns:
itself.

upTo

public CalendarEventRecurrence upTo(int recurrenceCount)
Sets a terminaison to this recurrence by specifying the number of time the event should recur. Settings this terminaison overrides the recurrence end date.

Parameters:
recurrenceCount - the number of time the event should occur.
Returns:
itself.

upTo

public CalendarEventRecurrence upTo(Datable<?> endDate)
Sets a terminaison to this recurrence by specifying an end date of the recurrence. Settings this terminaison overrides the number of time the event should occur.

Parameters:
endDate - the end date of the recurrence.
Returns:
itself.

getFrequency

public RecurrencePeriod getFrequency()
Gets the frequency at which the event should recur.

Returns:
the frequency as a RecurrencePeriod instance.

getRecurrenceCount

public int getRecurrenceCount()
Gets the number of time the event should occur. If 0 is returned, then no terminaison by recurrence count is defined.

Returns:
the recurrence count or 0 if no such terminaison is defined.

getEndDate

public Datable<?> getEndDate()
Gets the end date of the recurrence. If null is returned then no terminaison by end date is defined.

Returns:
the recurrence end date or null if no such terminaison is defined.

getDaysOfWeek

public List<DayOfWeekOccurrence> getDaysOfWeek()
Gets the days of week on which the event should recur each time.

Returns:
an unmodifiable list of days of week or an empty list if no days of week is set to this recurrence.

getExceptionDates

public List<Datable<?>> getExceptionDates()
Gets the date/time exceptions to this recurrence rule. The returned date/datetime are the start date/datetime of the occurrences that are excluded from this recurrence rule. They are the exception in the application of the recurrence rule.

Returns:
an unmodifiable list of datables.


Copyright © 2016 Silverpeas. All Rights Reserved.