cancel
Showing results for 
Search instead for 
Did you mean: 

Looping back to earlier task through exclusive gate in Simple activiti workflow

vgaur
Confirmed Champ
Confirmed Champ
Hi,
I am trying to create a simple workflow using tabular view.  The workflow will look like this :

                 ———————-
              |                        |
             \/                        |
Start-> UserTask1 - >UserTask2 -> <Exclusive> ->End



I don't see any method in WorkflowDefinition or in ChoiceStepsDefinition to refer to old task.
What I tried was

new WorkflowDefinition().name("TestFlow")
            .description("This is a test workflow").addHumanStep("UserTask1","UserTask1", "")
            .addHumanStep("UserTask2","UserTask2", "").inChoice().inList()
            .addCondition("isRejeted", "", "").addHumanStep("UserTask1", "UserTask1","").endList()
            .endChoice();


And Also tried

      HumanStepDefinition userTask1 = new HumanStepDefinition();
      checkerTaskDef.setId("UserTask1");
      checkerTaskDef.setName("UserTask1");
    ChoiceStepsDefinition chDef = workflowDefinition.inChoice();
    ListConditionStepDefinition lcdef = chDef.inList();
    lcdef.addCondition("isRejeted", "", "").addStep(userTask1);


The generated bpmn is somehow containing 2 exclusive gateway and creating 3 user tasks.
Any help.
3 REPLIES 3

trademak
Star Contributor
Star Contributor
Hi Vgaur,

That's correct, that's currently not supported in the WorkflowDefinition implementation.

Best regards,

vgaur
Confirmed Champ
Confirmed Champ
Thanks Tijs ,
I figured that out and I am adding my own implementation right now. Just one question why are we neglecting the provided id in AbstractStepDefinitionContainer.

<code>
protected T addHumanStep(String id, String name, String assignee, boolean initiator) {
    createHumanStepDefinition(name, assignee, initiator);
    return (T) this;
  }
  </code>

Any specific reason which I should be aware of.

vgaur
Confirmed Champ
Confirmed Champ
I have added my own implementation of ChoiceStepsDefinitionConverter and also used the id provided while adding HumanStep.
Thanks