Package org.activiti.workflow.simple.definition

Examples of org.activiti.workflow.simple.definition.ChoiceStepsDefinition


    WorkflowDefinition parsedDefinition = converter.readWorkflowDefinition(baos.toByteArray());

    // Check if parsed definition matches the original one
    assertEquals(workflowDefinition.getName(), parsedDefinition.getName());
    assertEquals(workflowDefinition.getDescription(), parsedDefinition.getDescription());
    ChoiceStepsDefinition choiceDef = null;
    for (StepDefinition step : parsedDefinition.getSteps()) {
      if (step instanceof ChoiceStepsDefinition) {
        choiceDef = (ChoiceStepsDefinition) step;
      }
    }
    assertNotNull(choiceDef);
    assertEquals(2, choiceDef.getStepList().size());
   
    ListConditionStepDefinition<ChoiceStepsDefinition> listSteps = choiceDef.getStepList().get(0);
    assertEquals(2, listSteps.getConditions().size());
    assertEquals("test", listSteps.getConditions().get(0).getLeftOperand());
    assertEquals("==", listSteps.getConditions().get(0).getOperator());
    assertEquals("'hello'", listSteps.getConditions().get(0).getRightOperand());
   
    listSteps = choiceDef.getStepList().get(1);
    assertEquals(0, listSteps.getConditions().size());
  }
View Full Code Here


      userTask.setLoopCharacteristics(mi);
    }

    if (stepDefinition.getRejectionSteps() != null) {
      // Create choice-step
      ChoiceStepsDefinition choice = new ChoiceStepsDefinition();
      choice.setId(id + "choice");

      // Add rejection steps to the choice
      ListConditionStepDefinition<ChoiceStepsDefinition> rejectStepList = new ListConditionStepDefinition<ChoiceStepsDefinition>();
      rejectStepList.setName("Rejected");
      for (StepDefinition child : stepDefinition.getRejectionSteps()) {
        rejectStepList.addStep(child);
      }
     
      // Add end-process step to reject path, if needed
      if(stepDefinition.isEndProcessOnReject()) {
        rejectStepList.addStep(new AlfrescoEndProcessStepDefinition());
      }

      // Make choice condition based on review outcome
      ConditionDefinition condition = new ConditionDefinition();
      condition.setLeftOperand(getCountVariableName(id, namespacePrefix));
      condition.setOperator("<");
      condition.setRightOperand(getRequiredCountVariableName(id, namespacePrefix));
      rejectStepList.setConditions(Arrays.asList(condition));
      choice.addStepList(rejectStepList);

      // Add default (empty) choice for approval AFTER the review-one
      ListConditionStepDefinition<ChoiceStepsDefinition> defaultStepList = new ListConditionStepDefinition<ChoiceStepsDefinition>();
      defaultStepList.setName("Approved");
      choice.addStepList(defaultStepList);

      // Convert the choice-step
      lastElement = (FlowElement) conversion.getConversionFactory().getStepConverterFor(choice)
          .convertStepDefinition(choice, conversion);
    }
View Full Code Here

TOP

Related Classes of org.activiti.workflow.simple.definition.ChoiceStepsDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.