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

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="" 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" />
     <fork name="split">
     <transition name="to moderator approval" to="moderator approval" />
     <transition name="to admin approval" to="admin approval" />
   <swimlane name="moderator">
      <assignment actor-id="#{['cm:userName']}" />
   <swimlane name="admin">
      <assignment actor-id="#{['cm:userName']}" />
   <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" />

   <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" />

   <end-state name="end" />

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(, 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(;  // 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