cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow Due Date

redomancer
Champ in-the-making
Champ in-the-making
How can be obtained workflow due date? And what is the Java analog of bpm_workflowDueDate?
At first I thought that TaskNode's Task objects will containt due dates (iterated using Iterator<Node> aNodeIterator = aProcessInstance.getProcessDefinition().getNodes().iterator():smileywink:, but they are null.
Then I thought that WorkflowInstance will contain it, but there are only startDate and endDate. So how can I access it?

Can somebody help?
4 REPLIES 4

cheffilet
Champ in-the-making
Champ in-the-making
It depends which way you´ll go to define your workflow: Normaly the timer-tag will be used to create an duedate.

This could be depicted as follows:


<task-node name="review_step">
    …
         <task name="mytask">
              ….
              <!– static example of time set, it should be used in variableResolving format like #{myVariable} being set as variable –>
              <timer duedate="4 business hours" repeat="1 business hour">
                  <action class="? extends JBPMSpringActionHandler">
                       … your variables here
                  </action>
              </timer>
              ….

SchedulerService does not implement such a method to retrieve all timers or even a particular timer. I would suggest to set up this manually within a task-node or some other person in this forum know it better Smiley Happy
You should add some

redomancer
Champ in-the-making
Champ in-the-making
What I am doing and why I need to access due date from Java code.
When I want to start the workflow, form wizard contains "due date". If I specify "due date", does it mean that timer is created automaticaly?

The next thing what I see in my workflow are lines in first task "task-create" event.
            <script>
               if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
               if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
            </script>
So, this means that somewhere bpm_workflowDueDate is stored as here I am assigning it to task. I want to get bpm_workflowDueDate from java as
workflow process definition file at beggining I have

   <event type="process-start">
      <action name="prepareWorkflow" class="org.dta.WorkflowExtender"></action>
       </event>
   <swimlane name="initiator" />

and I am programmaticaly creating new items and binding to current nodes(notification events, timers, etc). When I am creating timer from my class org.dta.WorkflowExtender, I have to specify due date and here comes the problem - I cant find it.
What I did - in my code I iterated all nodes and checked TaskNode and their tasks due dates. They are null. So this means that the due date what I entered in workflow wizard form is located somewhere else. Where? And how to read the value? Is there a timer created and I have to search for it?

redomancer
Champ in-the-making
Champ in-the-making
Ok, made a little research and I think a am one step closer to solution. The due date as I understand is located in StartState type (according to http://wiki.alfresco.com/wiki/BaseWorkflow.xml - bpm:startTask has property bpm:workflowDueDate) as my type is extending bpm:startTask.

StartState definition:

<start-state name="Start">
  <task name="scwf:submitReviewTask" swimlane="initiator" />
  <transition to="Submit"></transition>
</start-state>

Type:

<type name="scwf:submitReviewTask">      
   <parent>bpm:startTask</parent>
   <properties>
      <property name="scwf:notifyMe">
         <type>d:boolean</type>
         <default>true</default>
      </property>
   </properties>
</type>

I can find start state with:

ProcessInstance aProcessInstance = anExecutionContext.getProcessInstance();
StartState aStartState = (StartState)aProcessInstance.getProcessDefinition().getStartState();            

But how to access StartState properties?

jayjayecl
Confirmed Champ
Confirmed Champ
You can access the dueDate at anytime using executionContext.getVariable("bpm_dueDate");