Class FluentHelperCreate<FluentHelperT,EntityT extends VdmEntity<?>>
java.lang.Object
com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperBasic<FluentHelperT,EntityT,ModificationResponse<EntityT>>
com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperModification<FluentHelperT,EntityT>
com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperCreate<FluentHelperT,EntityT>
- Type Parameters:
FluentHelperT
- The fluent helper type.EntityT
- The type of the entity to create.
- All Implemented Interfaces:
FluentHelperExecutable<Object>
public abstract class FluentHelperCreate<FluentHelperT,EntityT extends VdmEntity<?>>
extends FluentHelperModification<FluentHelperT,EntityT>
Representation of an OData create request as a fluent interface for further configuring the request and
executing
it.-
Field Summary
Fields inherited from class com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperBasic
csrfTokenRetriever, entityCollection
-
Constructor Summary
ConstructorDescriptionFluentHelperCreate
(String servicePath, String entityCollection) Instantiates this fluent helper using the given service path and entity collection to send the requests. -
Method Summary
Modifier and TypeMethodDescription<ParentEntityT extends VdmEntity<?>>
FluentHelperTasChildOf
(ParentEntityT entity, EntityLink<? extends EntityLink<?, ParentEntityT, EntityT>, ParentEntityT, EntityT> entityLink) This function allows to create a new entity via an existing parent entity.executeRequest
(Destination destination) Executes this request.protected abstract EntityT
Getter for the VDM representation of the entity to be created.Returns a class object of the type this fluent helper works with.Translate this OData v2 request into a OData request object extendingODataRequestGeneric
.Methods inherited from class com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperModification
withoutCsrfToken
Methods inherited from class com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperBasic
getCsrfTokenRetriever, getHeaders, getParametersForRequestOnly, getServicePath, getThis, withHeader, withHeaders, withQueryParameter
-
Constructor Details
-
FluentHelperCreate
Instantiates this fluent helper using the given service path and entity collection 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
-
getEntity
Getter for the VDM representation of the entity to be created.- Returns:
- The entity that should be created by calling the
executeRequest(Destination)
method.
-
getEntityClass
Description copied from class:FluentHelperBasic
Returns a class object of the type this fluent helper works with.- Specified by:
getEntityClass
in classFluentHelperBasic<FluentHelperT,
EntityT extends VdmEntity<?>, ModificationResponse<EntityT extends VdmEntity<?>>> - Returns:
- A class object of the handled type.
-
executeRequest
Description copied from interface:FluentHelperExecutable
Executes this request.- Specified by:
executeRequest
in interfaceFluentHelperExecutable<FluentHelperT>
- Specified by:
executeRequest
in classFluentHelperBasic<FluentHelperT,
EntityT extends VdmEntity<?>, ModificationResponse<EntityT extends VdmEntity<?>>> - Parameters:
destination
- The target system this request should be issued against.- Returns:
- A response according to the query criteria.
-
toRequest
Description copied from class:FluentHelperBasic
Translate this OData v2 request into a OData request object extendingODataRequestGeneric
.- Specified by:
toRequest
in classFluentHelperBasic<FluentHelperT,
EntityT extends VdmEntity<?>, ModificationResponse<EntityT extends VdmEntity<?>>> - Returns:
- A protocol agnostic OData request instance.
-
asChildOf
@Nonnull public <ParentEntityT extends VdmEntity<?>> FluentHelperT asChildOf(@Nullable ParentEntityT entity, @Nullable EntityLink<? extends EntityLink<?, ParentEntityT, EntityT>, ParentEntityT, EntityT> entityLink) This function allows to create a new entity via an existing parent entity. Parent means that the existing entity has to be related to the entity to be created via a navigation property. Thus, the function requires the caller to provide anEntityLink<?, 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 typeParentEntityT
. 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.- Type Parameters:
ParentEntityT
- The generic parent entity type in this navigation property relation.- Parameters:
entity
- An instance of the related entity that MUST hold values for the respective key fields.entityLink
- AnEntityLink
representing a navigation property.- Returns:
- The same fluent helper configured to use the provided navigation property for creation.
-