/*
   * (non-Javadoc)
   *
   * @see
   * com.rohitghatol.spring.odata.edm.providers.EntityProvider#getEntitySet
   * (org.apache.olingo.server.api.uri.UriInfo)
   */
  @Override
  public EntitySet getEntitySet(UriInfo uriInfo) {
    List<UriResource> resourcePaths = uriInfo.getUriResourceParts();

    UriResourceEntitySet uriResourceEntitySet =
        (UriResourceEntitySet)
            resourcePaths.get(0); // in our example, the first segment is the EntitySet

    EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();

    EntitySet entitySet = getData(edmEntitySet);

    return entitySet;
  }
Example #2
0
  public static EdmEntitySet getEdmEntitySet(UriInfoResource uriInfo)
      throws ODataApplicationException {

    List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
    // To get the entity set we have to interpret all URI segments
    if (!(resourcePaths.get(0) instanceof UriResourceEntitySet)) {
      // Here we should interpret the whole URI but in this example we do not support navigation so
      // we throw an
      // exception
      throw new ODataApplicationException(
          "Invalid resource type for first segment.",
          HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(),
          Locale.ENGLISH);
    }

    UriResourceEntitySet uriResource = (UriResourceEntitySet) resourcePaths.get(0);

    return uriResource.getEntitySet();
  }