FluentHelperT
- The fluent helper type.ObjectT
- The type of the object this OData request operates on, if any.ResultT
- The type of the result entity, if any.public abstract class FluentHelperFunction<FluentHelperT,ObjectT,ResultT> extends FluentHelperBasic<FluentHelperT,ObjectT,ResultT>
executing
it.Constructor and Description |
---|
FluentHelperFunction(String servicePath)
Instantiates this fluent helper using the given service path to send the requests.
|
Modifier and Type | Method and Description |
---|---|
protected abstract org.apache.http.client.methods.HttpUriRequest |
createRequest(URI uri)
Creates a request for this function based on the given
URI . |
protected List<ObjectT> |
executeMultiple(HttpDestinationProperties destination)
Default implementation for the case that this function returns a collection of entries.
|
ResultT |
executeRequest(HttpDestinationProperties destination)
Executes function import request.
|
protected ObjectT |
executeSingle(HttpDestinationProperties destination)
Default implementation for the case that this function returns a single type.
|
protected abstract String |
getFunctionName()
The exact name of the function to be called on the OData Endpoint.
|
protected String |
getJsonResponseObjectName()
Deprecated.
In order to customize JSON response parsing, use
refineJsonResponse(com.google.gson.JsonElement) instead. |
protected abstract Map<String,Object> |
getParameters()
Getter for the map of parameters to be used in the function call.
|
protected com.google.gson.JsonElement |
refineJsonResponse(com.google.gson.JsonElement jsonElement)
Transform the JSON element from the response to extract a result entity.
|
ODataRequestGeneric |
toRequest()
Translate this OData v2 request into a OData request object extending
ODataRequestGeneric . |
and, cachingMetadata, execute, getEntityClass, getHeaders, getHeadersForRequestAndImplicitRequests, getHeadersForRequestOnly, getParametersForRequestOnly, getServicePath, getThis, getVersionIdentifier, isCachingMetadata, onRequestAndImplicitRequests, onRequestOnly, withHeader, withHeaders, withoutCachingMetadata, withQueryParameter
@Nonnull protected abstract Map<String,Object> getParameters()
The map maps the ODataName of a parameter to the corresponding value.
@Nonnull protected abstract String getFunctionName()
@Nonnull protected abstract org.apache.http.client.methods.HttpUriRequest createRequest(@Nonnull URI uri)
URI
.
Examples for such requests are HttpGet
and HttpPost
.
uri
- The URI
the request should target.@Beta @Nonnull public ODataRequestGeneric toRequest()
FluentHelperBasic
ODataRequestGeneric
.@Nullable protected ObjectT executeSingle(@Nonnull HttpDestinationProperties destination) throws com.sap.cloud.sdk.odatav2.connectivity.ODataException
This method can be used in subclasses to implement the FluentHelperBasic.execute(HttpDestinationProperties)
method.
destination
- The destination to run the function against.null
if the function did not return a
result.com.sap.cloud.sdk.odatav2.connectivity.ODataException
@Nonnull protected List<ObjectT> executeMultiple(@Nonnull HttpDestinationProperties destination) throws com.sap.cloud.sdk.odatav2.connectivity.ODataException
This method can be used in subclasses to implement the FluentHelperBasic.execute(HttpDestinationProperties)
method.
destination
- The destination to run the function against.com.sap.cloud.sdk.odatav2.connectivity.ODataException
- If the execution of the function failed.@Deprecated @Nonnull protected String getJsonResponseObjectName()
refineJsonResponse(com.google.gson.JsonElement)
instead.@Nullable protected com.google.gson.JsonElement refineJsonResponse(@Nullable com.google.gson.JsonElement jsonElement)
jsonElement
- The optional response JSON element@Nullable public ResultT executeRequest(@Nonnull HttpDestinationProperties destination) throws ODataException
executeRequest
in interface FluentHelperExecutable<Object>
executeRequest
in class FluentHelperBasic<FluentHelperT,ObjectT,ResultT>
destination
- The target system this request should be issued against.ODataException
- If the OData request execution failed. Please find the documentation for ODataException
possible sub-types and error scenarios they can occur in.Copyright © 2021 SAP SE. All rights reserved.