示例#1
0
 @Override
 public void upsertStreamProperty(
     DataRequest request, String entityETag, InputStream streamContent, NoContentResponse response)
     throws ODataLibraryException, ODataApplicationException {
   UpdateResponse updateResponse = null;
   EdmProperty edmProperty = request.getUriResourceProperty().getProperty();
   try {
     ODataSQLBuilder visitor =
         new ODataSQLBuilder(
             this.odata,
             getClient().getMetadataStore(),
             this.prepared,
             false,
             request.getODataRequest().getRawBaseUri(),
             this.serviceMetadata,
             this.nameGenerator);
     visitor.visit(request.getUriInfo());
     Update update = visitor.updateStreamProperty(edmProperty, streamContent);
     updateResponse = getClient().executeUpdate(update, visitor.getParameters());
   } catch (SQLException | TeiidException e) {
     throw new ODataApplicationException(
         e.getMessage(),
         HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(),
         Locale.getDefault(),
         e);
   }
   if (updateResponse != null && updateResponse.getUpdateCount() > 0) {
     response.writeNoContent();
   } else {
     response.writeNotModified();
   }
 }