private ArrayList<Shape> getEdgesFromDiagram(ArrayList<Shape> shapes) {
    ArrayList<Shape> edges = new ArrayList<Shape>();

    for (Shape shape : shapes) {
      String sid = shape.getStencilId();

      if (sid.equals("SequenceFlow")
          || sid.equals("MessageFlow")
          || sid.equals("Association_Undirected")
          || sid.equals("Association_Unidirectional")
          || sid.equals("Association_Bidirectional")) {
        edges.add(shape);
      } else if (shape.getChildShapes().size() > 0) {
        edges.addAll(this.getEdgesFromDiagram(shape.getChildShapes()));
      }
    }

    return edges;
  }
  private void expandSubProcesses(Diagram diagram) {
    List<Shape> shapes = diagram.getShapes();
    for (Shape shape : shapes) {
      if (STENCIL_COLLAPSED_SUBPROCESS.equals(shape.getStencilId())
          && !"true".equals(shape.getProperty(PROPERTY_IS_CALL_ACTIVITY))) {
        String subProcessUrl = shape.getProperty(PROPERTY_ENTRY);
        if (subProcessUrl != null && subProcessUrl.length() > 0) {
          String subProcessName = shape.getProperty(PROPERTY_NAME);
          try {
            String subProcessId = getModelIdFromSignavioUrl(subProcessUrl);

            //            RepositoryArtifact artifact =
            // connector.getRepositoryArtifact(subProcessId);
            String subProcessJson = connector.getContent(subProcessId).asString();

            Diagram subProcess = DiagramBuilder.parseJson(subProcessJson);

            // FIXME subProcess = new ExtractProcessOfParticipant("Process
            // Engine").transform(subProcess);

            expandSubProcesses(subProcess);

            shape.setStencil(new StencilType(STENCIL_SUBPROCESS));
            ArrayList<Shape> childShapes = shape.getChildShapes();
            childShapes.addAll(subProcess.getChildShapes());
          } catch (Exception e) {
            throw new JsonTransformationException(
                "Error while retrieving Sub-Process"
                    + " '"
                    + subProcessName
                    + "'"
                    + " (URL: "
                    + subProcessUrl
                    + ").",
                e);
          }
        }
      }
    }
  }