Exemplo n.º 1
0
  @Override
  public String generateID(String prefix) {
    Integer maxId = (Integer) prefixMap.get(prefix);
    if (maxId == null) {
      maxId = new Integer(0);
      prefixMap.put(prefix, maxId);
    }

    maxId = new Integer(maxId.intValue() + 1);
    prefixMap.put(prefix, maxId);
    if (svgObject != null
        && maxId - 1 < svgObject.size()
        && prefix.equals(SVGSyntax.ID_PREFIX_CLIP_PATH)) {
      if (svgObject.get(maxId - 1) != null) {
        Object obj = svgObject.get(maxId - 1);
        if (obj instanceof BusinessItemShape) {
          BusinessItemShape item = (BusinessItemShape) obj;
          String id = "";
          for (Object assign : item.getAssignments()) {
            if (assign instanceof BusinessAssignment) {
              BusinessAssignment assignment = (BusinessAssignment) assign;
              id = id + assignment.getTalendItem().getLabel() + ";";
            }
          }
          if (id != "") {
            id = id.substring(0, id.length() - 1);
            return "businessItem." + businessModels.indexOf(obj);
          }
        }
      }
    }

    return prefix + maxId;
  }
Exemplo n.º 2
0
  private List init(List businessModels) {
    List svgObject = new ArrayList();
    if (businessModels != null) {
      // add shap items
      for (Object obj : businessModels) {
        if (obj instanceof BusinessItemShape) {
          BusinessItemShape editPart = (BusinessItemShape) obj;
          svgObject.add(obj);
          if (editPart.getName() != null) {
            svgObject.add(null);
          }
        }
      }
      return svgObject;
    }

    return null;
  }