[
http://jira.jboss.com/jira/browse/JBPM-1144?page=comments#action_12401379 ]
thilker commented on JBPM-1144:
-------------------------------
Here is the description of the duedate-timer attribute:
"the duration (optionally expressed in business hours) that specifies the time period
between the creation of the timer and the execution of the timer. See Section 15.1,
"Duration" for the syntax."
So I thought in the workflowdefinition I'm only able to input a constant value for the
duedate. (e.g. "7 days").
But suppose, I want to send a report on the first day of the next month.
How can I formulate this in the workflow?
I found no solution.
So I customized the Class "CreateTimerAction".
And with the code above, I'm able to set the timer to the first day of the next
month.
Thanks in advance,
Thorsten
Calculate dates for timers
--------------------------
Key: JBPM-1144
URL:
http://jira.jboss.com/jira/browse/JBPM-1144
Project: JBoss jBPM
Issue Type: Feature Request
Components: Core Engine
Affects Versions: jBPM jPDL 3.2.2
Reporter: thilker
Assigned To: Tom Baeyens
Attachments: CreateTimerAction.java
I was facing the problem, that I'm not able to schedule calculated dates in a
workflow.
So I modified the class I send you a little bit.
Now I've two new possibilties.
1. I'm able to enter a absolute date in the workflow. (yyyy.MM.dd HH:mm:ss)
Ok, that's poor, I must confess. :)
2. But here is the power feature:
I'm calculating a certain date.
And store it in the Workflowcontext.
An example:
================================================================
public class InitProjektBeginnTimerHandler implements ActionHandler {
/**
* App Logger
*/
public final static Logger logger =
Logger.getLogger(InitProjektBeginnTimerHandler.class);
public void execute(ExecutionContext executionContext) throws Exception {
Projekt projekt = (Projekt) executionContext.getContextInstance()
.getVariable(WorkflowDAO.doKey);
int offset =
projekt.getTraeger().getMandant().getEinstellungen().getOffsetMonatsbericht();
Calendar dateForNextReport = new GregorianCalendar();
dateForNextReport.setTime(projekt.getBeginn());
dateForNextReport.set(Calendar.DAY_OF_MONTH, 1);
dateForNextReport.add(Calendar.MONTH, 1);
dateForNextReport.set(Calendar.DAY_OF_MONTH, offset);
executionContext.setVariable(MbEnum.Variable.DateForNextReport.name(),
dateForNextReport.getTime());
logger.info("Leaving node.");
executionContext.leaveNode();
}
}
===========================================================================
With my modifications in the class CreateTimerAction I'm able to assign the variable
to a timer by its name.
I choose the following pattern (variable name: "DateForNextReport") :
#{DateForNextReport}
I think this is a very powerful feature and will be appreciated by many other users.
What do you think?
Regards,
Thorsten
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira