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.
  • Constructor Details

    • FluentHelperCreate

      public FluentHelperCreate(@Nonnull String servicePath, @Nonnull String entityCollection)
      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

      @Nonnull protected abstract EntityT 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

      @Nonnull protected Class<? extends EntityT> getEntityClass()
      Description copied from class: FluentHelperBasic
      Returns a class object of the type this fluent helper works with.
      Specified by:
      getEntityClass in class FluentHelperBasic<FluentHelperT,EntityT extends VdmEntity<?>,ModificationResponse<EntityT extends VdmEntity<?>>>
      Returns:
      A class object of the handled type.
    • executeRequest

      @Nonnull public ModificationResponse<EntityT> executeRequest(@Nonnull Destination destination)
      Description copied from interface: FluentHelperExecutable
      Executes this request.
      Specified by:
      executeRequest in interface FluentHelperExecutable<FluentHelperT>
      Specified by:
      executeRequest in class FluentHelperBasic<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

      @Nonnull public ODataRequestCreate toRequest()
      Description copied from class: FluentHelperBasic
      Translate this OData v2 request into a OData request object extending ODataRequestGeneric.
      Specified by:
      toRequest in class FluentHelperBasic<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 an 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.
      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 - An EntityLink representing a navigation property.
      Returns:
      The same fluent helper configured to use the provided navigation property for creation.