Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.ParallelGateway


 
  private void validateModel(BpmnModel model) {
  FlowElement flowElement = model.getMainProcess().getFlowElement("parallel1");
  assertNotNull(flowElement);
  assertTrue(flowElement instanceof ParallelGateway);
  ParallelGateway gateway = (ParallelGateway) flowElement;
  List<SequenceFlow> sequenceFlows = gateway.getOutgoingFlows();
  assertTrue(sequenceFlows.size() == 3);
  assertTrue(sequenceFlows.get(0).getId().equals("sid-B9EE4ECE-BF72-4C25-B768-8295906E5CF8") ||
      sequenceFlows.get(0).getId().equals("sid-D2491B73-0382-4EC2-AAAC-C8FD129E4CBE") ||
      sequenceFlows.get(0).getId().equals("sid-7036D56C-E8EF-493B-ADEC-57EED4C6CE1F"));
  assertTrue(sequenceFlows.get(1).getId().equals("sid-B9EE4ECE-BF72-4C25-B768-8295906E5CF8") ||
      sequenceFlows.get(1).getId().equals("sid-D2491B73-0382-4EC2-AAAC-C8FD129E4CBE") ||
      sequenceFlows.get(1).getId().equals("sid-7036D56C-E8EF-493B-ADEC-57EED4C6CE1F"));
  assertTrue(sequenceFlows.get(2).getId().equals("sid-B9EE4ECE-BF72-4C25-B768-8295906E5CF8") ||
      sequenceFlows.get(2).getId().equals("sid-D2491B73-0382-4EC2-AAAC-C8FD129E4CBE") ||
      sequenceFlows.get(2).getId().equals("sid-7036D56C-E8EF-493B-ADEC-57EED4C6CE1F"));
  assertTrue(sequenceFlows.get(0).getSourceRef().equals("parallel1"));
  assertTrue(sequenceFlows.get(1).getSourceRef().equals("parallel1"));
  assertTrue(sequenceFlows.get(2).getSourceRef().equals("parallel1"));
  flowElement = model.getMainProcess().getFlowElement("parallel2");
  assertNotNull(flowElement);
  assertTrue(flowElement instanceof ParallelGateway);
  gateway = (ParallelGateway) flowElement;
  sequenceFlows = gateway.getIncomingFlows();
  assertTrue(sequenceFlows.size() == 3);
  assertTrue(sequenceFlows.get(0).getId().equals("sid-4C19E041-42FA-485D-9D09-D47CCD9DB270") ||
      sequenceFlows.get(0).getId().equals("sid-05A991A6-0296-4867-ACBA-EF9EEC68FB8A") ||
      sequenceFlows.get(0).getId().equals("sid-C546AC84-379D-4094-9DC3-548593F2EA0D"));
  assertTrue(sequenceFlows.get(1).getId().equals("sid-4C19E041-42FA-485D-9D09-D47CCD9DB270") ||
View Full Code Here


  private void validateModel(BpmnModel model) {
  FlowElement flowElement = model.getMainProcess().getFlowElement("subprocess1");
  assertNotNull(flowElement);
  assertTrue(flowElement instanceof SubProcess);
  SubProcess subProcess = (SubProcess) flowElement;
  ParallelGateway gateway = (ParallelGateway) subProcess.getFlowElement("sid-A0E0B174-36DF-4C4F-A952-311CC3C031FC");
  assertNotNull(gateway);
  List<SequenceFlow> sequenceFlows = gateway.getOutgoingFlows();
  assertTrue(sequenceFlows.size() == 2);
  assertTrue(sequenceFlows.get(0).getId().equals("sid-9C669980-C274-4A48-BF7F-B9C5CA577DD2") ||
      sequenceFlows.get(0).getId().equals("sid-A299B987-396F-46CA-8D63-85991FBFCE6E"));
  assertTrue(sequenceFlows.get(1).getId().equals("sid-9C669980-C274-4A48-BF7F-B9C5CA577DD2") ||
      sequenceFlows.get(1).getId().equals("sid-A299B987-396F-46CA-8D63-85991FBFCE6E"));
View Full Code Here

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

   
    // The first user task, responsible for configuring the feedback
    UserTask selectPeopleUserTask = createSelectPeopleUserTask(feedbackStepDefinition, conversion, processElements);
   
    // Parallel gateways (forking/joining)
    ParallelGateway fork = createForkParallelGateway(conversion, processElements);
    addSequenceFlow(conversion, selectPeopleUserTask, fork);
   
    // Gather feedback user task for the initiator of the feedback step
    UserTask gatherFeedbackUserTask = createGatherFeedbackUserTask(feedbackStepDefinition, conversion, processElements);
    addSequenceFlow(conversion, fork, gatherFeedbackUserTask);
   
    // Global signal event
    Signal signal = createSignalDeclaration(conversion);
   
    // Signal throw event after the gather feedback task
    ThrowEvent signalThrowEvent = createSignalThrow(conversion, signal);
    addSequenceFlow(conversion, gatherFeedbackUserTask, signalThrowEvent);
   
    // Povide feedback step
    UserTask feedbackTask = createFeedbackUserTask(feedbackStepDefinition, conversion, processElements);
    addSequenceFlow(conversion, fork, feedbackTask);
   
    // 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);
    addSequenceFlow(conversion, signalThrowEvent, join);
    addSequenceFlow(conversion, mergingExclusiveGateway, join);
   
    // Set the last activity id, such that next steps can connect correctly
    conversion.setLastActivityId(join.getId());
   
    return processElements;
  }
View Full Code Here

   
    return selectPeopleUserTask;
  }

  protected ParallelGateway createForkParallelGateway(WorkflowDefinitionConversion conversion, Map<String, BaseElement> processElements) {
    ParallelGateway fork = new ParallelGateway();
    fork.setId(conversion.getUniqueNumberedId(ConversionConstants.GATEWAY_ID_PREFIX));
    addFlowElement(conversion, fork);
    processElements.put(FEEDBACK_FORK, fork);
    return fork;
  }
View Full Code Here

   
    return signalThrowEvent;
  }

  protected ParallelGateway createJoinParallelGateway(WorkflowDefinitionConversion conversion, Map<String, BaseElement> processElements) {
    ParallelGateway join = new ParallelGateway();
    join.setId(conversion.getUniqueNumberedId(ConversionConstants.GATEWAY_ID_PREFIX));
    addFlowElement(conversion, join);
    processElements.put(FEEDBACK_JOIN, join);
    return join;
  }
View Full Code Here

  }

  protected ParallelGateway createProcessArtifact(ParallelStepsDefinition parallelStepsDefinition, WorkflowDefinitionConversion conversion) {

    // First parallel gateway
    ParallelGateway forkGateway = createParallelGateway(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>();
    for (ListStepDefinition<ParallelStepsDefinition> stepListDefinition : parallelStepsDefinition.getStepList()) {
     
      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) {
          addSequenceFlow(conversion, forkGateway.getId(), flowElement.getId());
        }
       
        if ((i + 1) == stepListDefinition.getSteps().size()) {
          endElements.add(flowElement);
        }
      }
    }
   
    conversion.setSequenceflowGenerationEnabled(false);
   
    // Second parallel gateway
    ParallelGateway joinGateway = createParallelGateway(conversion);
    conversion.setLastActivityId(joinGateway.getId());
   
    conversion.setSequenceflowGenerationEnabled(true);
   
    // Create sequence flow from all generated steps to the second gateway
    for (FlowElement endElement : endElements) {
      addSequenceFlow(conversion, endElement.getId(), joinGateway.getId());
    }
   
    return forkGateway;
  }
View Full Code Here

   
    return forkGateway;
  }
 
  protected ParallelGateway createParallelGateway(WorkflowDefinitionConversion conversion) {
    ParallelGateway parallelGateway = new ParallelGateway();
    parallelGateway.setId(conversion.getUniqueNumberedId(PARALLEL_GATEWAY_PREFIX));
    conversion.getProcess().addFlowElement(parallelGateway);
    return parallelGateway;
  }
View Full Code Here

    assertEquals("First Task", userTask.getName());
   
    assertEquals(1, userTask.getOutgoingFlows().size());
    assertEquals(1, userTask.getIncomingFlows().size());
    nextElementId = userTask.getOutgoingFlows().get(0).getTargetRef();
    ParallelGateway parallelGateway = (ParallelGateway) process.getFlowElement(nextElementId);
    assertEquals(2, parallelGateway.getOutgoingFlows().size());
   
    nextElementId = parallelGateway.getOutgoingFlows().get(0).getTargetRef();
    assertEquals(1, parallelGateway.getIncomingFlows().size());
    userTask = (UserTask) process.getFlowElement(nextElementId);
    assertEquals(1, userTask.getOutgoingFlows().size());
   
    nextElementId = userTask.getOutgoingFlows().get(0).getTargetRef();
    parallelGateway = (ParallelGateway) process.getFlowElement(nextElementId);
    assertEquals(1, parallelGateway.getOutgoingFlows().size());
    assertEquals(2, parallelGateway.getIncomingFlows().size());
   
    nextElementId = parallelGateway.getOutgoingFlows().get(0).getTargetRef();
    EndEvent endEvent = (EndEvent) process.getFlowElement(nextElementId);
    assertEquals(0, endEvent.getOutgoingFlows().size());
    assertEquals(1, endEvent.getIncomingFlows().size());
  }
View Full Code Here

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

TOP

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

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.