1 2 Previous Next 17 Replies Latest reply on Dec 6, 2007 5:46 PM by kukeltje

    Improvig timer

    camunda

      Hi!

      I was at a customer last week and they implement an improved timer for themselves. And I saw that requirement already many times, normally it was solved by own written ActionHandler. But to have an advanced timer would be even nicer!

      I am not sure if it gets already more powerful with the PVM?

      Here the requirements: They want the timer to be due on some specific time on a certain day. The hacked the Calendar and can now configure the timer like this:

      <timer name="uniquetimername1" duedate="07.11.2007-17:32:00 timestamp" transition="toNextNodeAfterTimer"></timer>
      


      Maybe this can be easily improved to
      <timer name="xyz" duedate="today+1-17:32:00 timestamp" transition="whatever"></timer>
      


      with the new unit, they can just parse the duedate differently. This apporach is OK, but has the weekness, that it cannot really be combined with the business calender (e.g. 3 business days, but 09:00).

      If we can agree on a good format to support this, they would give me the appropriate code so I can commit it. But what format?

      I think best solution would be to add an attribute, so we get

      <timer name="xyz" duedate="1 business day" time-constraint=">19:00" date-constraint="=20.11.2007" transition="whatever"></timer>
      


      By the way: duedate and the new attributes should be able to read expression language.

      Thought?

        • 1. Re: Improvig timer

          Most probably a feature like a cron job definition would do the job resulting in something like:

          <timer name="uniquetimername1" repeat="* * 5" transition="nextNode"/>
          


          • 2. Re: Improvig timer
            tom.baeyens

            cool feature proposal. i would propose to add an attribute duedatetime with the following syntax:

            where
            duedatetime:= [day] space time

            day:= (relativeday | absoluteday)
            
            relativeday:= today (+|-) [0..9]* [business] day(s)
            
            absoluteday:= dd/mm/yyyy
            
            time:= HH:mm[:ss]
            
            


            (the date formats should be configurable in the businesscalendar.properties)

            i proposed a separate attribute to ease the distinction between the currently supported delay-based format and the new format parsing

            does that make sense ?

            no not yet. just realized that we need to separate between relative dates and times and absolute dates and times. so my proposal above is not good enough, but it shows the direction in which i want to think.

            if you want please, propose something more complete and clean.

            • 3. Re: Improvig timer
              brittm

              Like most folks, I guess, I've implemented an ActionHandler to dynamically modify due dates on tasks and timers. And like you mention Tom, there typically needs to be a dynamic date/time reference from the process instance as well as a static modifier...such as

              <timer name="xyz" baseDateTime="#{someJava.util.Date}" addDuration="1 business day"></timer>
              


              Use case: I have an established deadline for a customer install, and this task/timer needs to come due 1 business day ahead of that deadline...

              <timer name="xyz" baseDateTime="#{deadlineDate}" addDuration="-1 business day"></timer>
              

              or the same for a task...
              <task name="xyz" baseDateTime="#{deadlineDate}" addDuration="-1 business day" .../>


              -Britt

              • 4. Re: Improvig timer
                kukeltje

                why not something like

                <timer name="xyz" duedate="#{deadlineDate} - 1 business day"></timer>
                


                That can be implemented without any schemachanges!!! so could easily be done in version 3.3 (or even a 3.2.3)

                • 5. Re: Improvig timer
                  brittm

                  Ronald, I like it.

                  So then we would have a duedate attribute with one of the following:

                  1) EL expression
                  2) jBPM calendar duration with an optional operator (+/-)
                  3) or both separated by a +/- operator

                  Do you require the EL to evaluate to a java Date, java Calendar, String, or something else? Perhaps handling all three would be the right option.

                  -Britt

                  • 6. Re: Improvig timer
                    kukeltje

                    Handling all three would not be difficult.... I'll give it a try tonight. It's fairly simple in jBPM to change each attribute to accept an EL. Changing the subprocessname e.g. to accept an EL instead of a fixed string, that was 10 lines of code.

                    • 7. Re: Improvig timer
                      camunda

                      Yeah, would be a cool thing to have! I am quite interested in the results...

                      What's still missing is the time issue, so Ronalds proposal could be extended a bit:

                      <timer name="xyz" duedate="#{deadlineDate} - 1 business day AFTER 09:00"></timer>
                      


                      Or something like that... Let's see what the project team which needs it at the moments says...

                      But I also like the idea not to introduce new attributes, so no schema changes are required. This can may be done in jbpm 4!

                      By the way: britt, can you send me a short mail, I have a off forum question for you: bernd.ruecker@camunda.com

                      • 8. Re: Improvig timer
                        kukeltje

                        I just came home a little later than expected (1:20 insted of 10:00). So I won't be able to try something. But tomorrow I might. Now first some sleep.

                        • 9. Re: Improvig timer
                          tom.baeyens

                           

                          "kukeltje" wrote:
                          I just came home a little later than expected (1:20 insted of 10:00). So I won't be able to try something. But tomorrow I might. Now first some sleep.


                          you're getting old


                          :-)

                          • 10. Re: Improvig timer
                            kukeltje

                            please checkout cvs.... initial version checked in late last night (03:30, so not getting old..... ;-))

                            also some testcases but small issues remain (will make a jira issue for this tonight)

                            - Only date, no Calendar yet and String will never be suported by me (due toformatting things)
                            - a minus for an old style due date is now possible but leads to duedates in the past.... suggestion on how to handle these? e.g. throw an error
                            - only on timer, not on task due date yet
                            - not tested in combination with repeats

                            oh and btw...

                            - '65 years - 2 hours - 10 minutes' does not work nor with plusses. I did not know that
                            - duration does not take leapyears into account. +65 years does miss 16 days (in my case ;-)), but this was already the case and not caused by me (might even be a java issues)

                            • 11. Re: Improvig timer
                              tom.baeyens

                              great addition! thanks. can you add a brief description to the userguide about it ?

                              is there a jira issue for this ? make sure to set the fix version to 3.2.3. that way it will appear in the release notes.

                              if the resulting date is in the past, you can just ignore it without throwing an error.

                              • 12. Re: Improvig timer
                                tom.baeyens

                                 

                                "kukeltje" wrote:
                                (03:30, so not getting old..... ;-))


                                ah. that's more like it :-) ...even if you have to sleep till noon the day after :-)

                                • 13. Re: Improvig timer
                                  kukeltje

                                  Jira issue: http://jira.jboss.com/jira/browse/JBPM-1097

                                  I'll make another jira issue for the documentation..... and assign it to myself

                                  • 14. Re: Improvig timer
                                    kukeltje

                                    the jira issue was already there btw.... and once you know how to do it, it is fairly easy to add EL awareness to any jBPM attribute.

                                    And no, I did not sleep till noon, 08:30 I was on my way to work by motorbike

                                    1 2 Previous Next