public void _deriveAll() {
   this.getKnownType();
   ElementReference type = this.getType();
   if (type != null) {
     type.deriveAll();
   }
 }
 public void checkConstraints(Collection<ConstraintViolation> violations) {
   if (!this.assignedSourceKnownTypeDerivation()) {
     violations.add(new ConstraintViolation("assignedSourceKnownTypeDerivation", this));
   }
   ElementReference type = this.getType();
   if (type != null) {
     type.checkConstraints(violations);
   }
 }
 public void print(String prefix, boolean includeDerived) {
   System.out.println(prefix + "[" + this.getId() + "]" + this._toString(includeDerived));
   ElementReference source = this.getSource();
   if (source != null) {
     System.out.println(prefix + " source:" + source.toString(includeDerived));
   }
   ElementReference type = this.getType();
   if (type != null) {
     System.out.println(prefix + " type:");
     type.print(prefix + "  ", includeDerived);
   }
 }
  public String createNodeInDataBrowser() throws Exception {
    goToWebadminStartPage();
    clickOnTab("Data browser");
    String prevItemHeadline = getCurrentDatabrowserItemSubtitle();

    clickOnButton("Node");

    dataBrowserItemSubtitle.waitForTextToChangeFrom(prevItemHeadline);

    return getCurrentDatabrowserItemSubtitle();
  }
  public String createRelationshipInDataBrowser() throws Exception {
    createNodeInDataBrowser();
    String prevItemHeadline = getCurrentDatabrowserItemSubtitle();

    clickOnButton("Relationship");
    getElement(By.id("create-relationship-to")).sendKeys("0");
    clickOnButton("Create");

    dataBrowserItemSubtitle.waitForTextToChangeFrom(prevItemHeadline);

    return getCurrentDatabrowserItemSubtitle();
  }
  public long createRelationshipInDataBrowser() {
    createNodeInDataBrowser();
    String prevItemHeadline = getCurrentDatabrowserItemSubtitle();

    clickOnButton("Relationship");
    getElement(By.id("create-relationship-to")).sendKeys("0");
    clickOnButton("Create");

    dataBrowserItemSubtitle.waitForTextToChangeFrom(prevItemHeadline);

    return extractEntityIdFromLastSegmentOfUrl(getCurrentDatabrowserItemSubtitle());
  }
Beispiel #7
0
 public void print(String prefix, boolean includeDerived) {
   super.print(prefix, includeDerived);
   if (includeDerived) {
     Collection<AssignedSource> assignmentBefore = this.getAssignmentBefore();
     if (assignmentBefore != null && assignmentBefore.size() > 0) {
       System.out.println(prefix + " /assignmentBefore:");
       for (Object _object : assignmentBefore.toArray()) {
         AssignedSource _assignmentBefore = (AssignedSource) _object;
         System.out.println(prefix + "  " + _assignmentBefore.toString(includeDerived));
       }
     }
   }
   if (includeDerived) {
     Collection<AssignedSource> assignmentAfter = this.getAssignmentAfter();
     if (assignmentAfter != null && assignmentAfter.size() > 0) {
       System.out.println(prefix + " /assignmentAfter:");
       for (Object _object : assignmentAfter.toArray()) {
         AssignedSource _assignmentAfter = (AssignedSource) _object;
         System.out.println(prefix + "  " + _assignmentAfter.toString(includeDerived));
       }
     }
   }
   Expression index = this.getIndex();
   if (index != null) {
     System.out.println(prefix + " index:");
     index.print(prefix + "  ", includeDerived);
   }
   if (includeDerived) {
     ElementReference referent = this.getReferent();
     if (referent != null) {
       System.out.println(prefix + " /referent:" + referent.toString(includeDerived));
     }
   }
   if (includeDerived) {
     ElementReference type = this.getType();
     if (type != null) {
       System.out.println(prefix + " /type:" + type.toString(includeDerived));
     }
   }
 }
Beispiel #8
0
 private void resolveElement(ElementReference elementReference) throws UndefinedElementException {
   if (!elementReference.isResolved()) {
     LOG.logDebug(
         "Resolving reference to element '" + elementReference.getName().getLocalName() + "'.");
     if (elementReference.getName().isInNamespace(this.targetNamespace)) {
       ElementDeclaration element = elementMap.get(elementReference.getName());
       if (element == null) {
         LOG.logDebug("Cannot be resolved!");
         throw new UndefinedElementException(
             "Element '" + elementReference.getName() + "' is not defined.");
       }
       LOG.logDebug("OK.");
       elementReference.resolve(element);
     } else {
       LOG.logDebug("Skipped (not in target namespace).");
       elementReference.resolve();
     }
   }
 }
  /**
   * Obtiene un documento XML con la información de la instancia de la documentación.
   *
   * @param request Obheto HTTPServletRequest para construir URLS
   * @param export Indica si la información en el documento XML estará procesada para exportación
   *     estática.
   * @return Documento XML con la información de la instancia de la documentación.
   */
  public Document getXMLDocument(HttpServletRequest request, boolean export) {
    Document doc = SWBUtils.XML.getNewDocument();
    Process p = getProcessRef();
    Element root = doc.createElement("root");
    root.setAttribute("title", p.getTitle());
    root.setAttribute("uri", p.getURI());
    root.setAttribute("export", String.valueOf(export));
    root.setAttribute("contextPath", SWBPortal.getContextPath());
    doc.appendChild(root);
    String colorTask = "";
    boolean hasModel = false;

    try {
      Iterator<DocumentSectionInstance> itdsi =
          SWBComparator.sortSortableObject(listDocumentSectionInstances());
      while (itdsi.hasNext()) { // Sections
        DocumentSectionInstance dsi = itdsi.next();
        if (!dsi.getSecTypeDefinition().isActive()) {
          continue;
        }
        SemanticClass cls =
            dsi.getSecTypeDefinition() != null
                    && dsi.getSecTypeDefinition().getSectionType() != null
                ? dsi.getSecTypeDefinition().getSectionType().transformToSemanticClass()
                : null;

        if (cls != null) {
          if (cls.equals(Model.sclass)) { // Model
            hasModel = true;
            continue;
          }
          root.appendChild(doc.createTextNode("\n\t"));
          Element section = doc.createElement("section");
          root.appendChild(section);
          section.setAttribute("className", cls.getName());
          section.setAttribute("title", dsi.getSecTypeDefinition().getTitle());
          section.setAttribute("uri", dsi.getURI());
          section.setAttribute("idSection", dsi.getId());
          section.setAttribute("url", cls.getName() + dsi.getId());

          Iterator<SectionElement> itse =
              SWBComparator.sortSortableObject(dsi.listDocuSectionElementInstances());
          int count = 1;
          while (itse.hasNext()) { // Instances
            boolean addInstance = true;
            section.appendChild(doc.createTextNode("\n\t\t"));
            SectionElement se = itse.next();
            //                        System.out.println("Procesando elemento "+se.getURI());
            Element instance = doc.createElement("instance");
            instance.setAttribute("id", se.getId());
            instance.setAttribute("uri", se.getURI());
            instance.setAttribute("className", cls.getName());
            if (cls.isSubClass(Instantiable.swpdoc_Instantiable, false)) { // Elements Instantiable
              //                            System.out.println("  Es un instanciable");
              String[] props = dsi.getSecTypeDefinition().getVisibleProperties().split("\\|");
              for (String propt : props) {
                //                                System.out.println("  -Agregando propiedad
                // "+propt);
                String idprop = propt.substring(propt.indexOf(";") + 1, propt.length());
                String titleprop = propt.substring(0, propt.indexOf(";"));
                SemanticProperty prop =
                    SWBPlatform.getSemanticMgr().getVocabulary().getSemanticPropertyById(idprop);
                String value = "";
                Element property = doc.createElement("property");
                instance.appendChild(property);
                property.setAttribute("title", titleprop);
                property.setAttribute("propid", idprop);
                //                                System.out.println("  -SemanticProperty: "+prop);
                if (prop != null && !prop.getPropId().equals(Referable.swpdoc_file.getPropId())) {
                  //                                    System.out.println("  -Prop is not file
                  // ref");
                  value =
                      (se.getSemanticObject().getProperty(prop) != null
                          ? se.getSemanticObject().getProperty(prop)
                          : "");
                  //                                    System.out.println("  -Prop value: "+value);
                } else { // Show URL download file
                  //                                    System.out.println("  -Prop is file ref");
                  if (se instanceof ElementReference) {
                    ElementReference er = (ElementReference) se;
                    if (er.getElementRef() == null) {
                      dsi.removeDocuSectionElementInstance(er);
                      er.remove();
                      continue;
                    }
                    se = (SectionElement) er.getElementRef();
                  }
                  Referable ref =
                      (Referable)
                          SWBPlatform.getSemanticMgr().getOntology().getGenericObject(se.getURI());
                  if (!ref.hasRepositoryReference()) addInstance = false;
                  //                                    System.out.println("addInstance:
                  // "+addInstance);
                  if (!addInstance) continue;

                  //                                    System.out.println("  ...Continue adding
                  // element");
                  RepositoryDirectory rd = ref.getRefRepository().getRepositoryDirectory();
                  SWBResourceURL urld =
                      new SWBResourceURLImp(
                          request, rd.getResource(), rd, SWBResourceModes.UrlType_RENDER);

                  RepositoryElement re = (RepositoryElement) ref.getRefRepository();
                  VersionInfo vi =
                      ref.getVersion() != null ? ref.getVersion() : re.getLastVersion();
                  urld.setMode(ProcessFileRepository.MODE_GETFILE)
                      .setCallMethod(SWBResourceURL.Call_DIRECT)
                      .setParameter("fid", ref.getRefRepository().getId());
                  urld.setParameter("verNum", vi.getVersionNumber() + "");
                  String urlDownload = urld.toString();
                  if (export) { // add file to zip
                    String basePath =
                        SWBPortal.getWorkPath()
                            + "/models/"
                            + p.getProcessSite().getId()
                            + "/swp_RepositoryFile/"
                            + ref.getRefRepository().getId()
                            + "/"
                            + vi.getVersionNumber()
                            + "/";
                    File baseDir = new File(basePath);
                    String basePathDest =
                        SWBPortal.getWorkPath()
                            + "/models/"
                            + p.getProcessSite().getId()
                            + "/Resource/"
                            + p.getId()
                            + "/download/";
                    File repFile =
                        new File(
                            basePathDest
                                + "rep_files/"
                                + ref.getRefRepository().getId()
                                + "/"
                                + vi.getVersionNumber()
                                + "/");
                    if (!repFile.exists()) {
                      repFile.mkdirs();
                    }
                    if (baseDir.isDirectory()) {
                      File[] files = baseDir.listFiles();
                      for (File file : files) {
                        urlDownload =
                            "rep_files/"
                                + ref.getRefRepository().getId()
                                + "/"
                                + vi.getVersionNumber()
                                + "/"
                                + file.getName();
                        SWPUtils.copyFile(
                            file.getAbsolutePath(),
                            repFile.getAbsolutePath() + "/" + file.getName());
                        break;
                      }
                    }
                  }
                  if (re instanceof RepositoryFile) {
                    value =
                        "<a target=\"_blank\" href=\""
                            + urlDownload
                            + "\">"
                            + ref.getRefRepository().getTitle()
                            + " <i class=\"fa fa-download\"></i></a>";
                  } else if (re instanceof RepositoryURL) {
                    value =
                        "<a target=\"_blank\" href=\""
                            + vi.getVersionFile()
                            + "\">"
                            + ref.getRefRepository().getTitle()
                            + " <i class=\"fa fa-external-link\"></i></a>";
                  }
                }
                //                                System.out.println("Adding property with val:
                // "+value);
                property.appendChild(doc.createTextNode(value));
              }

            } else if (cls.equals(FreeText.sclass)) { // FreeText
              // Validar el export
              FreeText ft = (FreeText) se;
              String html = ft.getText().replace("&ldquo;", "&quot;");
              html = html.replace("&rdquo;", "&quot;");
              html = html.replace("&ndash;", "-");
              html = html.replace("&mdash;", "-");
              html = html.replace("&bull;", "<li>");
              org.jsoup.nodes.Document d = null;
              if (html != null) {
                d = Jsoup.parse(html);
                Elements elements = d.select("[src]");
                for (org.jsoup.nodes.Element src : elements) {
                  if (src.tagName().equals("img") || src.tagName().equals("iframe")) {
                    String attr = src.attr("src");
                    if (attr.contains("../..")) {
                      src.attr("src", src.attr("src").substring(5));
                    }
                    if (export && !attr.contains("http")) {
                      File file =
                          new File(SWBPortal.getWorkPath() + "/" + src.attr("src").substring(5));
                      String basePathDest =
                          SWBPortal.getWorkPath()
                              + "/models/"
                              + p.getProcessSite().getId()
                              + "/Resource/"
                              + p.getId()
                              + "/download/";
                      File repFile = new File(basePathDest + "rep_files/" + se.getId() + "/");
                      if (!repFile.exists()) {
                        repFile.mkdirs();
                      }
                      SWPUtils.copyFile(
                          file.getAbsolutePath(), repFile.getAbsolutePath() + "/" + file.getName());
                      src.attr("src", "rep_files/" + se.getId() + "/" + file.getName());
                    }
                  }
                }
              }
              instance.appendChild(doc.createTextNode((d != null ? d.html() : "")));
            } else if (cls.equals(Activity.sclass)) { // Activity
              Activity a = (Activity) se;
              Element property = doc.createElement("property");
              instance.appendChild(property);
              property.setAttribute("title", Descriptiveable.swb_title.getLabel());
              property.setAttribute("propid", Descriptiveable.swb_title.getPropId());
              property.appendChild(doc.createTextNode(a.getTitle() != null ? a.getTitle() : ""));

              Element propertyd = doc.createElement("propertyd");
              instance.appendChild(propertyd);
              propertyd.setAttribute("title", Descriptiveable.swb_description.getLabel());
              propertyd.setAttribute("propid", Descriptiveable.swb_description.getPropId());

              String html = a.getDescription();
              org.jsoup.nodes.Document d = null;
              if (html != null) {
                d = Jsoup.parse(html);
                Elements elements = d.select("[src]");
                for (org.jsoup.nodes.Element src : elements) {
                  if (src.tagName().equals("img") || src.tagName().equals("iframe")) {
                    String attr = src.attr("src");
                    if (attr.contains("../..")) {
                      src.attr("src", src.attr("src").substring(5));
                    }
                    if (export && !attr.contains("http")) {
                      File file =
                          new File(SWBPortal.getWorkPath() + "/" + src.attr("src").substring(5));
                      String basePathDest =
                          SWBPortal.getWorkPath()
                              + "/models/"
                              + p.getProcessSite().getId()
                              + "/Resource/"
                              + p.getId()
                              + "/download/";
                      File repFile = new File(basePathDest + "rep_files/" + se.getId() + "/");
                      if (!repFile.exists()) {
                        repFile.mkdirs();
                      }
                      SWPUtils.copyFile(
                          file.getAbsolutePath(), repFile.getAbsolutePath() + "/" + file.getName());
                      src.attr("src", "rep_files/" + se.getId() + "/" + file.getName());
                    }
                  }
                }
              }
              propertyd.appendChild(doc.createTextNode(d != null ? d.html() : ""));

              instance.setAttribute("fill", a.getFill());
              instance.setAttribute("id", a.getActivityRef().getProcessActivity().getId());

              // Activity act = (Activity)
              // SWBPlatform.getSemanticMgr().getOntology().getGenericObject(se.getURI());
              if (a.getFill() != null) {
                if (colorTask.length() > 0) {
                  colorTask += "|";
                }
                colorTask += a.getActivityRef().getProcessActivity().getURI() + ";" + a.getFill();
              }
              Iterator<SectionElementRef> itser =
                  SWBComparator.sortSortableObject(a.listSectionElementRefs());
              if (itser.hasNext()) {
                instance.setAttribute("related", "true");
              } else {
                instance.setAttribute("related", "false");
              }
              Map mapSect = new HashMap();
              while (itser.hasNext()) {
                SectionElementRef ser = itser.next();
                if (ser.getSectionElement() != null) {
                  String uris;
                  if (mapSect.containsKey(ser.getSectionElement().getParentSection())) {
                    uris =
                        mapSect.get(ser.getSectionElement().getParentSection()).toString()
                            + "|"
                            + ser.getSectionElement();
                  } else {
                    uris = ser.getSectionElement().getURI();
                  }
                  mapSect.put(ser.getSectionElement().getParentSection(), uris);
                }
              }
              Iterator itset = mapSect.entrySet().iterator();
              while (itset.hasNext()) {
                Map.Entry e = (Map.Entry) itset.next();
                Element eds = doc.createElement("documentSection");
                instance.appendChild(eds);
                eds.setAttribute("uri", e.getKey().toString());
                DocumentSection ds = (DocumentSection) e.getKey();
                String[] props = ds.getVisibleProperties().split("\\|");
                eds.setAttribute("title", ds.getTitle());
                eds.setAttribute("url", "related" + ds.getId() + "act" + a.getId());

                String[] uris = e.getValue().toString().split("\\|");
                int i = 0;
                for (String uri : uris) {
                  Element related = doc.createElement("related");
                  related.setAttribute("count", i + "");
                  i++;
                  SemanticClass scls = ds.getSectionType().transformToSemanticClass();
                  eds.appendChild(related);
                  related.setAttribute("uri", uri);
                  related.setAttribute("className", scls.getName());
                  SectionElement ser =
                      (SectionElement)
                          SWBPlatform.getSemanticMgr().getOntology().getGenericObject(uri);
                  SemanticObject so = SemanticObject.createSemanticObject(uri);
                  if (so != null) {
                    for (String propt : props) {
                      String idprop = propt.substring(propt.indexOf(";") + 1, propt.length());
                      String titleprop = propt.substring(0, propt.indexOf(";"));
                      SemanticProperty prop =
                          SWBPlatform.getSemanticMgr()
                              .getVocabulary()
                              .getSemanticPropertyById(idprop);
                      Element erprop = doc.createElement("relatedprop");
                      related.appendChild(erprop);
                      erprop.setAttribute("title", titleprop);
                      erprop.setAttribute("propid", idprop);
                      String value = "";
                      if (prop != null
                          && !prop.getPropId().equals(Referable.swpdoc_file.getPropId())) {
                        value =
                            ser.getSemanticObject().getProperty(prop) != null
                                ? ser.getSemanticObject().getProperty(prop)
                                : "";
                      } else { // Show URL download file
                        if (ser instanceof ElementReference) {
                          ElementReference er = (ElementReference) ser;
                          if (er.getElementRef() == null) {
                            dsi.removeDocuSectionElementInstance(er);
                            er.remove();
                            continue;
                          }
                          ser = (SectionElement) er.getElementRef();
                        }
                        Referable ref =
                            (Referable)
                                SWBPlatform.getSemanticMgr()
                                    .getOntology()
                                    .getGenericObject(ser.getURI());
                        RepositoryDirectory rd = ref.getRefRepository().getRepositoryDirectory();
                        SWBResourceURL urld =
                            new SWBResourceURLImp(
                                request, rd.getResource(), rd, SWBResourceModes.UrlType_RENDER);
                        urld.setMode(ProcessFileRepository.MODE_GETFILE)
                            .setCallMethod(SWBResourceURL.Call_DIRECT)
                            .setParameter("fid", ref.getRefRepository().getId());
                        RepositoryElement re = (RepositoryElement) ref.getRefRepository();
                        VersionInfo vi =
                            ref.getVersion() != null ? ref.getVersion() : re.getLastVersion();
                        urld.setParameter("verNum", vi.getVersionNumber() + "");

                        String urlDownload = urld.toString();
                        if (export) { // add file to zip
                          String basePath =
                              SWBPortal.getWorkPath()
                                  + "/models/"
                                  + p.getProcessSite().getId()
                                  + "/swp_RepositoryFile/"
                                  + ref.getRefRepository().getId()
                                  + "/"
                                  + vi.getVersionNumber()
                                  + "/";
                          File baseDir = new File(basePath);
                          String basePathDest =
                              SWBPortal.getWorkPath()
                                  + "/models/"
                                  + p.getProcessSite().getId()
                                  + "/Resource/"
                                  + p.getId()
                                  + "/download/";
                          File repFile =
                              new File(
                                  basePathDest
                                      + "rep_files/"
                                      + ref.getRefRepository().getId()
                                      + "/"
                                      + vi.getVersionNumber()
                                      + "/");
                          if (!repFile.exists()) {
                            repFile.mkdirs();
                          }
                          if (baseDir.isDirectory()) {
                            File[] files = baseDir.listFiles();
                            for (File file : files) {
                              urlDownload =
                                  "rep_files/"
                                      + ref.getRefRepository().getId()
                                      + "/"
                                      + vi.getVersionNumber()
                                      + "/"
                                      + file.getName();
                              SWPUtils.copyFile(
                                  file.getAbsolutePath(),
                                  repFile.getAbsolutePath() + "/" + file.getName());
                              break;
                            }
                          }
                        }
                        if (re instanceof RepositoryFile) {
                          value =
                              "<a target=\"_blank\" href=\""
                                  + urlDownload
                                  + "\">"
                                  + ref.getRefRepository().getTitle()
                                  + " <i class=\"fa fa-download\"></i></a>";
                        } else if (re instanceof RepositoryURL) {
                          value =
                              "<a target=\"_blank\" href=\""
                                  + vi.getVersionFile()
                                  + "\">"
                                  + ref.getRefRepository().getTitle()
                                  + " <i class=\"fa fa-external-link\"></i></a>";
                        }
                        //                                                if (re instanceof
                        // RepositoryFile) {
                        //                                                    value = "<a href=\"" +
                        // urld + "\">" + ref.getRefRepository().getTitle() + " <i class=\"fa
                        // fa-download\"></i></a>";
                        //                                                } else if (re instanceof
                        // RepositoryURL) {
                        //                                                    value = "<a
                        // target=\"_blank\" href=\"" + vi.getVersionFile() + "\">" +
                        // ref.getRefRepository().getTitle() + " <i class=\"fa
                        // fa-external-link\"></i></a>";
                        //                                                }
                      }
                      erprop.appendChild(doc.createTextNode(value));
                    }
                  }
                }
              }
            }
            if (addInstance) {
              instance.setAttribute("count", count + "");
              count++;
              section.appendChild(instance);
            }
          }
        }
      }
      if (hasModel) {
        Process process = getProcessRef();
        Element model = doc.createElement("model");
        model.setAttribute("id", process.getId());
        root.appendChild(doc.createTextNode("\n\t"));
        String data = process.getData();
        model.appendChild(doc.createTextNode(data));
        root.appendChild(model);
        root.appendChild(doc.createTextNode("\n\t"));
        if (colorTask.length() > 0) {
          Element colorTaskE = doc.createElement("colorTask");
          root.appendChild(doc.createTextNode("\n\t"));

          String[] tasks = colorTask.split("\\|");
          int i = 1;
          String script = "<script>" + "$(document).ready(function(){";
          for (String task : tasks) {
            script +=
                "var colorTask"
                    + i
                    + " = $(document.getElementById('"
                    + task.substring(0, task.lastIndexOf(";"))
                    + "')).attr('style', 'fill:#"
                    + task.substring(task.lastIndexOf(";") + 1, task.length())
                    + "');";
            i++;
          }
          script += "});" + "</script>";
          colorTaskE.appendChild(doc.createTextNode(script + "\n\t\t"));
          root.appendChild(colorTaskE);
          root.appendChild(doc.createTextNode("\n\t"));
        }
      }

    } catch (DOMException doe) {
      log.error("Error on getDocument, DOMEXception" + doe);
    } catch (IOException ioe) {
      log.error("Error on getDocument, IOEXception" + ioe);
    }

    //        try {
    //            // Use a Transformer for output
    //            TransformerFactory tFactory = TransformerFactory.newInstance();
    //            Transformer transformer = tFactory.newTransformer();
    //
    //            DOMSource source = new DOMSource(doc);
    //            StreamResult result = new StreamResult(new FileOutputStream(new
    // File("/Users/hasdai/Documents/xmlDocumentation.xml")));
    //            transformer.transform(source, result);
    //        } catch (Exception ex) {
    //
    //        }

    return doc;
  }
  /**
   * Builds the dependency for a method element.
   *
   * <p>This creates an <code>ElementReference</code> for the given element that points to all the
   * referenced elements, and adds the given element as a dependent element to all the referenced
   * elements. This should only be called once for each method element.
   *
   * @param element A method element.
   * @return A <code>PackageDependency</code>.
   */
  private PackageDependency buildDependencyFor(MethodElement element) {
    if (element == null) {
      return null;
    }

    IConfigurationManager configMgr = LibraryService.getInstance().getConfigurationManager(config);
    if (configMgr != null) {
      SupportingElementData seData = configMgr.getSupportingElementData();
      if (seData != null && seData.isEnabled()) {
        seData.processVariabilityChildren(element, null);
      }
    }

    // Build the dependency on the selectable element/parent only
    MethodElement selectableElement = (MethodElement) LibraryUtil.getSelectable(element);
    if (selectableElement == null) {
      return null;
    }

    PackageDependency dependency = getDependency(selectableElement, true);

    // Remove any existing element reference for this element.
    dependency.removeReference(element);
    /*
    		// Get the VariabilityElement.
    		ContentElement baseElement = null;
    		if (element instanceof ContentElement) {
    			baseElement = (ContentElement) ((ContentElement) element)
    					.getVariabilityBasedOnElement();
    			if (baseElement != null) {
    				// Establish the package reference.
    				EObject selectableBase = LibraryUtil.getSelectable(baseElement);
    				if (selectableBase != null) {
    					PackageReference pkgRef = dependency.getReference(
    							selectableBase, true);

    					if (!pkgRef.hasReference(element, baseElement)) {
    						// Add the detail element reference to the package
    						// reference.
    						VariabilityElementReference ref = new VariabilityElementReference(
    								element, baseElement);
    						pkgRef.addReference(ref);
    					}

    					// Set the dependent of the referenced package.
    					getDependency(selectableBase, true).addDependent(
    							selectableElement);
    				}
    			}
    		}

    		List references = element.eCrossReferences();

    		// Update the dependents of those elements in the list.
    		if (references != null && references.size() > 0) {
    			// Get the selectable references
    			for (Iterator it = references.iterator(); it.hasNext();) {
    				EObject refElement = (EObject) it.next();
    				EObject selectableRef = LibraryUtil.getSelectable(refElement);
    				if (selectableRef != null) {
    					PackageReference pkgRef = dependency.getReference(
    							selectableRef, true);

    					if (element == selectableElement
    							&& refElement == selectableRef) {
    						// No need to add this.
    						continue;
    					}

    					if (!pkgRef.hasReference(element, refElement)) {
    						GeneralReference ref = new GeneralReference(element,
    								refElement);
    						pkgRef.addReference(ref);
    					}

    					getDependency(selectableRef, true).addDependent(
    							selectableElement);
    				}
    			}
    		}
    */
    List properties = LibraryUtil.getStructuralFeatures(element, true);
    for (int i = 0; i < properties.size(); i++) {
      EStructuralFeature f = (EStructuralFeature) properties.get(i);
      if (!(f instanceof EReference)) {
        continue;
      }

      EReference feature = (EReference) f;
      if (feature.isContainer() || feature.isContainment()) {
        continue;
      }

      if (element instanceof Task) {
        if (feature == UmaPackage.eINSTANCE.getTask_Steps()) {
          continue;
        }
      }

      if (element instanceof TaskDescriptor) {
        if (feature == UmaPackage.eINSTANCE.getTaskDescriptor_SelectedSteps()) {
          continue;
        }
      }

      Object value = TypeDefUtil.getInstance().eGet(element, feature);
      if (value == null) {
        continue;
      }

      MethodElement refElement = null;
      List values = null;
      int count = 0;

      if (feature.isMany()) {
        values = (List) value;
        if (values.size() > 0) {
          refElement = (MethodElement) values.get(count);
        }
      } else if (value instanceof MethodElement) {
        refElement = (MethodElement) value;

        if (replacerSet != null) {
          if (feature == UmaPackage.eINSTANCE.getVariabilityElement_VariabilityBasedOnElement()) {
            VariabilityElement ve =
                element instanceof VariabilityElement ? (VariabilityElement) element : null;
            VariabilityType type = ve == null ? null : ve.getVariabilityType();
            if (type == VariabilityType.EXTENDS_REPLACES || type == VariabilityType.REPLACES) {
              replacerSet.add(ve);
            }
          }
        }
      }

      while (refElement != null) {

        boolean skip = false;
        if (feature == UmaPackage.eINSTANCE.getRole_Modifies()) {
          skip = true;
        }

        MethodElement selectableRef =
            skip ? null : (MethodElement) LibraryUtil.getSelectable(refElement);
        if (selectableRef != null) {
          PackageReference pkgRef = dependency.getReference(selectableRef, true);

          if (element == selectableElement && refElement == selectableRef) {
            // No need to add this.
            break;
          }

          ElementReference ref = pkgRef.getReference(element, refElement);
          if (ref == null) {
            ref = new ElementReference(element, refElement);
            pkgRef.addReference(ref);
          }

          ref.addFeature(feature);

          getDependency(selectableRef, true).addDependent(selectableElement);
        }

        refElement = null;
        if (values != null) {
          count++;
          if (count < values.size()) {
            refElement = (MethodElement) values.get(count);
          }
        }
      }
    }

    return dependency;
  }
 public String getCurrentDatabrowserItemSubtitle() {
   return dataBrowserItemSubtitle.getText();
 }
 public void searchForInDataBrowser(CharSequence... keysToSend) throws Exception {
   clearInput(dataBrowserSearchField);
   dataBrowserSearchField.sendKeys(keysToSend);
 }
 public void searchForInDataBrowser(String query) {
   dataBrowserSearchField.waitUntilVisible();
   executeScript("document.dataBrowserEditor.setValue(\"" + query + "\")");
   dataBrowserSearchButton.click();
 }
 public void writeTo(By by, CharSequence... toWrite) {
   ElementReference el = getElement(by);
   el.click();
   el.clear();
   el.sendKeys(toWrite);
 }