Class CalendarRecurrenceHelper
- java.lang.Object
-
- org.alfresco.service.cmr.calendar.CalendarRecurrenceHelper
-
public class CalendarRecurrenceHelper extends java.lang.ObjectThis class provides helper functions for when working with recurringCalendarEntryinstances. It provides support for working with key parts of the Outlook/SharePoint recurrence rules- Since:
- 4.0
- Author:
- Nick Burch
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.Map<java.lang.String,java.lang.Integer>d2cdstatic java.lang.StringDAYstatic java.util.Map<java.lang.String,java.lang.Integer>DAY_NAMES_TO_CALENDAR_DAYSThe lookup from the day strings to Calendar Day entriesprotected static java.util.Map<java.lang.Integer,java.lang.String>WEEK_NUMBER_TO_WEEK_NAMEstatic java.lang.StringWEEKDAYSstatic java.lang.StringWEEKENDS
-
Constructor Summary
Constructors Constructor Description CalendarRecurrenceHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static voidbuildDailyRecurrences(java.util.Calendar currentDate, long duration, java.util.List<java.util.Date> dates, java.util.Map<java.lang.String,java.lang.String> params, java.util.Date onOrAfter, java.util.Date until, boolean firstOnly, int interval)static java.util.Map<java.lang.String,java.lang.String>buildLocalRecurrenceDaysOfTheWeek(java.util.Locale locale)Returns a lookup from recurrence rule days of the week, to the proper days of the week in the specified localestatic java.util.Map<java.lang.Integer,java.lang.String>buildLocalRecurrenceWeekNames(java.util.Locale locale)The lookup from the week in month number to week in month name in the specified localeprotected static voidbuildMonthlyRecurrences(java.util.Calendar currentDate, long duration, java.util.List<java.util.Date> dates, java.util.Map<java.lang.String,java.lang.String> params, java.util.Date onOrAfter, java.util.Date until, boolean firstOnly, int monthInterval)protected static voidbuildWeeklyRecurrences(java.util.Calendar currentDate, long duration, java.util.List<java.util.Date> dates, java.util.Map<java.lang.String,java.lang.String> params, java.util.Date onOrAfter, java.util.Date until, boolean firstOnly, int interval)protected static voidbuildYearlyRecurrences(java.util.Calendar currentDate, long duration, java.util.List<java.util.Date> dates, java.util.Map<java.lang.String,java.lang.String> params, java.util.Date onOrAfter, java.util.Date until, boolean firstOnly, int interval)static java.util.Map<java.lang.String,java.lang.String>extractRecurrenceRule(CalendarEntry entry)Returns the parsed calendar recurrence rule WARNING - Alfresco use only.protected static java.util.Map<java.lang.String,java.lang.String>fixOutlookRecurrenceQuirks(java.util.Map<java.lang.String,java.lang.String> params)Outlook does some crazy stuff, which is only just about permitted by the specification, and is hard to parse, especially for yearly events.static java.util.List<java.util.Date>getRecurrencesOnOrAfter(java.lang.String recurrenceRule, java.util.Date eventStart, java.util.Date eventEnd, java.util.Date lastRecurrence, java.util.Date onOrAfter, java.util.Date until, boolean firstOnly, java.util.Set<java.util.Date> ignoredDates)For the given Calendar Entry, return its subsequent Recurrence on or after the specified date, until the given limit.static java.util.List<java.util.Date>getRecurrencesOnOrAfter(CalendarEntry entry, java.util.Date onOrAfter, java.util.Date until, boolean firstOnly, java.util.Set<java.util.Date> ignoredDates)For the given Calendar Entry, return its subsequent Recurrence on or after the specified date, until the given limit.
-
-
-
Field Detail
-
d2cd
protected static final java.util.Map<java.lang.String,java.lang.Integer> d2cd
-
DAY_NAMES_TO_CALENDAR_DAYS
public static final java.util.Map<java.lang.String,java.lang.Integer> DAY_NAMES_TO_CALENDAR_DAYS
The lookup from the day strings to Calendar Day entries
-
DAY
public static final java.lang.String DAY
- See Also:
- Constant Field Values
-
WEEKDAYS
public static final java.lang.String WEEKDAYS
- See Also:
- Constant Field Values
-
WEEKENDS
public static final java.lang.String WEEKENDS
- See Also:
- Constant Field Values
-
WEEK_NUMBER_TO_WEEK_NAME
protected static final java.util.Map<java.lang.Integer,java.lang.String> WEEK_NUMBER_TO_WEEK_NAME
-
-
Method Detail
-
buildLocalRecurrenceDaysOfTheWeek
public static java.util.Map<java.lang.String,java.lang.String> buildLocalRecurrenceDaysOfTheWeek(java.util.Locale locale)
Returns a lookup from recurrence rule days of the week, to the proper days of the week in the specified locale
-
buildLocalRecurrenceWeekNames
public static java.util.Map<java.lang.Integer,java.lang.String> buildLocalRecurrenceWeekNames(java.util.Locale locale)
The lookup from the week in month number to week in month name in the specified locale
-
extractRecurrenceRule
public static java.util.Map<java.lang.String,java.lang.String> extractRecurrenceRule(CalendarEntry entry)
Returns the parsed calendar recurrence rule WARNING - Alfresco use only. Return type will likely shift to a real object in the near future
-
fixOutlookRecurrenceQuirks
protected static java.util.Map<java.lang.String,java.lang.String> fixOutlookRecurrenceQuirks(java.util.Map<java.lang.String,java.lang.String> params)
Outlook does some crazy stuff, which is only just about permitted by the specification, and is hard to parse, especially for yearly events. Fix these to more normal cases where possible TODO: This method modifies the input, returning the Map perhaps implies a copy is returned. Decide whether this should be of return type 'void', or make a defensive copy before modification.
-
getRecurrencesOnOrAfter
public static java.util.List<java.util.Date> getRecurrencesOnOrAfter(CalendarEntry entry, java.util.Date onOrAfter, java.util.Date until, boolean firstOnly, java.util.Set<java.util.Date> ignoredDates)
For the given Calendar Entry, return its subsequent Recurrence on or after the specified date, until the given limit. If it doesn't have any recurrences on or after the start date (either no recurrence rules, or the last recurrence date is before then), null will be returned. (The onOrAfter and until dates are treat as inclusive) If requested, can stop after the first hit- Returns:
- The next recurrence on or after the given date, or null if there aren't any
-
getRecurrencesOnOrAfter
public static java.util.List<java.util.Date> getRecurrencesOnOrAfter(java.lang.String recurrenceRule, java.util.Date eventStart, java.util.Date eventEnd, java.util.Date lastRecurrence, java.util.Date onOrAfter, java.util.Date until, boolean firstOnly, java.util.Set<java.util.Date> ignoredDates)For the given Calendar Entry, return its subsequent Recurrence on or after the specified date, until the given limit. If it doesn't have any recurrences on or after the start date (either no recurrence rules, or the last recurrence date is before then), null will be returned. (The onOrAfter and until dates are treat as inclusive) If requested, can stop after the first hit- Returns:
- The next recurrence on or after the given date, or null if there aren't any
-
buildDailyRecurrences
protected static void buildDailyRecurrences(java.util.Calendar currentDate, long duration, java.util.List<java.util.Date> dates, java.util.Map<java.lang.String,java.lang.String> params, java.util.Date onOrAfter, java.util.Date until, boolean firstOnly, int interval)
-
buildWeeklyRecurrences
protected static void buildWeeklyRecurrences(java.util.Calendar currentDate, long duration, java.util.List<java.util.Date> dates, java.util.Map<java.lang.String,java.lang.String> params, java.util.Date onOrAfter, java.util.Date until, boolean firstOnly, int interval)
-
buildMonthlyRecurrences
protected static void buildMonthlyRecurrences(java.util.Calendar currentDate, long duration, java.util.List<java.util.Date> dates, java.util.Map<java.lang.String,java.lang.String> params, java.util.Date onOrAfter, java.util.Date until, boolean firstOnly, int monthInterval)
-
buildYearlyRecurrences
protected static void buildYearlyRecurrences(java.util.Calendar currentDate, long duration, java.util.List<java.util.Date> dates, java.util.Map<java.lang.String,java.lang.String> params, java.util.Date onOrAfter, java.util.Date until, boolean firstOnly, int interval)
-
-