Ejemplo n.º 1
0
  /** Parses the 'definitions' root element */
  protected void transformProcessDefinitions() {
    sequenceFlows = new HashMap<String, TransitionImpl>();
    for (Process process : bpmnModel.getProcesses()) {
      bpmnParserHandlers.parse(this, process);
    }

    if (processDefinitions.size() > 0) {
      processDI();
    }
  }
Ejemplo n.º 2
0
  public void processFlowElements(Collection<FlowElement> flowElements) {

    // Parsing the elements is done in a strict order of types,
    // as otherwise certain information might not be available when parsing a certain type.

    // Using lists as we want to keep the order in which they are defined
    List<SequenceFlow> sequenceFlowToParse = new ArrayList<SequenceFlow>();
    List<BoundaryEvent> boundaryEventsToParse = new ArrayList<BoundaryEvent>();

    // Activities are parsed first
    for (FlowElement flowElement : flowElements) {

      // Sequence flow are also flow elements, but are only parsed once every activity is found
      if (flowElement instanceof SequenceFlow) {
        sequenceFlowToParse.add((SequenceFlow) flowElement);
      } else if (flowElement instanceof BoundaryEvent) {
        boundaryEventsToParse.add((BoundaryEvent) flowElement);
      } else {
        bpmnParserHandlers.parse(this, flowElement);
      }
    }

    // Boundary events are parsed after all the regular activities are parsed
    for (BoundaryEvent boundaryEvent : boundaryEventsToParse) {
      bpmnParserHandlers.parse(this, boundaryEvent);
    }

    // sequence flows
    for (SequenceFlow sequenceFlow : sequenceFlowToParse) {
      bpmnParserHandlers.parse(this, sequenceFlow);
    }

    // validations after complete model
    for (FlowElement flowElement : flowElements) {
      if (flowElement instanceof ExclusiveGateway) {
        ActivityImpl gatewayActivity = getCurrentScope().findActivity(flowElement.getId());
        validateExclusiveGateway(gatewayActivity, (ExclusiveGateway) flowElement);
      }
    }
  }