Class BatchResponse
java.lang.Object
com.sap.cloud.sdk.datamodel.odatav4.core.BatchResponse
- All Implemented Interfaces:
AutoCloseable
Generic OData service response wrapper for Batch response.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the underlying HTTP response entity.boolean
<T> ActionResponseCollection<T>
getModificationResult
(CollectionValueActionRequestBuilder<T> operation) Extract the batch item result for the provided OData request.<EntityT extends VdmEntity<?>>
ModificationResponse<EntityT>getModificationResult
(CreateRequestBuilder<EntityT> operation) Extract the batch item result for the provided OData request.<EntityT extends VdmEntity<?>>
ModificationResponse<EntityT>getModificationResult
(DeleteRequestBuilder<EntityT> operation) Extract the batch item result for the provided OData request.<T> ActionResponseSingle<T>
getModificationResult
(SingleValueActionRequestBuilder<T> operation) Extract the batch item result for the provided OData request.<EntityT extends VdmEntity<?>>
ModificationResponse<EntityT>getModificationResult
(UpdateRequestBuilder<EntityT> operation) Extract the batch item result for the provided OData request.<T> List<T>
getReadResult
(CollectionValueFunctionRequestBuilder<T> operation) Extract the batch item result for the provided OData request.getReadResult
(GetAllRequestBuilder<T> operation) Extract the batch item result for the provided OData request.<T extends VdmEntity<?>>
TgetReadResult
(GetByKeyRequestBuilder<T> operation) Extract the batch item result for the provided OData request.<T> T
getReadResult
(SingleValueFunctionRequestBuilder<T> operation) Extract the batch item result for the provided OData request.Get the response headers.int
Get the response status code.int
hashCode()
static BatchResponse
of
(ODataRequestResultMultipartGeneric response, BatchRequestBuilder initialRequest) Static factory method to convert from generic response to typed response.toString()
-
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
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
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
public void close()Closes the underlying HTTP response entity.- Specified by:
close
in interfaceAutoCloseable
- Since:
- 4.15.0
-
equals
-
hashCode
public int hashCode() -
toString
-