FluentHelperT
- The fluent helper type.EntityT
- The type of the entity to create.public abstract class FluentHelperCreate<FluentHelperT,EntityT extends VdmEntity<?>> extends FluentHelperBasic<FluentHelperT,EntityT,EntityT>
executing
it.Constructor and Description |
---|
FluentHelperCreate(String servicePath)
Instantiates this fluent helper using the given service path to send the requests.
|
Modifier and Type | Method and Description |
---|---|
<ParentEntityT extends VdmEntity<?>> |
asChildOf(ParentEntityT entity,
EntityLink<? extends EntityLink<?,ParentEntityT,EntityT>,ParentEntityT,EntityT> entityLink)
This function allows to create a new entity via an existing parent entity.
|
EntityT |
execute(HttpDestinationProperties destination) |
ModificationResponse<EntityT> |
executeRequest(HttpDestinationProperties destination)
Executes this request.
|
protected abstract EntityT |
getEntity()
Getter for the VDM representation of the entity to be created.
|
protected Class<? extends EntityT> |
getEntityClass()
Returns a class object of the type this fluent helper works with.
|
protected com.sap.cloud.sdk.odatav2.connectivity.ODataCreateRequestBuilder |
getQueryBuilder()
Creates an instance of the
ODataCreateRequestBuilder based on the Entity class. |
com.sap.cloud.sdk.odatav2.connectivity.ODataCreateRequest |
toQuery()
Provides access to the underlying Query object, to allow for custom integration scenarios not yet supported by
the virtual data model.
|
ODataRequestCreate |
toRequest()
Translate this OData v2 create request instance to a generic OData Client request object.
|
FluentHelperT |
withErrorHandler(com.sap.cloud.sdk.odatav2.connectivity.ErrorResultHandler<?> errorResultHandler)
An error handling class that implements the
ErrorResultHandler interface can be
attached to this fluent helper. |
cachingMetadata, getHeadersForRequestAndImplicitRequests, getHeadersForRequestOnly, getParametersForRequestOnly, getServicePath, getThis, getVersionIdentifier, isCachingMetadata, withHeader, withHeaders, withoutCachingMetadata, withQueryParameter
@Nonnull protected abstract EntityT getEntity()
execute(HttpDestinationProperties)
method.@Nonnull protected Class<? extends EntityT> getEntityClass()
FluentHelperBasic
getEntityClass
in class FluentHelperBasic<FluentHelperT,EntityT extends VdmEntity<?>,EntityT extends VdmEntity<?>>
@Nonnull protected com.sap.cloud.sdk.odatav2.connectivity.ODataCreateRequestBuilder getQueryBuilder()
ODataCreateRequestBuilder
based on the Entity class.
The following settings are necessary to build the ODataCreateRequestBuilder
:
ODataCreateRequestBuilder
.@Nonnull public com.sap.cloud.sdk.odatav2.connectivity.ODataCreateRequest toQuery()
com.sap.cloud.sdk.odatav2.connectivity.ODataException
- if the ODataCreateRequestBuilder
could not be initialized.@Nonnull public FluentHelperT withErrorHandler(@Nonnull com.sap.cloud.sdk.odatav2.connectivity.ErrorResultHandler<?> errorResultHandler)
ErrorResultHandler
interface can be
attached to this fluent helper. This allows custom logic to be called when an error occurs in the
execute(HttpDestinationProperties)
method. If this method is not called, then an instance of
ODataVdmErrorResultHandler
is used. Only one handler can be attached at a time
per fluent helper object, so calling this multiple times will replace the handler.errorResultHandler
- Instance of an error handler class that implements the ErrorResultHandler
interface.@Nonnull public EntityT execute(@Nonnull HttpDestinationProperties destination) throws com.sap.cloud.sdk.odatav2.connectivity.ODataException
execute
in class FluentHelperBasic<FluentHelperT,EntityT extends VdmEntity<?>,EntityT extends VdmEntity<?>>
com.sap.cloud.sdk.odatav2.connectivity.ODataException
@Beta @Nonnull public ModificationResponse<EntityT> executeRequest(@Nonnull HttpDestinationProperties destination)
execute(HttpDestinationProperties)
. Contrary to
execute(HttpDestinationProperties)
this operation does not request the service metadata before
performing the actual request. As a consequence FluentHelperBasic.withoutCachingMetadata()
and FluentHelperBasic.cachingMetadata()
have no effect on this operation. Furthermore, error handlers registered via
withErrorHandler(ErrorResultHandler)
will not be respected.destination
- The target system this request should be issued against.DestinationAccessException
- If there is an issue accessing the
HttpDestination
.HttpClientInstantiationException
- If there is an issue creating the HttpClient
.ODataException
- If the OData request execution failed. Please find the documentation for ODataException
possible sub-types and error scenarios they can occur in.@Nonnull @Beta public ODataRequestCreate toRequest()
@Nonnull public <ParentEntityT extends VdmEntity<?>> FluentHelperT asChildOf(@Nullable ParentEntityT entity, @Nullable EntityLink<? extends EntityLink<?,ParentEntityT,EntityT>,ParentEntityT,EntityT> entityLink)
EntityLink<?, ParentEntityT, EntityT>
that represents such a navigation property.
ParentEntityT
can represent any entity that is related to the entity to be created. EntityT
represents the type of the entity to be created. Furthermore, the function requires an instance of type
ParentEntityT
. This instance must hold the key fields used to identify it.
NOTE: While any EntityLink provided by the OData VDM satisfying these type constraints allows you to call this
function, the service may NOT allow this kind of create operation for the respective navigation property. Thus,
calling this function without knowledge of the underlying OData service can result in failing requests.ParentEntityT
- The generic parent entity type in this navigation property relation.entity
- An instance of the related entity that MUST hold values for the respective key fields.entityLink
- An EntityLink
representing a navigation property.Copyright © 2020 SAP SE. All rights reserved.