Class FluentHelperBasic<FluentHelperT,EntityT,ResultT>
java.lang.Object
com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperBasic<FluentHelperT,EntityT,ResultT>
- Type Parameters:
FluentHelperT
- The fluent helper type.EntityT
- The type of the entity this OData request operates on, if any.ResultT
- The type of the result entity, if any.
- All Implemented Interfaces:
FluentHelperExecutable<Object>
- Direct Known Subclasses:
FluentHelperByKey
,FluentHelperFunction
,FluentHelperModification
,FluentHelperRead
public abstract class FluentHelperBasic<FluentHelperT,EntityT,ResultT>
extends Object
implements FluentHelperExecutable<Object>
Representation of any OData request as a fluent interface for further configuring the request and
executing
it.-
Field Summary
Modifier and TypeFieldDescriptionprotected CsrfTokenRetriever
The CSRF token retriever to be used for all explicit and implicit requests that are part of this FluentHelper implementation.protected String
The entity collection to send the OData requests to -
Constructor Summary
ConstructorDescriptionFluentHelperBasic
(String servicePath, String entityCollection) Instantiates this fluent helper using the given service path to send the requests. -
Method Summary
Modifier and TypeMethodDescriptionabstract ResultT
executeRequest
(Destination destination) Executes this request.protected CsrfTokenRetriever
The CSRF token retriever to be used for all explicit and implicit requests that are part of this FluentHelper implementation.Returns a class object of the type this fluent helper works with.Get all headers for explicit and implicit requests.A map containing the custom query parameters to be used only for the actual request of this FluentHelper implementation.protected String
protected FluentHelperT
getThis()
Returns the current fluent helper instance.abstract ODataRequestGeneric
Translate this OData v2 request into a OData request object extendingODataRequestGeneric
.withHeader
(String key, String value) Gives the option to specify custom HTTP headers.withHeaders
(Map<String, String> map) Gives the option to specify a map of custom HTTP headers.protected FluentHelperT
withQueryParameter
(String key, String value) Gives the option to specify custom query parameters for the request.
-
Field Details
-
entityCollection
The entity collection to send the OData requests to -
csrfTokenRetriever
The CSRF token retriever to be used for all explicit and implicit requests that are part of this FluentHelper implementation.
-
-
Constructor Details
-
FluentHelperBasic
Instantiates this fluent helper using the given service path to send the requests.- Parameters:
servicePath
- The service path to direct the requests to.entityCollection
- The entity collection to direct the requests to.
-
-
Method Details
-
getEntityClass
Returns a class object of the type this fluent helper works with.- Returns:
- A class object of the handled type.
-
getThis
Returns the current fluent helper instance.- Returns:
- The current fluent helper instance.
-
executeRequest
Description copied from interface:FluentHelperExecutable
Executes this request.- Specified by:
executeRequest
in interfaceFluentHelperExecutable<FluentHelperT>
- Parameters:
destination
- The target system this request should be issued against.- Returns:
- A response according to the query criteria.
-
getHeaders
Get all headers for explicit and implicit requests.- Returns:
- a map containing the headers for actual request and implicit requests, e.g. csrf token request. A map containing the headers to be used for all implicit requests that are part of this FluentHelper implementation (csrf, ...).
-
withHeader
Gives the option to specify custom HTTP headers. The returned object allows to specify the requests the headers should be used in.- Parameters:
key
- Name of the (first) desired HTTP header parameter.value
- Value of the (first) desired HTTP header parameter.- Returns:
- A fluent helper to specify further headers and their intended usage.
-
withHeaders
Gives the option to specify a map of custom HTTP headers. The returned object allows to specify the requests the headers should be used in.- Parameters:
map
- A map of HTTP header key/value pairs.- Returns:
- A fluent helper to specify further headers and their intended usage.
-
withQueryParameter
Gives the option to specify custom query parameters for the request. The passed parameter value will be encoded with percentage encoding.Note: It is recommended to only use this function for query parameters which are not supported by the VDM by default. Using this function to bypass fluent helper method calls can lead to unsupported response handling. There is no contract on the order or priority of parameters added to the query.
Example: Use the query option
$search
to reduce the result set, leaving only entities which match the specified search expression. This feature is supported in protocol OData v4.new DefaultBusinessPartnerService().getAllBusinessPartner().withQueryParameter("$search", "Köln OR Cologne")
- Parameters:
key
- Name of the query parameter.value
- Unencoded value of the query parameter.- Returns:
- The same fluent helper.
-
toRequest
Translate this OData v2 request into a OData request object extendingODataRequestGeneric
.- Returns:
- A protocol agnostic OData request instance.
-
getServicePath
-
getParametersForRequestOnly
A map containing the custom query parameters to be used only for the actual request of this FluentHelper implementation. -
getCsrfTokenRetriever
The CSRF token retriever to be used for all explicit and implicit requests that are part of this FluentHelper implementation.
-