A jBPM-Timer Is Not A jBPM-Timer In Relation To Alfresco
Today i was wondering about an unexpected behaviour in jBPM 3.2.2. Im accustomed to add a business time directly on workflowstart so i can set my variables in the processdefinition in the right manner. For instance:
<timer duedate="#{myDueDate}">
<action>...</action>
</timer>
And this was my AlfrescoCode:
workflowParameters.put("dueDate", "10 business days");
workflowService.startWorkflow(def.id, workflowParameters);
So it doesnt work at all using the Alfresco-Integration of jBPM. I thought im so stupid to forget all the bunch of jBPM-Peaces that i´ve compelled to fillin my head but this wasnt the point as i can see it by now after i wented home and reviewing the codings.
As Alfresco overrides and extends the CreateTimerAction of jBPM we dont calling it anymore “extening” rather than decreasing the amount of possibilities we can take from that Timer as the functionality were partly removed from the base-class (CreateTimerClass). This means in brief, that we can not using such a duration-format like ive mentioned above (10 business hours) as following lines occures at the point of concern where the Baseclass was able to fullfill this cool feature:
if (dueDateExpression.startsWith("#{")) {
Object result = JbpmExpressionEvaluator.evaluate(dueDateExpression, executionContext);
if (!(result instanceof Date)) {
throw new WorkflowException("duedate expression must evaluate to a date");
}
...
Here we going. We have to pass a ready to start date and you have to calulate out your relativly value being passed to that dueDate. But dont worry, as jBPM helps you alot with this part
Duration duration = new Duration("10 business hours");
dueDate = businessCalendar.add(new Date(), duration);
//and the start again
workflowParameters.put("dueDate", dueDate);
workflowService.startWorkflow(def.id, workflowParameters);
I hope i can write the next time very sooner as it is by now…
Comments
One Response to “A jBPM-Timer Is Not A jBPM-Timer In Relation To Alfresco”
Leave a Reply

Sebastian Wenzky works since october 09 as a ecm-consultant at Westernacher in Stuttgart. Alfresco, Spring, Hibernate, JBPM and - to much - coffee are now his companions. The corresponding company the right way to go.
Hi Sebastian,
About this interesting article I would thank you if you can publish or send me the files you modified, the jpdl, the action you used at workflowstart or any class you modified directly in Alfresco code.
email: kkholer@gmail.com
thanks in advance.