EntityT
- The type of the result entity.public class UpdateRequestBuilder<EntityT extends VdmEntity<?>> extends Object implements ModificationRequestBuilder<ModificationResponse<EntityT>>
executing
it.Constructor and Description |
---|
UpdateRequestBuilder(String servicePath,
EntityT entity)
Instantiate an
UpdateRequestBuilder . |
UpdateRequestBuilder(String servicePath,
EntityT entity,
String entityCollection)
Instantiate an
UpdateRequestBuilder . |
Modifier and Type | Method and Description |
---|---|
UpdateRequestBuilder<EntityT> |
disableVersionIdentifier()
The update request will ignore any version identifier present on the entity and not send an `If-Match` header.
|
ModificationResponse<EntityT> |
execute(HttpDestinationProperties destination)
Execute the OData update request for the provided entity.
|
protected EntityT |
getEntity()
The entity object to be updated by calling the
execute(HttpDestinationProperties) method. |
protected Class<EntityT> |
getEntityClass()
Returns a class object of the type this request builder works with.
|
protected Map<String,String> |
getHeaders()
A map containing the headers to be used only for the actual request of this FluentHelper implementation.
|
protected List<ODataRequestListener> |
getListeners() |
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 ODataResourcePath |
getResourcePath() |
protected String |
getServicePath() |
protected BuilderT |
getThis()
Get the reference to this instance.
|
UpdateRequestBuilder<EntityT> |
includingFields(FieldReference... fields)
Allows to explicitly specify entity fields that shall be sent in an update request regardless if the values of
these fields have been changed.
|
UpdateRequestBuilder<EntityT> |
matchAnyVersionIdentifier()
The update request will ignore any version identifier present on the entity and update the entity, regardless of
any changes on the remote entity.
|
UpdateRequestBuilder<EntityT> |
modifyingEntity()
Allows to control that the request to update the entity is sent with the HTTP method PATCH and its payload
contains the changed fields only.
|
UpdateRequestBuilder<EntityT> |
replacingEntity()
Allows to control that the request to update the entity is sent with the HTTP method PUT and its payload contains
all fields of the entity, regardless which of them have been changed.
|
ODataRequestUpdate |
toRequest()
Creates an instance of the
ODataRequestUpdate based on the Entity class. |
BuilderT |
withHeader(String key,
String value)
Gives the option to specify custom HTTP headers.
|
BuilderT |
withHeaders(Map<String,String> map)
Gives the option to specify a map of custom HTTP headers.
|
BuilderT |
withListener(ODataRequestListener listener)
An error handling class that implements the error result handler interface can be attached to this request
builder.
|
UpdateRequestBuilder<EntityT> |
withoutCsrfToken()
Deactivates the CSRF token retrieval for this OData request.
|
BuilderT |
withQueryParameter(String key,
String value)
Gives the option to specify custom query parameters for the request.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
withHeader, withHeaders
tryExecute
public UpdateRequestBuilder(@Nonnull String servicePath, @Nonnull EntityT entity)
UpdateRequestBuilder
.servicePath
- The service path.entity
- The entity to update.@Nonnull protected Class<EntityT> getEntityClass()
@Nonnull public ModificationResponse<EntityT> execute(@Nonnull HttpDestinationProperties destination)
execute
in interface RequestBuilderExecutable<ModificationResponse<EntityT extends VdmEntity<?>>>
destination
- The destination to be used as request target.@Nonnull @Beta public ODataRequestUpdate toRequest()
ODataRequestUpdate
based on the Entity class.
The following settings are used to build the Request Builder:
toRequest
in interface RequestBuilder<ModificationResponse<EntityT extends VdmEntity<?>>>
ODataRequestUpdate
.ODataSerializationException
- If entity cannot be serialized for HTTP request.@Nonnull public final UpdateRequestBuilder<EntityT> includingFields(@Nonnull FieldReference... fields)
fields
- The fields to be included in the update execution.@Nonnull public final UpdateRequestBuilder<EntityT> replacingEntity()
@Nonnull public final UpdateRequestBuilder<EntityT> modifyingEntity()
@Nonnull public UpdateRequestBuilder<EntityT> disableVersionIdentifier()
Warning: This might lead to a response from the remote system that the `If-Match` header is missing.
It depends on the implementation of the remote system whether the `If-Match` header is expected.
@Nonnull public UpdateRequestBuilder<EntityT> matchAnyVersionIdentifier()
Warning: Be careful with this option, as this might overwrite any changes made to the remote representation of this object.
@Nonnull public UpdateRequestBuilder<EntityT> withoutCsrfToken()
withoutCsrfToken
in interface ModificationRequestBuilder<ModificationResponse<EntityT extends VdmEntity<?>>>
@Nonnull protected EntityT getEntity()
execute(HttpDestinationProperties)
method.@Nonnull protected BuilderT getThis()
@Nonnull @Beta public BuilderT withListener(@Nonnull ODataRequestListener listener)
execute
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.listener
- Instance of an error handler class that implements the error result handler interface.@Nonnull public BuilderT withHeader(@Nonnull String key, @Nullable String value)
RequestBuilder
withHeader
in interface RequestBuilder<ResultT>
key
- Name of the (first) desired HTTP header parameter.value
- Value of the (first) desired HTTP header parameter.@Nonnull public BuilderT withHeaders(@Nonnull Map<String,String> map)
RequestBuilder
withHeaders
in interface RequestBuilder<ResultT>
map
- A map of HTTP header key/value pairs.@Nonnull @Beta public BuilderT withQueryParameter(@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 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")
key
- Name of the query parameter.value
- Value of the query parameter.@Nonnull protected ODataResourcePath getResourcePath()
@Nonnull protected Map<String,String> getHeaders()
@Nonnull protected Map<String,String> getParametersForRequestOnly()
@Nonnull protected List<ODataRequestListener> getListeners()
Copyright © 2021 SAP SE. All rights reserved.