/** Default constructor. */
 public BPMN2ObjectImpl() {
   super();
   EClass eClass = eClass();
   // BPMN2 meta model case : all object have an ID
   if (eClass.getEPackage().getName().equals("bpmn2")) {
     EAttribute idAttribute = eClass.getEIDAttribute();
     eSet(idAttribute, EcoreUtil.generateUUID());
   }
 }
Esempio n. 2
0
  private static JsonNode findNode(URI nodeURI, EClass eClass, JsonNode root) {
    EAttribute eID = eClass.getEIDAttribute();
    if (eID == null) {
      final EStructuralFeature featureName = eClass.getEStructuralFeature("name");
      if (featureName != null && featureName instanceof EAttribute) {
        eID = (EAttribute) featureName;
      } else {
        return null;
      }
    }

    String fragment =
        nodeURI.fragment().startsWith("//") ? nodeURI.fragment().substring(2) : nodeURI.fragment();

    for (JsonNode node : root.findParents(eID.getName())) {
      String value = node.get(eID.getName()).getTextValue();
      if (value.equals(fragment)) {
        return node;
      }
    }
    return null;
  }