Examples of SequenceFlow


Examples of org.activiti.bpmn.model.SequenceFlow

    assertTrue(startEvent.getOutgoingFlows().size() == 1);
   
    flowElement = model.getMainProcess().getFlowElement("flow1");
    assertTrue(flowElement instanceof SequenceFlow);
   
    SequenceFlow flow  = (SequenceFlow) flowElement;
    assertEquals("flow1", flow.getId());
    assertNotNull(flow.getSourceRef());
    assertNotNull(flow.getTargetRef());
  }
View Full Code Here

Examples of org.activiti.bpmn.model.SequenceFlow

   
    flowElement = model.getMainProcess().getFlowElement("flow1Condition");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SequenceFlow);
    assertEquals("flow1Condition", flowElement.getId());
    SequenceFlow flow = (SequenceFlow) flowElement;
    assertEquals("${number <= 1}", flow.getConditionExpression());
  }
View Full Code Here

Examples of org.activiti.bpmn.model.SequenceFlow

    return createSequenceFlow(conversion, source, target,(ActivitiListener[]) null);
  }

  public static SequenceFlow createSequenceFlow(WorkflowDefinitionConversion conversion, FlowNode source,
      FlowNode target, ActivitiListener... executionListeners) {
    SequenceFlow sequenceFlow = new SequenceFlow();
    sequenceFlow.setId(conversion.getUniqueNumberedId(ConversionConstants.DEFAULT_SEQUENCEFLOW_PREFIX));
    sequenceFlow.setSourceRef(source.getId());
    sequenceFlow.setTargetRef(target.getId());

    if (executionListeners != null && executionListeners.length > 0) {
      List<ActivitiListener> listeners = new ArrayList<ActivitiListener>();
      for (ActivitiListener listener : executionListeners) {
        listeners.add(listener);
      }
      sequenceFlow.setExecutionListeners(listeners);
    }

    return sequenceFlow;
  }
View Full Code Here

Examples of org.activiti.bpmn.model.SequenceFlow

    EndEvent endEvent = new EndEvent();
    endEvent.setId(END_EVENT_ID);
    process.addFlowElement(endEvent);

    // Sequence flow from last created activity to end
    SequenceFlow sequenceFlow = new SequenceFlow();
    sequenceFlow.setId(conversion.getUniqueNumberedId(ConversionConstants.DEFAULT_SEQUENCEFLOW_PREFIX));
    sequenceFlow.setSourceRef(conversion.getLastActivityId());
    sequenceFlow.setTargetRef(END_EVENT_ID);
    process.addFlowElement(sequenceFlow);

    // To make the generated workflow compatible with some tools (eg the
    // Modeler, but also others),
    // We must add the ingoing and outgoing sequence flow to each of the flow
View Full Code Here

Examples of org.activiti.bpmn.model.SequenceFlow

  protected SequenceFlowMapping generateSequenceflowMappings(Process process) {
    HashMap<String, List<SequenceFlow>> incomingSequenceFlowMapping = new HashMap<String, List<SequenceFlow>>();
    HashMap<String, List<SequenceFlow>> outgoingSequenceFlowMapping = new HashMap<String, List<SequenceFlow>>();

    for (FlowElement flowElement : process.findFlowElementsOfType(SequenceFlow.class)) {
      SequenceFlow sequenceFlow = (SequenceFlow) flowElement;
      String srcId = sequenceFlow.getSourceRef();
      String targetId = sequenceFlow.getTargetRef();

      if (outgoingSequenceFlowMapping.get(srcId) == null) {
        outgoingSequenceFlowMapping.put(srcId, new ArrayList<SequenceFlow>());
      }
      outgoingSequenceFlowMapping.get(srcId).add(sequenceFlow);
View Full Code Here

Examples of org.activiti.bpmn.model.SequenceFlow

   * @param condition
   */
  protected SequenceFlow addSequenceFlow(WorkflowDefinitionConversion conversion, String sourceActivityId,
      String targetActivityId, String condition) {
   
    SequenceFlow sequenceFlow = new SequenceFlow();
    sequenceFlow.setId(conversion.getUniqueNumberedId(getSequenceFlowPrefix()));
    sequenceFlow.setSourceRef(sourceActivityId);
    sequenceFlow.setTargetRef(targetActivityId);
   
    if (StringUtils.isNotEmpty(condition)) {
      sequenceFlow.setConditionExpression(condition);
    }

    conversion.getProcess().addFlowElement(sequenceFlow);
    return sequenceFlow;
  }
View Full Code Here

Examples of org.activiti.bpmn.model.SequenceFlow

        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);
      }
    }
   
View Full Code Here

Examples of org.activiti.bpmn.model.SequenceFlow

 
  @Override
  public void convertToJson(FlowElement flowElement, ActivityProcessor processor,
      BpmnModel model, ArrayNode shapesArrayNode, double subProcessX, double subProcessY) {
   
    SequenceFlow sequenceFlow = (SequenceFlow) flowElement;
    ObjectNode flowNode = BpmnJsonConverterUtil.createChildShape(sequenceFlow.getId(), STENCIL_SEQUENCE_FLOW, 172, 212, 128, 212);
    ArrayNode dockersArrayNode = objectMapper.createArrayNode();
    ObjectNode dockNode = objectMapper.createObjectNode();
    dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(sequenceFlow.getSourceRef()).getWidth() / 2.0);
    dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(sequenceFlow.getSourceRef()).getHeight() / 2.0);
    dockersArrayNode.add(dockNode);
   
    if (model.getFlowLocationGraphicInfo(sequenceFlow.getId()).size() > 2) {
      for (int i = 1; i < model.getFlowLocationGraphicInfo(sequenceFlow.getId()).size() - 1; i++) {
        GraphicInfo graphicInfo =  model.getFlowLocationGraphicInfo(sequenceFlow.getId()).get(i);
        dockNode = objectMapper.createObjectNode();
        dockNode.put(EDITOR_BOUNDS_X, graphicInfo.getX());
        dockNode.put(EDITOR_BOUNDS_Y, graphicInfo.getY());
        dockersArrayNode.add(dockNode);
      }
    }
   
    dockNode = objectMapper.createObjectNode();
    dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(sequenceFlow.getTargetRef()).getWidth() / 2.0);
    dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(sequenceFlow.getTargetRef()).getHeight() / 2.0);
    dockersArrayNode.add(dockNode);
    flowNode.put("dockers", dockersArrayNode);
    ArrayNode outgoingArrayNode = objectMapper.createArrayNode();
    outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(sequenceFlow.getTargetRef()));
    flowNode.put("outgoing", outgoingArrayNode);
    flowNode.put("target", BpmnJsonConverterUtil.createResourceNode(sequenceFlow.getTargetRef()));
   
    ObjectNode propertiesNode = objectMapper.createObjectNode();
    propertiesNode.put(PROPERTY_OVERRIDE_ID, flowElement.getId());
    if (StringUtils.isNotEmpty(sequenceFlow.getName())) {
      propertiesNode.put(PROPERTY_NAME, sequenceFlow.getName());
    }
   
    if (StringUtils.isNotEmpty(sequenceFlow.getDocumentation())) {
      propertiesNode.put(PROPERTY_DOCUMENTATION, sequenceFlow.getDocumentation());
    }
   
    if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) {
      propertiesNode.put(PROPERTY_SEQUENCEFLOW_CONDITION, sequenceFlow.getConditionExpression());
    }
   
    flowNode.put(EDITOR_SHAPE_PROPERTIES, propertiesNode);
   
    shapesArrayNode.add(flowNode);
View Full Code Here

Examples of org.activiti.bpmn.model.SequenceFlow

    // nothing to do
  }
 
  @Override
  protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) {
    SequenceFlow flow = new SequenceFlow();
   
    String sourceRef = lookForSourceRef(elementNode.get(EDITOR_SHAPE_ID).asText(), modelNode.get(EDITOR_CHILD_SHAPES));
   
    if (sourceRef != null) {
      flow.setSourceRef(sourceRef);
      String targetId = elementNode.get("target").get(EDITOR_SHAPE_ID).asText();
      flow.setTargetRef(BpmnJsonConverterUtil.getElementId(shapeMap.get(targetId)));
    }
   
    flow.setConditionExpression(getPropertyValueAsString(PROPERTY_SEQUENCEFLOW_CONDITION, elementNode));
   
    return flow;
  }
View Full Code Here

Examples of org.activiti.bpmn.model.SequenceFlow

    return ELEMENT_SEQUENCE_FLOW;
  }
 
  @Override
  protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
    SequenceFlow sequenceFlow = new SequenceFlow();
    BpmnXMLUtil.addXMLLocation(sequenceFlow, xtr);
    sequenceFlow.setSourceRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_SOURCE_REF));
    sequenceFlow.setTargetRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_TARGET_REF));
    sequenceFlow.setName(xtr.getAttributeValue(null, ATTRIBUTE_NAME));
   
    parseChildElements(getXMLElementName(), sequenceFlow, model, xtr);
   
    return sequenceFlow;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.