Ejemplo n.º 1
0
 private Entity readEntityInternal(final UriInfoResource uriInfo, final EdmEntitySet entitySet)
     throws DataProvider.DataProviderException {
   // This method will extract the key values and pass them to the data provider
   final UriResourceEntitySet resourceEntitySet =
       (UriResourceEntitySet) uriInfo.getUriResourceParts().get(0);
   return dataProvider.read(entitySet, resourceEntitySet.getKeyPredicates());
 }
Ejemplo n.º 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();
  }
Ejemplo n.º 3
0
 private void checkExpand(UriInfoResource queryInfo) {
   if (queryInfo.getExpandOption() != null
       && !queryInfo.getExpandOption().getExpandItems().isEmpty()) {
     throw new UnsupportedOperationException("Expand is not supported"); // $NON-NLS-1$
   }
 }