Пример #1
0
  @Override
  public String toJpdl() throws InvalidModelException {
    StringWriter jpdl = new StringWriter();
    jpdl.write("  <esb");

    jpdl.write(JsonToJpdl.transformAttribute("name", name));

    try {
      jpdl.write(JsonToJpdl.transformRequieredAttribute("category", category));
      jpdl.write(JsonToJpdl.transformRequieredAttribute("service", service));
    } catch (InvalidModelException e) {
      throw new InvalidModelException("Invalid Esb activity. " + e.getMessage());
    }

    if (bounds != null) {
      jpdl.write(bounds.toJpdl());
    } else {
      throw new InvalidModelException("Invalid ESB activity. Bounds is missing.");
    }

    jpdl.write(" >\n");

    for (Part p : part) {
      jpdl.write(p.toJpdl());
    }

    for (Transition t : outgoings) {
      jpdl.write(t.toJpdl());
    }

    jpdl.write("  </esb>\n\n");

    return jpdl.toString();
  }
  public StartEvent(JSONObject startEvent) {

    this.name = JsonToJpdl.getAttribute(startEvent, "name");
    this.bounds = JsonToJpdl.getBounds(startEvent);
    this.outgoings = JsonToJpdl.getOutgoings(startEvent);

    this.bounds.setUlx(this.bounds.getUlx() - 9);
    this.bounds.setUly(this.bounds.getUly() - 9);
    this.bounds.setWidth(48);
    this.bounds.setHeight(48);
  }
Пример #3
0
  public And(JSONObject and) {

    this.name = JsonToJpdl.getAttribute(and, "name");
    this.bounds = JsonToJpdl.getBounds(and);
    this.outgoings = JsonToJpdl.getOutgoings(and);

    this.bounds.setUlx(this.bounds.getUlx() - 4);
    this.bounds.setUly(this.bounds.getUly() - 4);
    this.bounds.setWidth(48);
    this.bounds.setHeight(48);
  }
Пример #4
0
  @Override
  public String toJpdl() throws InvalidModelException {
    StringWriter jpdl = new StringWriter();
    String type = "";
    if (outgoings.size() <= 1) type = "join";
    else type = "fork";

    jpdl.write("  <" + type);

    jpdl.write(JsonToJpdl.transformAttribute("name", name));

    if (bounds != null) {
      jpdl.write(bounds.toJpdl());
    } else {
      throw new InvalidModelException("Invalid Wait activity. Bounds is missing.");
    }

    if (outgoings.size() > 0) {
      jpdl.write(" >\n");
      for (Transition t : outgoings) {
        jpdl.write(t.toJpdl());
      }
      jpdl.write("  </" + type + ">\n\n");
    } else {
      jpdl.write(" />\n\n");
    }

    return jpdl.toString();
  }
Пример #5
0
  public Task(JSONObject task) {

    this.name = JsonToJpdl.getAttribute(task, "name");
    this.assignee = JsonToJpdl.getAttribute(task, "assignee");
    this.candidateGroups = JsonToJpdl.getAttribute(task, "candidate-groups");
    this.candidateUsers = JsonToJpdl.getAttribute(task, "candidate-users");
    this.swimlane = JsonToJpdl.getAttribute(task, "swimlane");
    this.bounds = JsonToJpdl.getBounds(task);
    this.outgoings = JsonToJpdl.getOutgoings(task);
  }
Пример #6
0
  public Esb(JSONObject esb) {

    this.name = JsonToJpdl.getAttribute(esb, "name");
    this.category = JsonToJpdl.getAttribute(esb, "category");
    this.service = JsonToJpdl.getAttribute(esb, "service");
    this.bounds = JsonToJpdl.getBounds(esb);

    this.part = new ArrayList<Part>();

    try {
      JSONArray parameters =
          esb.getJSONObject("properties").getJSONObject("part").getJSONArray("items");
      for (int i = 0; i < parameters.length(); i++) {
        JSONObject item = parameters.getJSONObject(i);
        part.add(new Part(item));
      }
    } catch (JSONException e) {
    }

    this.outgoings = JsonToJpdl.getOutgoings(esb);
  }
Пример #7
0
 public String toJpdl() throws InvalidModelException {
   StringWriter jpdl = new StringWriter();
   jpdl.write("<field ");
   jpdl.write(JsonToJpdl.transformAttribute("name", name));
   jpdl.write(" >\n");
   if (child != null) {
     jpdl.write(child.toJpdl());
   } else {
     throw new InvalidModelException("Invalid Field. Object or String is missing");
   }
   jpdl.write("</field>\n");
   return jpdl.toString();
 }
Пример #8
0
  @Override
  public String toJpdl() throws InvalidModelException {
    StringWriter jpdl = new StringWriter();
    jpdl.write("  <task");

    jpdl.write(JsonToJpdl.transformAttribute("name", name));
    if (assignee != null && assignee.length() > 0)
      jpdl.write(JsonToJpdl.transformAttribute("assignee", assignee));
    if (candidateGroups != null && candidateGroups.length() > 0) {
      jpdl.write(JsonToJpdl.transformAttribute("candidate-groups", candidateGroups));
    }
    if (candidateUsers != null && candidateUsers.length() > 0) {
      jpdl.write(JsonToJpdl.transformAttribute("candidate-users", candidateUsers));
    }
    if (swimlane != null) {
      jpdl.write(JsonToJpdl.transformAttribute("swimlane", swimlane));
    }

    if (bounds != null) {
      jpdl.write(bounds.toJpdl());
    } else {
      throw new InvalidModelException("Invalid Task. Bounds is missing.");
    }

    if (outgoings.size() > 0) {
      jpdl.write(" >\n");
      for (Transition t : outgoings) {
        jpdl.write(t.toJpdl());
      }
      jpdl.write("  </task>\n\n");
    } else {
      jpdl.write(" />\n\n");
    }

    return jpdl.toString();
  }
Пример #9
0
  @Override
  public String toJpdl() throws InvalidModelException {
    StringWriter jpdl = new StringWriter();
    jpdl.write("  <hql");

    jpdl.write(JsonToJpdl.transformAttribute("name", name));
    jpdl.write(JsonToJpdl.transformAttribute("var", var));
    if (unique != null) jpdl.write(JsonToJpdl.transformAttribute("unique", unique.toString()));

    if (bounds != null) {
      jpdl.write(bounds.toJpdl());
    } else {
      throw new InvalidModelException("Invalid HQL activity. Bounds is missing.");
    }

    jpdl.write(" >\n");

    if (query != null) {
      jpdl.write("    <query>");
      jpdl.write(StringEscapeUtils.escapeXml(query));
      jpdl.write("</query>\n");
    } else {
      throw new InvalidModelException("Invalid HQL activity. Query is missing.");
    }

    if (parameters != null) {
      jpdl.write(parameters.toJpdl());
    }

    for (Transition t : outgoings) {
      jpdl.write(t.toJpdl());
    }

    jpdl.write("  </hql>\n");
    return jpdl.toString();
  }
  @Override
  public String toJpdl() throws InvalidModelException {
    StringWriter jpdl = new StringWriter();
    jpdl.write("  <start");
    jpdl.write(JsonToJpdl.transformAttribute("name", name));

    if (bounds != null) {
      jpdl.write(bounds.toJpdl());
    } else {
      throw new InvalidModelException("Invalid Start Event. Bounds is missing.");
    }

    if (outgoings.size() > 0) {
      jpdl.write(" >\n");
      for (Transition t : outgoings) {
        jpdl.write(t.toJpdl());
      }
      jpdl.write("  </start>\n\n");
    } else {
      jpdl.write(" />\n\n");
    }

    return jpdl.toString();
  }