-
1. Re: How to set the timer duedate dynamicly
kukeltje Oct 25, 2007 10:00 AM (in response to abdelak01)Correct, the timer does not accept EL. File a jira issue if you want this to happen. Not sure if and when it will be implemented.
-
2. Re: How to set the timer duedate dynamicly
koen.aers Oct 26, 2007 4:30 AM (in response to abdelak01)By the way, you can always work around the issue by changing the timer due date programmatically in an action.
Regards,
Koen -
3. Re: How to set the timer duedate dynamicly
abdelak01 Oct 26, 2007 4:44 AM (in response to abdelak01)thanks for your answer, I solved the problem by using an action to update the timer due date .
here is the action..... public class UpdatingTimerActionHandler implements ActionHandler { private static final long serialVersionUID = 1L; /** * update */ public void execute(ExecutionContext context) throws Exception { System.out .println("start timer updating"); String timerName = "actionTimer"; String delay = context.getContextInstance().getVariable("action_delay").toString(); //System.out.println("new delay : "+ delay); if (delay!=null && !delay.equals("")){ try{ SchedulerSession schedulerSession = context.getJbpmContext().getSchedulerSession(); Duration duration = new Duration(delay); Date newDueDate = new BusinessCalendar().add(new Date(), duration); List timers = schedulerSession.findTimersByName(timerName, context.getToken()); for(Object o : timers) { Timer timer = (Timer)o; log.info("Timer '" + timer.getName() + "' due date is " + timer.getDueDate()); try{ timer.setDueDate(newDueDate); }catch(Exception e) { throw new Exception("Timer '" + timer.getName() + "' due date was not updated to " + newDueDate + "': " + e); } schedulerSession.saveTimer(timer); log.info("Timer '" + timer.getName() + "' due date updated to " + timer.getDueDate()); } } catch(Exception ex){ ex.printStackTrace(); } } System.out .println("finish timer updating"); } public Log log = LogFactory.getLog(this.getClass()); }
thanks again -
4. Re: How to set the timer duedate dynamicly
dleerob Oct 26, 2007 9:00 AM (in response to abdelak01)Great, thanks for posting your solution. I'm sure it will come in handy...
-
5. Re: How to set the timer duedate dynamicly
mbaker Oct 26, 2007 10:46 AM (in response to abdelak01)Hi,
I'm afraid your code will not work with jBPM 3.2, but i'm currently looking for a solution to set the duedate in an ActionHandler with Version 3.2. Does anybody know a way to do that? In the forum I only found solutions for older jBPM Versions and I couldn't get it work by trying out either.
Thank you very much for any hints.