This content has been marked as final.
Show 3 replies
-
1. Re: Locating timers from process instance
pcuvecle Jun 21, 2007 4:32 AM (in response to arshadnj)Anyone found the answer to this ?
I have a similar requirement since we need to be able to update a timer that was declared in the process definition (let 's say that the process definition declared 10 business days and that we need, for a business reason, to extend this duration with 5 more additional days)
We are using jBPM 3.1.2 -
2. Re: Locating timers from process instance
jorges38 Jun 21, 2007 10:43 AM (in response to arshadnj)I also have the same need to create a timer dynamically to overwrite the timer create at the process definition..
Could I use actions within a task instance to create timer for that task? or even lookup independent tables to control priority, for example, if the task is urgente..timer should be set to 1 day, if not urgente..the timer would be set to 3 days.... -
3. Re: Locating timers from process instance
cristian_e Jun 21, 2007 7:07 PM (in response to arshadnj)"jorges38" wrote:
I also have the same need to create a timer dynamically to overwrite the timer create at the process definition..
Could I use actions within a task instance to create timer for that task? or even lookup independent tables to control priority, for example, if the task is urgente..timer should be set to 1 day, if not urgente..the timer would be set to 3 days....
It is possible to create a timer dinamically in an ActionHandler. We wrote this method to do this:public static void createTimer(TaskInstance ti, String name, Date duedate, String actionName) { Token tk=ti.getToken(); Timer timer=new Timer(tk); timer.setName(name); timer.setDueDate(duedate); timer.setAction(tk.getProcessInstance() .getProcessDefinition() .getAction(actionName)); timer.setGraphElement(ti.getTask().getTaskNode()); timer.setTaskInstance(ti); DbSchedulerService schedulerServ=new DbSchedulerService(); schedulerServ.createTimer(timer); }
The key is the use of the DbSchedulerService to register the Timer and actually getting it to work. The idea, of course, is that you can get the duedate from wherever you need.
Finally, about how to get a processinstance's timers, you can always build your own HQL query to get them. Look for the hibernate.queries.hbm.xml file inside the jbpm bundle to have an example of this.
Hope this helps.