Exemplo n.º 1
0
 @Override
 public void deletePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo)
     throws ODataApplicationException {
   throw new ODataApplicationException(
       "Primitive property delete is not supported yet.",
       HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(),
       Locale.ENGLISH);
 }
Exemplo n.º 2
0
 @Override
 public void anyUnsupported(ODataRequest request, ODataResponse response)
     throws ODataLibraryException, ODataApplicationException {
   throw new ODataApplicationException(
       ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16049),
       HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(),
       Locale.getDefault());
 }
Exemplo n.º 3
0
 private void checkETag(String entityETag) throws ODataApplicationException {
   if (entityETag != null && !entityETag.equals("*")) {
     throw new ODataApplicationException(
         ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16030),
         HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(),
         Locale.getDefault());
   }
 }
Exemplo n.º 4
0
 @Override
 public void deleteComplex(
     final ODataRequest request, final ODataResponse response, final UriInfo uriInfo)
     throws ODataApplicationException {
   throw new ODataApplicationException(
       "Complex property delete is not supported yet.",
       HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(),
       Locale.ENGLISH);
 }
Exemplo n.º 5
0
  /**
   * Example: For the following navigation: DemoService.svc/Categories(1)/Products we need the
   * EdmEntitySet for the navigation property "Products"
   *
   * <p>This is defined as follows in the metadata: <code>
   *
   * <EntitySet Name="Categories" EntityType="OData.Demo.Category">
   * <NavigationPropertyBinding Path="Products" Target="Products"/>
   * </EntitySet>
   * </code> The "Target" attribute specifies the target EntitySet Therefore we need the
   * startEntitySet "Categories" in order to retrieve the target EntitySet "Products"
   */
  public static EdmEntitySet getNavigationTargetEntitySet(
      EdmEntitySet startEntitySet, EdmNavigationProperty edmNavigationProperty)
      throws ODataApplicationException {

    EdmEntitySet navigationTargetEntitySet = null;

    String navPropName = edmNavigationProperty.getName();
    EdmBindingTarget edmBindingTarget = startEntitySet.getRelatedBindingTarget(navPropName);
    if (edmBindingTarget == null) {
      throw new ODataApplicationException(
          "Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
    }

    if (edmBindingTarget instanceof EdmEntitySet) {
      navigationTargetEntitySet = (EdmEntitySet) edmBindingTarget;
    } else {
      throw new ODataApplicationException(
          "Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
    }

    return navigationTargetEntitySet;
  }
Exemplo n.º 6
0
 @Override
 public void updateEntity(
     final ODataRequest request,
     final ODataResponse response,
     final UriInfo uriInfo,
     final ContentType requestFormat,
     final ContentType responseFormat)
     throws ODataApplicationException, DeserializerException, SerializerException {
   throw new ODataApplicationException(
       "Entity update is not supported yet.",
       HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(),
       Locale.ENGLISH);
 }
Exemplo n.º 7
0
 @Override
 public void updatePrimitiveValue(
     final ODataRequest request,
     ODataResponse response,
     final UriInfo uriInfo,
     final ContentType requestFormat,
     final ContentType responseFormat)
     throws ODataApplicationException, ODataLibraryException {
   throw new ODataApplicationException(
       "Primitive property update is not supported yet.",
       HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(),
       Locale.ENGLISH);
 }
Exemplo n.º 8
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();
  }