You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Temporal Expressions

The Apache Open For Business recurring events are based on Temporal Expressions - a design proposed by Martin Fowler: Recurring Events for Calendars (pdf). The design is extremely flexible and it allows for arbitrarily complex recurring events.

Overview

Each temporal expression could be considered a rule - like "every Monday" or "the 15th of the month." Temporal expressions can used alone or they can be combined in any of three collection expressions - Union, Intersection, and Difference. A date will match a Union collection if any of its member expressions match (logical OR). A date will match an Intersection collection if all of its member expressions match (logical AND). A date will match a Difference collection if it matches the included member expression and doesn't match the excluded member expression (logical AND NOT).

Some of the basic OFBiz temporal expressions are ranges - which simplifies expression creation. For example, if an event occurs every Monday, Tuesday, and Wednesday, you could create an expression for each day and make them members of a Union expression, or you could use a single Day Of Week Range expression that includes Monday through Wednesday.

Sometimes recurring events need to be rescheduled - like when they fall on a holiday, or when maintenance is being performed. The Substitution expression can be used to reschedule recurring events.

In the temporal expression definitions that follow, the expressions will be shown like this:

  Expression(parameter1, parameter2, ...)
  Collection:
    Member Expression(parameter1, parameter2, ...)
    Member Expression(parameter1, parameter2, ...)

Basic Expressions

Ranges

  MinuteRange(start, end)
  HourRange(start, end)
  DayOfWeekRange(start, end)
  DayOfMonthRange(start, end)
  MonthRange(start, end)
  DateRange(start, end)

Expression Collections

The Substitution Expression

  • No labels