Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.ExclusiveGateway


 
  private void validateModel(BpmnModel model) {
  FlowElement flowElement = model.getMainProcess().getFlowElement("sid-B074A0DD-934A-4053-A537-20ADF0781023");
  assertNotNull(flowElement);
  assertTrue(flowElement instanceof ExclusiveGateway);
  ExclusiveGateway gateway = (ExclusiveGateway) flowElement;
  List<SequenceFlow> sequenceFlows = gateway.getOutgoingFlows();
  assertTrue(sequenceFlows.size() == 2);
  assertTrue(sequenceFlows.get(0).getId().equals("sid-07A7E174-8857-4DE9-A7CD-A041706D79C3") ||
      sequenceFlows.get(0).getId().equals("sid-C2068B1E-9A82-41C9-B876-C58E2736C186"));
  assertTrue(sequenceFlows.get(1).getId().equals("sid-07A7E174-8857-4DE9-A7CD-A041706D79C3") ||
      sequenceFlows.get(1).getId().equals("sid-C2068B1E-9A82-41C9-B876-C58E2736C186"));
View Full Code Here


 
  protected void convertElementToJson(ObjectNode propertiesNode, FlowElement flowElement) {
  }
 
  protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) {
    ExclusiveGateway gateway = new ExclusiveGateway();
    return gateway;
  }
View Full Code Here

  }

  protected ExclusiveGateway createProcessArtifact(ChoiceStepsDefinition choiceStepsDefinition, WorkflowDefinitionConversion conversion) {

    // First choice gateway
    ExclusiveGateway forkGateway = createExclusiveGateway(conversion);
   
    // Sequence flow from last activity to first gateway
    addSequenceFlow(conversion, conversion.getLastActivityId(), forkGateway.getId());
    conversion.setLastActivityId(forkGateway.getId());

    // Convert all other steps, disabling activity id updates which makes all
    // generated steps have a sequence flow to the first gateway
    WorkflowDefinitionConversionFactory conversionFactory = conversion.getConversionFactory();
    List<FlowElement> endElements = new ArrayList<FlowElement>();
    List<SequenceFlow> bypassingFlows = new ArrayList<SequenceFlow>();
    for (ListConditionStepDefinition<ChoiceStepsDefinition> stepListDefinition : choiceStepsDefinition.getStepList()) {
     
      StringBuilder conditionBuilder = new StringBuilder();
      for (ConditionDefinition conditionDefintion : stepListDefinition.getConditions()) {
        if (conditionBuilder.length() > 0) {
          conditionBuilder.append(" && ");
        } else {
          conditionBuilder.append("${");
        }
       
        conditionBuilder.append(conditionDefintion.getLeftOperand());
        conditionBuilder.append(" ");
        conditionBuilder.append(conditionDefintion.getOperator());
        conditionBuilder.append(" ");
        conditionBuilder.append(conditionDefintion.getRightOperand());
      }
     
      for (int i = 0; i < stepListDefinition.getSteps().size(); i++) {
        if (i == 0) {
          conversion.setSequenceflowGenerationEnabled(false);
        } else {
          conversion.setSequenceflowGenerationEnabled(true);
        }
        StepDefinition step = stepListDefinition.getSteps().get(i);
        FlowElement flowElement = (FlowElement) conversionFactory.getStepConverterFor(step).convertStepDefinition(step, conversion);
       
        if (i == 0) {
          if (conditionBuilder.length() > 0) {
            conditionBuilder.append("}");
            SequenceFlow mainFlow = addSequenceFlow(conversion, forkGateway.getId(), flowElement.getId(), conditionBuilder.toString());
            if(stepListDefinition.getName() != null) {
              mainFlow.setName(stepListDefinition.getName());
            }
          } else {
            addSequenceFlow(conversion, forkGateway.getId(), flowElement.getId());
          }
        }
       
        if ((i + 1) == stepListDefinition.getSteps().size()) {
          endElements.add(flowElement);
        }
      }
     
      if(stepListDefinition.getSteps().isEmpty()) {
        // Special case for a "stepless" stepListDefinition, which should just create a sequence-flow from the fork to the join
        SequenceFlow created = null;
        if (conditionBuilder.length() > 0) {
          conditionBuilder.append("}");
          created = addSequenceFlow(conversion, forkGateway.getId(), null, conditionBuilder.toString());
        } else {
          created = addSequenceFlow(conversion, forkGateway.getId(), null);
        }
        if(stepListDefinition.getName() != null) {
          created.setName(stepListDefinition.getName());
        }
        bypassingFlows.add(created);
      }
    }
   
    conversion.setSequenceflowGenerationEnabled(false);
   
    // Second choice gateway
    ExclusiveGateway joinGateway = createExclusiveGateway(conversion);
    conversion.setLastActivityId(joinGateway.getId());
   
    conversion.setSequenceflowGenerationEnabled(true);
   
    // Create sequenceflow from all generated steps to the second gateway
    for (FlowElement endElement : endElements) {
      if(!(endElement instanceof EndEvent)) {
        addSequenceFlow(conversion, endElement.getId(), joinGateway.getId());
      }
    }
   
    for(SequenceFlow bypassingFlow : bypassingFlows) {
      bypassingFlow.setTargetRef(joinGateway.getId());
    }
   
    return forkGateway;
  }
View Full Code Here

   
    return forkGateway;
  }
 
  protected ExclusiveGateway createExclusiveGateway(WorkflowDefinitionConversion conversion) {
    ExclusiveGateway exclusiveGateway = new ExclusiveGateway();
    exclusiveGateway.setId(conversion.getUniqueNumberedId(EXLCUSIVE_GATEWAY_PREFIX));
    conversion.getProcess().addFlowElement(exclusiveGateway);
    return exclusiveGateway;
  }
View Full Code Here

    // Boundary signal catch to shut down all tasks if the 'gather feedback' task is completed
    BoundaryEvent boundarySignalCatch = createBoundarySignalCatch(conversion, signal, feedbackTask);
   
    // Exclusive gateway after the feedback task, needed to correctly merge the sequence flow
    // such that the joining parallel gateway has exactly two incoming sequence flow
    ExclusiveGateway mergingExclusiveGateway = createMergingExclusiveGateway(conversion);
    addSequenceFlow(conversion, feedbackTask, mergingExclusiveGateway);
    addSequenceFlow(conversion, boundarySignalCatch, mergingExclusiveGateway);
   
    // Parallel gateway that will join  it all together
    ParallelGateway join = createJoinParallelGateway(conversion, processElements);
View Full Code Here

    boundarySignalCatch.addEventDefinition(signalCatchEventDefinition);
    return boundarySignalCatch;
  }

  protected ExclusiveGateway createMergingExclusiveGateway(WorkflowDefinitionConversion conversion) {
    ExclusiveGateway mergingExclusiveGateway = new ExclusiveGateway();
    mergingExclusiveGateway.setId(conversion.getUniqueNumberedId(ConversionConstants.GATEWAY_ID_PREFIX));
    addFlowElement(conversion, mergingExclusiveGateway);
    return mergingExclusiveGateway;
  }
View Full Code Here

    return ELEMENT_GATEWAY_COMPLEX;
  }
 
  @Override
  protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
    ExclusiveGateway gateway = new ExclusiveGateway();
    BpmnXMLUtil.addXMLLocation(gateway, xtr);
    parseChildElements(getXMLElementName(), gateway, model, xtr);
    return gateway;
  }
View Full Code Here

    return ELEMENT_GATEWAY_EXCLUSIVE;
  }
 
  @Override
  protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
    ExclusiveGateway gateway = new ExclusiveGateway();
    BpmnXMLUtil.addXMLLocation(gateway, xtr);
    parseChildElements(getXMLElementName(), gateway, model, xtr);
    return gateway;
  }
View Full Code Here

    super(fp);
  }

  @Override
  public PictogramElement add(IAddContext context) {
    final ExclusiveGateway addedGateway = (ExclusiveGateway) context.getNewObject();
    final ContainerShape parent = context.getTargetContainer();

    // CONTAINER SHAPE WITH CIRCLE
    final IPeCreateService peCreateService = Graphiti.getPeCreateService();
    final ContainerShape containerShape = peCreateService.createContainerShape(parent, true);
View Full Code Here

    // set name and description of the creation feature
    super(fp, "ExclusiveGateway", "Add exclusive gateway");
  }

  public Object[] create(ICreateContext context) {
    ExclusiveGateway exclusiveGateway = new ExclusiveGateway();
    addObjectToContainer(context, exclusiveGateway, "Exclusive Gateway");

    return new Object[] { exclusiveGateway };
  }
View Full Code Here

TOP

Related Classes of org.activiti.bpmn.model.ExclusiveGateway

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.