RecurringScheduleService.java

This file is the java class RecurringScheduleService , which contains the public java interface for the Recurring Schedules module. The following are the public methods in the class that are available for external use:

Method Description
List<Date> RecurringScheduleService.getDatesList(Date startDate, Date endDate, String ruleStr)

Generates and returns the XML string representation of the current recurrence schedule pattern displayed in the User Interface (UI). Store this string in any text field (minimum size of 96 characters) in any table that you wish. Do not parse or modify this string, as the format is internal to the Recurrence Schedules toolkit and subject to change.

This method returns a list of all the dates between startDate and endDate that satisfy the recurrence rule in ruleStr . The list includes startDate and/or endDate if they satisfy the recurrence rule. ruleStr is a recurrence rule in XML string format that was created by the javascript user interface, or by the getRecurrenceXMLPattern method.

You must first create a new instance of the RecurringScheduleService class and then invoke this method:

final RecurringScheduleService recurringService = new RecurringScheduleService();
final List<Date> dates = recurringService.getDatesList(dateStart, dateEnd, recurringRule);


The parameters dateStart , dateEnd , and recurringRule are typically stored and retrieved from your application’s tables in the database, or created ad-hoc from the module’s axvw interface and passed to java from your javascript code.

dateStart is optional, if its value is null, then the current date is used (Web Central server local time).

dateEnd is optional, if its value is null, then dateEnd is set to 5 years from dateStart (10 years if recurrence is yearly). The 5/10 limits can be changed, see the setSchedulingLimits method.

Note: RecurringScheduleService.getDatesList() does not support locale-related or timezone-related calculations or adjustments.

RecurringScheduleService. setRecurringSchedulePattern(Date startDate, Date endDate, String ruleStr) This method just sets up the recurring schedule pattern without calculating any dates. This gives you an opportunity to call other methods that retrieve information about the pattern, without having to compute any dates.
List<Date> RecurringScheduleService.getDatesList()

This method performs the same function as getDatesList(startDate, endDate, ruleStr) above, except it is meant to be called after you have used setRecurringSchedulePattern to set the pattern and the dates. For example:

final RecurringScheduleService recurringService = new RecurringScheduleService();
recurringService.setRecurringSchedulePattern (dateStart, dateEnd, recurringRule);
final List<Date> dates = recurringService.getDatesList();

String RecurringScheduleService.getRecurringRuleDescription (String ruleStr) Returns a localized readable description of the recurring pattern encoded in XML in ruleStr.
String RecurringScheduleService.getRecurringRuleDescription ()

Returns a localized readable description of the recurring pattern already set in the class. This method is meant to be called after you have used setRecurringSchedulePattern to set the pattern and the dates. For example:

final RecurringScheduleService recurringService = new RecurringScheduleService();
recurringService.setRecurringSchedulePattern (dateStart, dateEnd, recurringRule);
final String desc = recurringService.getRecurringRuleDescription();

RecurringScheduleService.setSchedulingLimits(int dayVal, int weekVal, int monthVal, int yearVal) Sets the scheduling limit in years for each recurring type. This only applies to a specific recurring schedule (i.e. class instance). A value of (-1) indicates no limit. However, the date generation code still enforces a limit of 999 maximum occurrences for all recurring types, regardless of the scheduling limit values set or the End Date. If you do not set any limits, the default limits in the application parameter AbCommonResources-RecurringSchedulingLimits are used. If the application parameter does not exist, then the default limits of 5, 5, 5, 10 years are used.
static String getRecurrenceXMLPattern(String recurringType, int interval, int totalOccurrences, String daysOfWeek, int dayOfMonth, int weekOfMonth, int monthOfYear)

Constructs and returns an XML recurring schedule pattern string from the given parameters:

  • recurringType : Recurrence type (‘once’, ‘day’, ‘week’, ‘month’, or ‘year’)
  • interval : Recurring interval number (i.e. Every x number of days/weeks/months/years)
  • totalOccurrences : Maximum occurrences (0 = not specified)
  • daysOfWeek : When recurringType is ‘week’, specify days of the week in comma delimited format (“mon,wed,sat”). When recurringType is ‘month’ or ‘year’, specify the day of the week as one of (“mon”, “tue”, “wed”, “thu”, “fri”, “sat”, “sun”, “day”, “weekday”, or “weekendday”)
  • dayOfMonth : Day of the month, valid values from 0 to 31, 0 = unspecified.
  • weekOfMonth : Week of the month, valid values from 0-5, 0=unspecified, 5=last.
  • monthOfYear : Month of the year, valid values from 0-12, 0 = unspecified.
  • getRecurrenceXMLPattern : static method that you can call without creating a new instance of the class, i.e. RecurringScheduleService:getRecurrenceXMLPattern(…)

String RecurringScheduleService.getRecurringType() Returns the recurrence type, using the same format as specified for the recurringType parameter in the getRecurrenceXMLPattern method.
String RecurringScheduleService.getInterval() Returns the recurrence interval, using the same format as specified for the interval parameter in the getRecurrenceXMLPattern method.
String RecurringScheduleService.getTotal() Returns the maximum number of occurrences, using the same format as specified for the totalOccurrences parameter in the getRecurrenceXMLPattern method.
String RecurringScheduleService.getDaysOfWeek() Returns the day(s) of the week, using the same format as specified for the daysOfWeek parameter in the getRecurrenceXMLPattern method.
String RecurringScheduleService.getDayOfMonth()

Returns the day of the month, using the same format as specified for the dayOfMonth parameter in the getRecurrenceXMLPattern method.

String RecurringScheduleService.getWeekOfMonth() Returns the week of the month, using the same format as specified for the weekOfMonth parameter in the getRecurrenceXMLPattern method.
String RecurringScheduleService.getMonthOfYear() Returns the month of the year, using the same format as specified for the monthOfYear parameter in the getRecurrenceXMLPattern method.

Application Parameter

AbCommonResources-RecurringSchedulingLimits

This application parameter stores the default scheduling limit in years for each recurring type. A value of (-1) indicates no limit. However, the date generation code still enforces a limit of 999 maximum occurrences for all recurring types, regardless of the scheduling limit values set or the End Date. The application parameter string value has the following format:

“day;5;week;5;month;5;year;10”

The recurrence type and limit value pairs can be in any order, and you can omit a type;value pair for any recurrence type. For example: “year;20;day;2” will change the default limits for yearly and daily patterns, but will leave the limits for weekly and monthly patterns at the built-in default of 5 years.