9 Replies Latest reply on Apr 20, 2006 12:29 PM by cwad0000

    how to use duedate? (in a task, NOT timer)

    cwad0000

      if I have a task-node like this, how can I trigger a call to a class when the duedate is passed?
      I couldnt find any information about that. is there an event that is triggered?

      <task-node name="approve">
       <task swimlane="manager" duedate='120 seconds'>
       <controller>
       <variable name="approved"/>
       </controller>
       <event type='task-end'>
       <action class='some.class'>
       </action>
       </event>
       </task>
       <transition name="finished" to="approved?"></transition>
      </task-node>
      


        • 1. Re: how to use duedate? (in a task, NOT timer)
          fptoth

          Hi,

          The websale example does exactly this in one of its nodes:

          <task-node name="evaluate web order">
           <task swimlane="salesman">
           <timer duedate="20 seconds" repeat="10 seconds">
           <action class="org.jbpm.websale.RemindActor">
           <swimlaneName>salesman</swimlaneName>
           </action>
           </timer>
           <controller>
           <variable name="item" access="read"/>
           <variable name="quantity" access="read"/>
           <variable name="address" access="read"/>
           <variable name="comment"/>
           </controller>
           </task>
           <transition name="ok" to="salefork" />
           <transition name="more info needed" to="fix web order data" />
           </task-node>
          


          See jbpm/src/process.examples/websale.par/processdefinition.xml

          The code for RemindActor is also there.

          Fred


          • 2. Re: how to use duedate? (in a task, NOT timer)
            cwad0000

            Thanks, but I do NOT want to use the timer functionality, I want to use the duedate on the task as I had in my example.

            That will set the due date in jbpm_taskinstance, but I cannot find any documentation how that due date is used.
            I would expect that some kind of event is thrown, but I cannot find any information about it.

            • 3. Re: how to use duedate? (in a task, NOT timer)
              fptoth

              Hi,

              Sorry, I missed that in your first post.

              I am curious (I'm a beginner) as to why a timer wouldn't work for you.

              Thanks,

              Fred

              • 4. Re: how to use duedate? (in a task, NOT timer)
                cwad0000

                I want to be able to extract the information for each task, when it was created/started/when it is due
                (to be able to show this information in a todo list for the user and as overall information for managers, e.g. highlight all tasks where the due date is overdue etc)

                In the jbpm_taskinstance I have all this info, which would mean that I wouldnt have to lookup the timers (which I think will be a pain, if I am wrong, please provide any pointers how it could be done).
                Unfortunately I cannot find a single example that actually uses the due date in a taskinstance.

                Is this duedate deprecated? I would be thankful for any information.

                • 5. Re: how to use duedate? (in a task, NOT timer)
                  kukeltje

                  isn't there anything in the testcases?

                  Ronald

                  • 6. Re: how to use duedate? (in a task, NOT timer)
                    michaelholtzman

                    You specify the due date in the process definition as a duration (e.g., "2 hours"), and when the task instance is created it converts it to the actual date/time. You can use TaskInstance.getDueDate() to retrieve the calculated date.

                    • 7. Re: how to use duedate? (in a task, NOT timer)
                      aguizar

                      The following event types are supported by jBPM:
                      task-create
                      task-assign
                      task-start
                      task-end
                      There is no task-due event. Unlike the events above, firing a task-due event would require interaction with the scheduler. Some time ago I wrote a quick and dirty patch to support a task-due event, but did not integrate it into the main jBPM codebase because there are other ways to get the same effect (e.g. a timer on the task). In fact, my solution sets up a timer internally.

                      "cwad0000", would that do the job for you? If so, please file a feature request in our issue tracking system and assign it to me.

                      • 8. Re: how to use duedate? (in a task, NOT timer)
                        michaelholtzman

                        That's exactly what I am doing.

                        I am inserting the due date (duration) in the process definition as BOTH the task instance due date AND the expriration time on a timer on the task. The absolute due date (i.e., a real date) shows in the UI and my task fires when the due date expires.

                        • 9. Re: how to use duedate? (in a task, NOT timer)
                          cwad0000

                          ah, thanks folks for clearing it up.

                          The trick with adding both a timer and due date seems to serve the purpose fine for me, many thanks for that.