Class SingleValueActionRequestBuilder<ResultT>
java.lang.Object
com.sap.cloud.sdk.datamodel.odatav4.core.ActionRequestBuilder<SingleValueActionRequestBuilder<ResultT>,ActionResponseSingle<ResultT>>
com.sap.cloud.sdk.datamodel.odatav4.core.SingleValueActionRequestBuilder<ResultT>
- Type Parameters:
ResultT
- The type of the result entity or complex type or primitive type, if any. For actions that return a single value or nothing, the result is wrapped inside a
instance.
- All Implemented Interfaces:
ModificationRequestBuilder<ActionResponseSingle<ResultT>>
,RequestBuilder<ActionResponseSingle<ResultT>>
,RequestBuilderExecutable<ActionResponseSingle<ResultT>>
public class SingleValueActionRequestBuilder<ResultT>
extends ActionRequestBuilder<SingleValueActionRequestBuilder<ResultT>,ActionResponseSingle<ResultT>>
Representation of an OData action request as a fluent interface for further configuring the request and
executing
it. This one handles actions where the return type is a single primitive or
entity value or complex type. It also handles actions with no return type.-
Field Summary
-
Constructor Summary
ConstructorDescriptionSingleValueActionRequestBuilder
(String servicePath, ODataResourcePath actionPath, Map<String, Object> parameters, Class<ResultT> resultClass) Instantiates this request builder using the given service path to send the requests.SingleValueActionRequestBuilder
(String servicePath, String actionName, Class<ResultT> resultClass) Instantiates this request builder using the given service path to send the requests.SingleValueActionRequestBuilder
(String servicePath, String actionName, Map<String, Object> parameters, Class<ResultT> resultClass) Instantiates this request builder using the given service path to send the requests. -
Method Summary
Modifier and TypeMethodDescriptionexecute
(Destination destination) Execute the OData request.protected Map<String,
Collection<String>> A map containing the headers to be used only for the actual request of this FluentHelper implementation.protected List<ODataRequestListener>
A map containing the custom query parameters to be used only for the actual request of this FluentHelper implementation.protected ODataResourcePath
protected String
protected SingleValueActionRequestBuilder<ResultT>
getThis()
Get the reference to this instance.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.withListener
(ODataRequestListener listener) An error handling class that implements the error result handler interface can be attached to this request builder.withQueryParameter
(String key, String value) Gives the option to specify custom query parameters for the request.Methods inherited from class com.sap.cloud.sdk.datamodel.odatav4.core.ActionRequestBuilder
toRequest, withoutCsrfToken
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sap.cloud.sdk.datamodel.odatav4.core.RequestBuilder
withHeader, withHeaders
Methods inherited from interface com.sap.cloud.sdk.datamodel.odatav4.core.RequestBuilderExecutable
tryExecute
-
Field Details
-
csrfTokenRetriever
-
-
Constructor Details
-
SingleValueActionRequestBuilder
public SingleValueActionRequestBuilder(@Nonnull String servicePath, @Nonnull String actionName, @Nonnull Class<ResultT> resultClass) Instantiates this request builder using the given service path to send the requests.- Parameters:
servicePath
- The service path to direct the requests to.actionName
- The name of the unbound actionresultClass
- The expected return type of the action.
-
SingleValueActionRequestBuilder
public SingleValueActionRequestBuilder(@Nonnull String servicePath, @Nonnull String actionName, @Nonnull Map<String, Object> parameters, @Nonnull Class<ResultT> resultClass) Instantiates this request builder using the given service path to send the requests.- Parameters:
servicePath
- The service path to direct the requests to.actionName
- The name of the unbound actionparameters
- The parameters passed to the action.resultClass
- The expected return type of the action.
-
SingleValueActionRequestBuilder
public SingleValueActionRequestBuilder(@Nonnull String servicePath, @Nonnull ODataResourcePath actionPath, @Nonnull Map<String, Object> parameters, @Nonnull Class<ResultT> resultClass) Instantiates this request builder using the given service path to send the requests.- Parameters:
servicePath
- The service path to direct the requests to.actionPath
- The path to the unbound actionparameters
- The parameters passed to the action.resultClass
- The expected return type of the action.
-
-
Method Details
-
execute
Description copied from interface:RequestBuilderExecutable
Execute the OData request.- Parameters:
destination
- The destination to be used as request target.- Returns:
- The generic OData response result.
-
getResultClass
-
getThis
Get the reference to this instance.- Returns:
- The FluentHelper instance.
-
withListener
@Nonnull public SingleValueActionRequestBuilder<ResultT> withListener(@Nonnull ODataRequestListener listener) An error handling class that implements the error result handler interface can be attached to this request builder. This allows custom logic to be called when an error occurs in theexecute
method. If this method is not called, then an instance of ODataRequestListener is used. Only one handler can be attached at a time per request builder object, so calling this multiple times will replace the handler.- Parameters:
listener
- Instance of an error handler class that implements the error result handler interface.- Returns:
- The same request builder with its error handler set to the provided object.
-
withHeader
@Nonnull public SingleValueActionRequestBuilder<ResultT> withHeader(@Nonnull String key, @Nullable String value) Description copied from interface:RequestBuilder
Gives the option to specify custom HTTP headers. Multiple headers with the same key can be specified. The returned object allows to specify the requests the headers should be used in.- Specified by:
withHeader
in interfaceRequestBuilder<BuilderT extends RequestBuilder<ResultT>>
- Parameters:
key
- Name of the (first) desired HTTP header parameter.value
- Value of the (first) desired HTTP header parameter.- Returns:
- A request builder to specify further headers and their intended usage.
-
withHeaders
@Nonnull public SingleValueActionRequestBuilder<ResultT> withHeaders(@Nonnull Map<String, String> map) Description copied from interface:RequestBuilder
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.- Specified by:
withHeaders
in interfaceRequestBuilder<BuilderT extends RequestBuilder<ResultT>>
- Parameters:
map
- A map of HTTP header key/value pairs.- Returns:
- A request builder to specify further headers and their intended usage.
-
withQueryParameter
@Nonnull public SingleValueActionRequestBuilder<ResultT> withQueryParameter(@Nonnull String key, @Nullable String value) Gives the option to specify custom query parameters for the request.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 request builder method calls can lead to unsupported response handling. There is no contract on the order or priority of parameters added to the request.
Example: Use the request 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
- Value of the query parameter.- Returns:
- The same request builder.
-
getServicePath
-
getResourcePath
-
getHeaders
A map containing the headers to be used only for the actual request of this FluentHelper implementation. -
getParametersForRequestOnly
A map containing the custom query parameters to be used only for the actual request of this FluentHelper implementation. -
getListeners
-