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);
          }
        }
      }
    }
  }
Exemple #2
0
  /**
   * Basic method to convert a gateway to its shape representation.
   *
   * @param shape The resource shape object containing graphical information only.
   */
  public void toShape(Shape shape) {
    super.toShape(shape);

    shape.setStencil(new StencilType("Exclusive_Databased_Gateway"));
    shape.getProperties().put("markervisible", "false");
  }