[jira] Created: (OFBIZ-1956) Improved Recurring Events

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
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 | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)

    [ 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 | Threaded
Open this post in threaded view
|

[jira] Issue Comment Edited: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

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

[hidden email] edited comment on OFBIZ-1956 at 9/12/08 5:19 PM:
-------------------------------------------------------------

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.


      was (Author: [hidden email]):
    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 | Threaded
Open this post in threaded view
|

Re: [jira] Issue Comment Edited: (OFBIZ-1956) Improved Recurring Events

Scott Gray
As I've mentioned before, edited comments are a PITA.  I took the time
to read Adrian's initial comment only to find the next email in my
inbox was the one below but I have no way of knowing what was changed.

Everyone, whenever possible please avoid editing comments and just
post a new correcting comment instead.

Thanks
Scott

2008/9/13 Adrian Crum (JIRA) <[hidden email]>:

>
>    [ https://issues.apache.org/jira/browse/OFBIZ-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630717#action_12630717 ]
>
> [hidden email] edited comment on OFBIZ-1956 at 9/12/08 5:19 PM:
> -------------------------------------------------------------
>
> 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.
>
>
>      was (Author: [hidden email]):
>    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 | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adrian Crum updated OFBIZ-1956:
-------------------------------

    Attachment: Calendar.patch

The attached patch is an implementation of the proposed recurring events. It was taken from my local copy and moved to the common component.

I included some demo data and a demo in the example component. Just run ant run-install and go the the Example main page. You will see the demo schedule for the 2008 year.


> 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
>         Attachments: Calendar.patch
>
>
> 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 | Threaded
Open this post in threaded view
|

Re: [jira] Issue Comment Edited: (OFBIZ-1956) Improved Recurring Events

Adrian Crum-2
In reply to this post by Scott Gray
Sorry Scott. After I saved the comment, Jira reformatted the text - making it hard to read. So, I had to edit it to get the formatting back.

-Adrian


--- On Fri, 9/12/08, Scott Gray <[hidden email]> wrote:

> From: Scott Gray <[hidden email]>
> Subject: Re: [jira] Issue Comment Edited: (OFBIZ-1956) Improved Recurring Events
> To: [hidden email]
> Date: Friday, September 12, 2008, 5:32 PM
> As I've mentioned before, edited comments are a PITA.  I
> took the time
> to read Adrian's initial comment only to find the next
> email in my
> inbox was the one below but I have no way of knowing what
> was changed.
>
> Everyone, whenever possible please avoid editing comments
> and just
> post a new correcting comment instead.
>
> Thanks
> Scott
>
> 2008/9/13 Adrian Crum (JIRA) <[hidden email]>:
> >
> >    [
> https://issues.apache.org/jira/browse/OFBIZ-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630717#action_12630717
> ]
> >
> > [hidden email] edited comment on OFBIZ-1956 at
> 9/12/08 5:19 PM:
> >
> -------------------------------------------------------------
> >
> > 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.
> >
> >
> >      was (Author: [hidden email]):
> >    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 | Threaded
Open this post in threaded view
|

Re: [jira] Issue Comment Edited: (OFBIZ-1956) Improved Recurring Events

Scott Gray
Ah I see, no worries and thanks for explaining, wasn't directed at you
so much just a general rant about editing comments :-)

Regards
Scott

2008/9/13 Adrian Crum <[hidden email]>:

> Sorry Scott. After I saved the comment, Jira reformatted the text - making it hard to read. So, I had to edit it to get the formatting back.
>
> -Adrian
>
>
> --- On Fri, 9/12/08, Scott Gray <[hidden email]> wrote:
>
>> From: Scott Gray <[hidden email]>
>> Subject: Re: [jira] Issue Comment Edited: (OFBIZ-1956) Improved Recurring Events
>> To: [hidden email]
>> Date: Friday, September 12, 2008, 5:32 PM
>> As I've mentioned before, edited comments are a PITA.  I
>> took the time
>> to read Adrian's initial comment only to find the next
>> email in my
>> inbox was the one below but I have no way of knowing what
>> was changed.
>>
>> Everyone, whenever possible please avoid editing comments
>> and just
>> post a new correcting comment instead.
>>
>> Thanks
>> Scott
>>
>> 2008/9/13 Adrian Crum (JIRA) <[hidden email]>:
>> >
>> >    [
>> https://issues.apache.org/jira/browse/OFBIZ-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630717#action_12630717
>> ]
>> >
>> > [hidden email] edited comment on OFBIZ-1956 at
>> 9/12/08 5:19 PM:
>> >
>> -------------------------------------------------------------
>> >
>> > 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.
>> >
>> >
>> >      was (Author: [hidden email]):
>> >    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 | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

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

David E. Jones commented on OFBIZ-1956:
---------------------------------------

This is a great proof of concept Adrian, and I like the concept. I like how you've taken the concepts from the expression language and created a relational data structure. It's also nice that while an expression can be built up of sub-expressions and that any level of the expression can be referenced to determine if a time or time range intersects with the temporal expression.

On a more important note, and why I called this a "proof of concept" is that the data structure don't tie back into anything in OFBiz yet. We need something more generic than a "schedule" because ideally this would tie into other event-like things such as a WorkEffort or JobSandbox record. Have you started looking at that yet? I'm thinking that the WorkEffort or JobSandbox could just point to a TemporalExpression instead of a RecurrenceRule, and there isn't really a need for the Schedule entity. And actually with the heavy overlap between Schedule and WorkEffort I think Schedule is fine for a PoC but shouldn't be actually added to the project (I don't know if that was your intent or not, I'm just expressing that).




> 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
>         Attachments: Calendar.patch
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

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

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

David,

Thank you very much for taking the time to look at this!

You are correct - the patch is not tied to anything else in the framework. That is because I didn't know if there would be any interest in it, so I didn't do any additional development work.

I pictured this patch being tied into the framework exactly as you described. I disagree with you about not needing the schedule however. I believe it can be used with WorkEffort to compose a calendar (that's what I did on my local copy).


> 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
>         Attachments: Calendar.patch
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adrian Crum updated OFBIZ-1956:
-------------------------------

    Attachment: Calendar.patch

Improved patch - code cleanups, added JavaDocs.


> 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
>         Attachments: Calendar.patch, Calendar.patch
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adrian Crum updated OFBIZ-1956:
-------------------------------

    Attachment: Calendar.patch

Updated patch - job scheduler now uses TemporalExpressions in addition to RecurrenceInfos.


> 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
>         Attachments: Calendar.patch, Calendar.patch, Calendar.patch
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

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

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

Getting back to the WorkEffort subject...

From my perspective, a WorkEffort is an *actionable* item - something that involves some kind of action or activity. On the other hand, a schedule is a collection of events that occur on certain dates - and those events might not require any action.

Let's take the US observance of Valentine's Day as an example. It might appear on a schedule (February 14) but whether or not a WorkEffort is involved depends upon my personal relationship status - if I'm attached to someone else I need to buy flowers and candy, otherwise no action is needed.

The approach I took was to picture a WorkEffort as a potential ScheduleItem instance. If the ScheduleItem is acted upon, then a corresponding WorkEffort is generated.


> 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
>         Attachments: Calendar.patch, Calendar.patch, Calendar.patch
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

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

Jacques Le Roux commented on OFBIZ-1956:
----------------------------------------

Just finished to read this interesting Martin Fowler's article.

On this issue It seems  to me that Adrian expresses a good point in the comment above.

I noticed that Martin pointed out some interesting unfinished possibilities at the end of this arcticle. One of them is to define working days. I wonder if we already have such a concept in OFBiz ? To avoid clashes also could be helpful in a schedule...

Thanks for the reading !

My 2 cents

> 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
>         Attachments: Calendar.patch, Calendar.patch, Calendar.patch
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

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

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

Jacques,

The demo has a work schedule.

> 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
>         Attachments: Calendar.patch, Calendar.patch, Calendar.patch
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

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

Jacques Le Roux commented on OFBIZ-1956:
----------------------------------------

Please Adrian, could you elaborate a bit more "The demo has a work schedule." ? Is it related to my question.suggestion ? Do you mean that I should try it to understand (I must admit I did not review the 108kb patch yet ;o) ?

Thanks

> 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
>         Attachments: Calendar.patch, Calendar.patch, Calendar.patch
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

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

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

Jacques,

If you run the demo, you will see a work schedule displayed. It has a schedule item type of WORK, and each workday has a duration. Unless Mr. Fowler had something else in mind, I believe that handles the requirement.

In my previous comment I got the SchedduleItem/WorkEffort relationship backwards (something I commonly do). I should have said I picture a ScheduleItem as a potential WorkEffort instance.


> 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
>         Attachments: Calendar.patch, Calendar.patch, Calendar.patch
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adrian Crum updated OFBIZ-1956:
-------------------------------

    Attachment: Calendar.patch

Improved patch.

The Difference expression now includes a substitution - so if a date matches the excluded expression, a substitute date will be returned.

See the DEMO_APPOINTMENT expression in the demo data and the HAIRCUT schedule in the Example component.



> 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
>         Attachments: Calendar.patch, Calendar.patch, Calendar.patch, Calendar.patch
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

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

David E. Jones commented on OFBIZ-1956:
---------------------------------------

Adrian, you wrote: "From my perspective, a WorkEffort is an *actionable* item - something that involves some kind of action or activity. On the other hand, a schedule is a collection of events that occur on certain dates - and those events might not require any action."

This is an incorrect statement that limits the intent of the WorkEffort entity more than is intended in its design. In other words, WorkEffort IS meant to have general calendar information in the form of any calendar event (ie an iCal/vCal type of thing) or any task or project or so on. Part of the reason for this is that more complex events and tasks don't fit nicely into one category or the other and are really a combination of both. Still, that doesn't mean we want a totally different entity for complex versus simple events or tasks.

To push this further, and to answer Jacques' question: the WorkEffort entity is already designed to handle work schedules using the WorkEffortType "Available" (ID: AVAILABLE).

I hope that clears things up. Again I really don't see any reason to have a schedule that is separate from the WorkEffort entity.

> 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
>         Attachments: Calendar.patch, Calendar.patch, Calendar.patch, Calendar.patch
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

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

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

David,

Thank you for the clarification. Once I finish testing this, I will commit the temporal expressions and the job sandbox changes - leaving out the schedule portion.


> 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
>         Attachments: Calendar.patch, Calendar.patch, Calendar.patch, Calendar.patch
>
>
> 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 | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1956) Improved Recurring Events

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

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

David E. Jones commented on OFBIZ-1956:
---------------------------------------

That sounds like a good plan to me... but seriously don't let me push you over. If you think another approach would work better let's discuss it by all means.

BTW, the Schedule/ScheduleItem relationship can be implemented similarly with 2 WorkEfforts and a WorkEffortAssoc (a bit more generic of a structure than an explicit master/detail relationship, but it works along with many other similar concepts that aren't so well defined as well).

> 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
>         Attachments: Calendar.patch, Calendar.patch, Calendar.patch, Calendar.patch
>
>
> 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.

12