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.public abstract class FluentHelperBasic<FluentHelperT,EntityT,ResultT> extends Object
executing
it.Constructor and Description |
---|
FluentHelperBasic(String servicePath)
Instantiates this fluent helper using the given service path to send the requests.
|
Modifier and Type | Method and Description |
---|---|
ODataRequestCommand<ResultT> |
asResilientCommand()
This method will take the OData requests on which it is called and return an
ODataRequestCommand that
wraps the request. |
ODataRequestCommand<ResultT> |
asResilientCommand(ErpConfigContext configContext)
This method will take the OData requests on which it is called and return an
ODataRequestCommand that
wraps the request and will use the given ERP configuration context for executing the request. |
FluentHelperT |
cachingMetadata()
Enables tenant-isolated caching of the metadata document of an OData API.
|
ResultT |
execute()
Executes the underlying query using the stored values, plus any query modifiers that were previously called.
|
abstract ResultT |
execute(ErpConfigContext configContext)
Executes the underlying query using the stored values, plus any query modifiers that were previously called.
|
protected abstract Class<? extends EntityT> |
getEntityClass()
Returns a class object of the type this fluent helper works with.
|
protected Map<String,String> |
getHeadersForRequestAndImplicitRequests()
A map containing the headers to be used for all implicit requests that are part of this FluentHelper
implementation (metadata, csrf, ...).
|
protected Map<String,String> |
getHeadersForRequestOnly()
A map containing the headers to be used only for the actual request of this FluentHelper implementation.
|
protected Map<String,String> |
getParametersForRequestOnly()
A map containing the custom query parameters to be used only for the actual request of this FluentHelper
implementation.
|
protected String |
getServicePath() |
protected FluentHelperT |
getThis() |
protected String |
getVersionIdentifier(com.sap.cloud.sdk.odatav2.connectivity.internal.ODataHttpResponseWrapper response) |
protected boolean |
isCachingMetadata() |
FluentHelperCustomHttpHeader<FluentHelperT> |
withCustomHttpHeader(String key,
String value)
Gives the option to specify custom HTTP headers.
|
FluentHelperCustomHttpHeader<FluentHelperT> |
withCustomHttpHeaders(Map<String,String> map)
Gives the option to specify a map of custom HTTP headers.
|
protected FluentHelperT |
withCustomQueryParameter(String key,
String value)
Gives the option to specify custom query parameters for the request.
|
FluentHelperT |
withoutCachingMetadata()
Disables caching of the metadata document of OData APIs.
|
@Nonnull protected abstract Class<? extends EntityT> getEntityClass()
@Nonnull protected FluentHelperT getThis()
public abstract ResultT execute(@Nonnull ErpConfigContext configContext) throws com.sap.cloud.sdk.odatav2.connectivity.ODataException
configContext
- Supply the ERP system context for executing the underlying OData query.com.sap.cloud.sdk.odatav2.connectivity.ODataException
ErpConfigContext.ErpConfigContext()
public ResultT execute() throws com.sap.cloud.sdk.odatav2.connectivity.ODataException
com.sap.cloud.sdk.odatav2.connectivity.ODataException
ErpConfigContext.ErpConfigContext()
@Nonnull public FluentHelperCustomHttpHeader<FluentHelperT> withCustomHttpHeader(@Nonnull String key, @Nullable String value)
key
- Name of the (first) desired HTTP header parameter.value
- Value of the (first) desired HTTP header parameter.@Nonnull public FluentHelperCustomHttpHeader<FluentHelperT> withCustomHttpHeaders(@Nonnull Map<String,String> map)
map
- A map of HTTP header key/value pairs.@Nonnull protected FluentHelperT withCustomQueryParameter(@Nonnull String key, @Nullable String value)
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() .withCustomQueryParameter("$search", "Köln OR Cologne")
key
- Name of the query parameter.value
- Value of the query parameter.@Nullable protected String getVersionIdentifier(@Nonnull com.sap.cloud.sdk.odatav2.connectivity.internal.ODataHttpResponseWrapper response)
@Nonnull public ODataRequestCommand<ResultT> asResilientCommand(@Nonnull ErpConfigContext configContext)
ODataRequestCommand
that
wraps the request and will use the given ERP configuration context for executing the request. Note, that the
command returned by this method has no fallback configured. You can do so by using the method
ODataRequestCommand.withFallback(Function)
.configContext
- Supply the ERP system context for executing the underlying OData query.@Nonnull public ODataRequestCommand<ResultT> asResilientCommand()
ODataRequestCommand
that
wraps the request. The command will use the default ERP configuration context. Note, that the command returned by
this method has no fallback configured. You can do so by using the function
ODataRequestCommand.withFallback(Function)
.@Nonnull @Beta public FluentHelperT cachingMetadata()
Enables tenant-isolated caching of the metadata document of an OData API. That is, the metadata is not retrieved again for subsequent calls, after it was fetched once.
Only use this caching when the metadata does not get updated during the application runs.
By default, the caching is disabled.
Use withoutCachingMetadata()
to disable the metadata caching.
@Nonnull @Beta public FluentHelperT withoutCachingMetadata()
Disables caching of the metadata document of OData APIs. That is, the metadata is retrieved along with every OData request.
By default, the caching is disabled.
Use cachingMetadata
to enable the metadata caching.
protected boolean isCachingMetadata()
protected Map<String,String> getHeadersForRequestAndImplicitRequests()
protected Map<String,String> getHeadersForRequestOnly()
Copyright © 2019 SAP SE. All rights reserved.