[ 
https://issues.apache.org/jira/browse/OFBIZ-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630717#action_12630717
 ] 

Adrian Crum commented on OFBIZ-1956:
------------------------------------

As was discussed on the dev mailing list...

The proposed recurrence system is based
on a design proposed by Martin Fowler -
http://martinfowler.com/apsupp/recurring.pdf. His design is quite old,
so I updated it to support internationalization and I expanded it.

The design is extremely flexible and it allows for arbitrarily complex
recurring events. The design is based on temporal expressions. 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 expressions match
(logical OR). A date will match an Intersection collection if all of its
expressions match (logical AND). A date will match a Difference
collection if it matches the "included" expression and doesn't match the
"excluded" expression.

Using Bilgin's Happy Hour promotion as an example:

Intersection
   DayOfWeekRange(Monday, Friday)
   TimeOfDayRange(15:00, 17:00)

Let's say we want to exclude St. Patrick's Day from the Happy Hour
promotion:

Difference
   Include
     Intersection
       DayOfWeekRange(Monday, Friday)
       TimeOfDayRange(15:00, 17:00)
   Exclude
     Intersection
       MonthRange(March, March)
       DayOfMonthRange(17, 17)

A semi-monthly payday:

Union
   DayOfMonthRange(1, 1)
   DayOfMonthRange(15, 15)

Labor Day (US):

Intersection
   MonthRange(September, September)
   DayInMonth(Monday, 1)

A schedule is made up of schedule items. Each schedule item "points to"
a temporal expression. It also has duration information, and an item
type ID (meeting, appointment, etc).

Schedules can be linked to parties/facilities/fixed assets through
relationship entities.

The implementation requires four new entities. I picture this being introduced 
in the framework and we can gradually migrate the existing recurrence code over 
to it. In addition, I
could write a conversion routine to convert the existing Recurrence*
entities over to the new ones.


> Improved Recurring Events
> -------------------------
>
>                 Key: OFBIZ-1956
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1956
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Adrian Crum
>            Priority: Minor
>
> Come up with an improved recurring event implementation. Details in comments.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to