1 2 Previous Next 24 Replies Latest reply on Jul 31, 2009 3:24 AM by François LE QUEMENER

    task due date

    François LE QUEMENER Newbie

      Hi,
      I'm trying to set a due date to a task, so that when the due date happends, the task ends and one transition is taken.

      Here is what I tried :

      Collection<TaskInstance> tasks = processInstance.getTaskMgmtInstance().getTaskInstances();
       for (TaskInstance taskInstance : tasks) {
       if(taskInstance.getName().equals("valider_demande"))
       {
       taskInstance.setDueDate(demande.getAbsenceDateDebut());
       jbpmContext.save(taskInstance);
       }
       }


      Nothing happens when the due date expires, so I wonder how to make it work...

      Thanks

        • 1. Re: task due date
          Ronald van Kuijk Master

          No, the duedate on the task is noting more than an indication of when it should end. If you want to take a transition on that date, add a timer with a transition and a duedate of the timer that is identical to the duedate on the task.

          • 2. Re: task due date
            François LE QUEMENER Newbie

            Ok, but I saw somewhere a while ago that I could not change the timer value dynamically. Is it true?

            If not, how can I retrieve and change the timer? I don't see anything in the TaskInstance class to do so.

            • 3. Re: task due date
              Ronald van Kuijk Master

              retrieving is possible via the api in a kind of complex way (not sure via which calls, Eclipse could help out with codecompletion and trial/error ;-).

              Changing is another story. The EL is evaluated when the timer is created so that does not much. For 3 there have been discussions in the forum. Please use google to search for them. If I remember some had it working, but others didn't. I solved it once by really moddeling this in the process (cancel an existing task and creating a new one with a new duedate)

              • 4. Re: task due date
                François LE QUEMENER Newbie

                I noticed the class CreateTimerAction, which has a setDueDate. Do I have to use this?
                Here is what I guess :
                create a CreateTimerAction
                Timer timer = CreateTimerAction.createTimer
                What do I do of this Timer?!

                BTW, is the Javadoc going to be completed? It's sometimes hard to browse into it, lot's of comments are missing.

                • 5. Re: task due date
                  Ronald van Kuijk Master

                  for 3: no, for 4 certainly

                  • 6. Re: task due date
                    François LE QUEMENER Newbie

                    Hum, just to try, I added a timer with a fixed due date value (1 minute). It does nothing, and nothing in the logs too...
                    I wonder if my schedule engine is running, allthough I configured my web.xml and jbpm.cfg.xml.

                    • 7. Re: task due date
                      Tej jbpm Novice

                      Check your processdefinition xml file whether timer is set..i had few issues with the timer when i updated the JPDL but xml was not reflecting the changes..

                      It should have

                      <reminder duedate="1 minute" repeat="yes"/>


                      • 8. Re: task due date
                        François LE QUEMENER Newbie

                        The XML changed, but I d'ont have anything with reminder, but :

                        <task-node name="valider_demande">
                         <description>
                         Le valideur doit valider ouy refuser manuellement la demande émise
                         </description>
                         <task name="valider_demande">
                         <description>
                         Le valideur doit valider ou refuser la demande de congé effectuée par le collaborateur. Si, lorsque la demande débute, le valideur n'a pas pris de décision, elle est automatiquement validée.
                         </description>
                         <assignment class="logica.actions.ValideurAssignmentHandler"></assignment>
                         <controller class="logica.actions.EndTaskControllerHandler"></controller>
                         </task>
                         <timer duedate="1 minute" name="waitForApproval" transition="validee">
                         <script name="alert">
                         System.out.println("trop tard : validee !");
                         </script>
                         </timer>
                         <transition to="notifier_acceptation" name="validee"></transition>
                         <transition to="notifier_refus" name="refusee"></transition>
                         </task-node>


                        • 9. Re: task due date
                          Tej jbpm Novice

                          which version of jbpm are you usng? my example was jbpm 3.

                          • 11. Re: task due date
                            Tej jbpm Novice

                            Could you try this..update the process definition xml:

                            Delete this:

                            <timer duedate="1 minute" name="waitForApproval" transition="validee">
                             <script name="alert">
                             System.out.println("trop tard : validee !");
                             </script>
                             </timer>


                            Try this:
                            <task-node name="valider_demande">
                             <description>
                             Le valideur doit valider ouy refuser manuellement la demande émise
                             </description>
                             <task name="valider_demande">
                             <description>
                             Le valideur doit valider ou refuser la demande de congé effectuée par le collaborateur. Si, lorsque la demande débute, le valideur n'a pas pris de décision, elle est automatiquement validée.
                             </description>
                             <assignment class="logica.actions.ValideurAssignmentHandler"></assignment>
                             <controller class="logica.actions.EndTaskControllerHandler"></controller>
                             <reminder duedate="20 seconds" repeat="yes"/>
                             </task>
                            
                             <transition to="notifier_acceptation" name="validee"></transition>
                             <transition to="notifier_refus" name="refusee"></transition>
                             </task-node>


                            • 12. Re: task due date
                              François LE QUEMENER Newbie

                              Nothing happens. Exactly as is there was no scheduler running...

                              • 13. Re: task due date
                                Tej jbpm Novice

                                Is your email configuration working? Are you setting the host details in the jbpm cfg correctly..

                                This should work perfectly..if not..then it is definitely your config issue..check whether they are valid..

                                • 14. Re: task due date
                                  François LE QUEMENER Newbie

                                  My emails are working perfectly. Here is the interesting part of my config :

                                  jbpm.cfg.xml :

                                  <jbpm-context>
                                   <service name='persistence' factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />
                                   <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
                                   <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
                                  
                                   <!-- Async nodes -->
                                   <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
                                  
                                   <!-- Process logging, in jbpm_log table -->
                                   <service name='logging' factory='org.jbpm.logging.db.DbLoggingServiceFactory' />
                                  
                                   </jbpm-context>


                                  web.xml :
                                  <!-- This servlet serves the purpose of executing pending timer jobs. -->
                                   <!-- JbpmJobExecutorServlet BEGIN -->
                                   <servlet>
                                   <servlet-name>JobExecutorServlet</servlet-name>
                                   <servlet-class>org.jbpm.job.executor.JobExecutorServlet</servlet-class>
                                   <load-on-startup>1</load-on-startup>
                                   </servlet>
                                   <servlet-mapping>
                                   <servlet-name>JobExecutorServlet</servlet-name>
                                   <url-pattern>/jobs</url-pattern>
                                   </servlet-mapping>
                                   <!-- JbpmJobExecutorServlet END -->


                                  1 2 Previous Next