Esempio n. 1
0
  private Representation resolveRepresentation(Representation representation) {
    String href = representation.getHref();
    if (!StringUtils.hasContent(href)) {
      return representation;
    }

    try {
      Application app = application;

      if (!href.startsWith("#")) {
        ApplicationDocument applicationDocument = loadReferencedWadl(href);
        app = applicationDocument.getApplication();
      }

      if (app != null) {
        int ix = href.lastIndexOf('#');
        if (ix >= 0) {
          href = href.substring(ix + 1);
        }

        for (Representation m : application.getRepresentationList()) {
          if (m.getId().equals(href)) {
            return m;
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    return representation;
  }
Esempio n. 2
0
 private void addRepresentationFromConfig(
     RestMethod restMethod,
     Representation representation,
     RestRepresentation.Type type,
     List<?> status) {
   RestRepresentation restRepresentation = restMethod.addNewRepresentation(type);
   restRepresentation.setMediaType(representation.getMediaType());
   restRepresentation.setElement(representation.getElement());
   if (status != null) {
     restRepresentation.setStatus(status);
   }
   restRepresentation.setId(representation.getId());
   restRepresentation.setDescription(getFirstTitle(representation.getDocList(), null));
 }