Class BatchResponse

java.lang.Object
com.sap.cloud.sdk.datamodel.odatav4.core.BatchResponse
All Implemented Interfaces:
AutoCloseable

public final class BatchResponse extends Object implements AutoCloseable
Generic OData service response wrapper for Batch response.
  • Method Details

    • of

      @Nonnull public static BatchResponse of(@Nonnull ODataRequestResultMultipartGeneric response, @Nonnull BatchRequestBuilder initialRequest)
      Static factory method to convert from generic response to typed response.
      Parameters:
      response - The generic response that should be converted.
      initialRequest - The initial BatchRequest
      Returns:
      The typed (high-level) BatchResponse object.
    • getResponseStatusCode

      public int getResponseStatusCode()
      Get the response status code.
      Returns:
      The integer representation of the HTTP status code.
    • getResponseHeaders

      @Nonnull public Map<String,Iterable<String>> getResponseHeaders()
      Get the response headers.
      Returns:
      The headers of the HTTP status code.
    • getReadResult

      @Nonnull public <T extends VdmEntity<?>> List<T> getReadResult(@Nonnull GetAllRequestBuilder<T> operation)
      Extract the batch item result for the provided OData request.
      Type Parameters:
      T - The generic entity type.
      Parameters:
      operation - The OData operation that was used in the OData batch request.
      Returns:
      The list of entities as result of the request.
      Throws:
      ODataResponseException - When the OData batch response cannot be parsed.
      IllegalArgumentException - When the provided request reference could not be found in the original batch request.
    • getReadResult

      @Nonnull public <T> List<T> getReadResult(@Nonnull CollectionValueFunctionRequestBuilder<T> operation)
      Extract the batch item result for the provided OData request.
      Type Parameters:
      T - The generic object type.
      Parameters:
      operation - The OData operation that was used in the OData batch request.
      Returns:
      The list of objects as result of the request.
      Throws:
      ODataResponseException - When the OData batch response cannot be parsed.
      IllegalArgumentException - When the provided request reference could not be found in the original batch request.
    • getReadResult

      @Nonnull public <T extends VdmEntity<?>> T getReadResult(@Nonnull GetByKeyRequestBuilder<T> operation)
      Extract the batch item result for the provided OData request.
      Type Parameters:
      T - The generic entity type.
      Parameters:
      operation - The OData operation that was used in the OData batch request.
      Returns:
      The list of entities as result of the request.
      Throws:
      ODataResponseException - When the OData batch response cannot be parsed.
      IllegalArgumentException - When the provided request reference could not be found in the original batch request.
    • getReadResult

      @Nonnull public <T> T getReadResult(@Nonnull SingleValueFunctionRequestBuilder<T> operation)
      Extract the batch item result for the provided OData request.
      Type Parameters:
      T - The generic object type.
      Parameters:
      operation - The OData operation that was used in the OData batch request.
      Returns:
      The object as result of the request.
      Throws:
      ODataResponseException - When the OData batch response cannot be parsed.
      IllegalArgumentException - When the provided request reference could not be found in the original batch request.
    • getModificationResult

      @Nonnull public <EntityT extends VdmEntity<?>> ModificationResponse<EntityT> getModificationResult(@Nonnull CreateRequestBuilder<EntityT> operation)
      Extract the batch item result for the provided OData request.
      Type Parameters:
      EntityT - The generic entity type.
      Parameters:
      operation - The OData operation that was used in the OData batch request.
      Returns:
      The generic modification response wrapper object as result of the modification request.
      Throws:
      ODataResponseException - When the OData batch response cannot be parsed.
      IllegalArgumentException - When the provided request reference could not be found in the original batch request.
    • getModificationResult

      @Nonnull public <EntityT extends VdmEntity<?>> ModificationResponse<EntityT> getModificationResult(@Nonnull UpdateRequestBuilder<EntityT> operation)
      Extract the batch item result for the provided OData request.
      Type Parameters:
      EntityT - The generic entity type.
      Parameters:
      operation - The OData operation that was used in the OData batch request.
      Returns:
      The generic modification response wrapper object as result of the modification request.
      Throws:
      ODataResponseException - When the OData batch response cannot be parsed.
      IllegalArgumentException - When the provided request reference could not be found in the original batch request.
    • getModificationResult

      @Nonnull public <EntityT extends VdmEntity<?>> ModificationResponse<EntityT> getModificationResult(@Nonnull DeleteRequestBuilder<EntityT> operation)
      Extract the batch item result for the provided OData request.
      Type Parameters:
      EntityT - The generic entity type.
      Parameters:
      operation - The OData operation that was used in the OData batch request.
      Returns:
      The generic modification response wrapper object as result of the modification request.
      Throws:
      ODataResponseException - When the OData batch response cannot be parsed.
      IllegalArgumentException - When the provided request reference could not be found in the original batch request.
    • getModificationResult

      @Nonnull public <T> ActionResponseSingle<T> getModificationResult(@Nonnull SingleValueActionRequestBuilder<T> operation)
      Extract the batch item result for the provided OData request.
      Type Parameters:
      T - The generic object type.
      Parameters:
      operation - The OData operation that was used in the OData batch request.
      Returns:
      The generic action response wrapper object as result of the OData action request.
      Throws:
      ODataResponseException - When the OData batch response cannot be parsed.
      IllegalArgumentException - When the provided request reference could not be found in the original batch request.
    • getModificationResult

      @Nonnull public <T> ActionResponseCollection<T> getModificationResult(@Nonnull CollectionValueActionRequestBuilder<T> operation)
      Extract the batch item result for the provided OData request.
      Type Parameters:
      T - The generic object type.
      Parameters:
      operation - The OData operation that was used in the OData batch request.
      Returns:
      The generic action response wrapper object as result of the OData action request.
      Throws:
      ODataResponseException - When the OData batch response cannot be parsed.
      IllegalArgumentException - When the provided request reference could not be found in the original batch request.
    • close

      @Beta public void close()
      Closes the underlying HTTP response entity.
      Specified by:
      close in interface AutoCloseable
      Since:
      4.15.0
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object