AnsweredAssumed Answered

Simple merge and workflow end

Question asked by mickael_istria on Aug 1, 2008
Latest reply on Aug 4, 2008 by mickael_istria
Hello,

I have a workflow with 2 branches that can reach the "end-state". Indeed, I want this workflow to end when any of both branches reach end. However, when I validate an action on one of those branches, on the transition sending to the end, the workflow instance is not marked as ended. (I hope this desciption is clear enough…)

Here is the process definition of my workflow:


<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="ipwf:moderatorSubmissionWorkflow">
   
   <swimlane name="submitter" />
   <start-state name="start">
      <task name="ipwf:submitModification" swimlane="submitter" />
      <transition name="" to="split">
         <action class="fr.openwide.gwt.alfresco.server.workflow.ModeratorSubmissionWorkflowAction" />
      </transition>
   </start-state>
   
     <fork name="split">
     <transition name="to moderator approval" to="moderator approval" />
     <transition name="to admin approval" to="admin approval" />
     </fork>
   
   <swimlane name="moderator">
      <assignment actor-id="#{ipwf_moderator.properties['cm:userName']}" />
   </swimlane>
   <swimlane name="admin">
      <assignment actor-id="#{ipwf_administrator.properties['cm:userName']}" />
   </swimlane>
   
   <task-node name="moderator approval">
      <task name="ipwf:moderatorApprobation" swimlane="moderator" />
      <transition name="modoApprovedOrRefused" to="end" >
         <action class="fr.openwide.gwt.alfresco.server.workflow.ModeratorApprovalWorkflowAction" />
      </transition>
   </task-node>

   <task-node name="admin approval" >
      <task name="ipwf:administratorApprobation" swimlane="admin" />
      <transition name="adminApprovedOrRefused" to="end" >
         <action class="fr.openwide.gwt.alfresco.server.workflow.AdministratorApprovalWorkflowAction" />
      </transition>
   </task-node>

   <end-state name="end" />
</process-definition>

And here is the code I use to use it:


// prepare nodes, properties & co…
// In this example, user with name in "authority" has the role of moderator and administrator
      WorkflowDefinition workflowDef = workflowService.getDefinitionByName(…);
      workflowService.startWorkflow(workflowDef.id, properties);
      
      List<String> newTasksId = getNewTasks(authority, beforeTasks); // returns the list of tasks "IN PROGRESS" created by this workflow
      
      workflowService.endTask(newTasksId.get(0), null); // ends start-task
      newTasksId = getNewTasks(authority, beforeTasks);  // get lastly created "IN PROGRESS" tasks
      // Task for moderator and admin (that are the same person in that test)
      assertEquals(2, newTasksId.size());   // OK, tasks are the one I expect

      workflowService.endTask(newTasksId.get(0), null);  // Complete one of those tasks
      // Then the workflow should be ended
      WorkflowTask otherTask = workflowService.getTaskById(newTasksId.get(1));
      assertFalse(otherTask.path.instance.active);  // Error: workflow instance is still active (endDate still null)
      assertEquals(WorkflowTaskState.IN_PROGESS, otherTask.state); // Error: other task is still IN_PROGRESS whereas the first one should have reached the end

Does anyone have any clue on this behavior?
Does the problem come from the way I designed my workflow, or is there another way to check whether end-state has been reached?

Thanks in advance
Mickael

Outcomes