Interface Upsert

  • All Superinterfaces:
    CqnStatement, CqnUpsert, CqnXsert, JSONizable, Statement<Upsert>

    public interface Upsert
    extends CqnUpsert, Statement<Upsert>
    The Upsert builder allows to construct a CDS QL Upsert statements, which can be executed via the CdsDataStore. An Upsert statement updates an entity from the given data. The key of the entity that is upserted is expected to be in the data. If the entity doesn't exist and the key is given in the data, it inserts a new entry.
    • Method Detail

      • into

        static Upsert into​(String qualifiedName)
        Creates an upsert statement to upsert entries into a specified entity set.
        Parameters:
        qualifiedName - the fully qualified name of the CDS entity set
        Returns:
        the upsert statement
      • into

        static Upsert into​(CqnStructuredTypeRef ref)
        Creates an upsert statement to upsert entries into a specified entity set.
        Parameters:
        ref - the ref to the entity
        Returns:
        the upsert statement
      • into

        static <T extends StructuredType<?>> Upsert into​(T entity)
        Creates an upsert statement to upsert entries into a specified entity set.
        Type Parameters:
        T - the type of the entity set
        Parameters:
        entity - the structured type representing the entity set
        Returns:
        the upsert statement
      • into

        static Upsert into​(String qualifiedName,
                           UnaryOperator<StructuredType<?>> path)
        Creates an upsert statement to upsert entries into a specified entity set.
        Parameters:
        qualifiedName - the fully qualified name of the CDS entity set
        path - a path expression navigating from the root entity to the target entity of the upsert statement
        Returns:
        the upsert statement
      • into

        static <T extends StructuredType<T>> Upsert into​(Class<T> entity)
        Creates an upsert statement to upsert entries into a specified entity set.
        Type Parameters:
        T - the type of the entity set
        Parameters:
        entity - the static model representation of the entity set
        Returns:
        the upsert statement
      • into

        static <R extends StructuredType<R>,​T extends StructuredType<T>> Upsert into​(Class<R> entity,
                                                                                           Function<R,​T> path)
        Creates an upsert statement to upsert entries into a specified entity set.
        Type Parameters:
        R - the type of the root entity
        T - the type of the target entity
        Parameters:
        entity - the static model representation of the entity set
        path - a path expression navigating from the root entity to the target entity of the upsert statement
        Returns:
        the upsert statement
      • into

        static Upsert into​(CdsEntity entity,
                           UnaryOperator<StructuredType<?>> path)
        Creates an upsert statement to upsert entries into a specified entity set.
        Parameters:
        entity - the model representation of the entity set obtained by reflection
        path - a path expression navigating from the root entity to the target entity of the upsert statement
        Returns:
        the upsert statement
        See Also:
        CdsModel.findEntity(String), CdsModel.entities()
      • copy

        static Upsert copy​(CqnUpsert upsert)
        Copies the given CqnUpsert into an Upsert builder.
        Parameters:
        upsert - the CqnUpsert to be copied
        Returns:
        the modifiable upsert statement copy
      • cqn

        static Upsert cqn​(String cqnUpsert)
        Creates an upsert statement to upsert data for a specified entity set.
        Parameters:
        cqnUpsert - the CQN representation of the upsert statement
        Returns:
        the upsert statement
      • entries

        Upsert entries​(Iterable<? extends Map<String,​?>> entries)
        Sets the batch data to be inserted or updated by the upsert statement. The data is given as a collection of maps from element names of the target entity set to their new values. The data must contain the entities' keys.
        Parameters:
        entries - a collection of data where every element is the canonical representation
        Returns:
        the upsert statement
      • entry

        Upsert entry​(Map<String,​?> entry)
        Adds a single entry to be upserted into the entity set. The data is given as a Map<String, Object> that maps element names of the target entity set to the values to be upserted.

        The value can be deeply structured to represent a structured document:

        • for single-valued relationships the value of the element is of type Map<String, Object>
        • for collection-valued relationships the value of the element is of type List<Map<String, Object>>
        Parameters:
        entry - the data to be upserted as a map
        Returns:
        the upsert statement
      • entry

        Upsert entry​(String elementName,
                     Object value)
        Adds a single entry to be upserted into the entity set.

        The value can be deeply structured to represent a structured document:

        • for single-valued relationships the value of the element is of type Map<String, Object>
        • for collection-valued relationships the value of the element is of type List<Map<String, Object>>
        Parameters:
        elementName - the element name of the target entity for the value to be upserted
        value - the data to be upserted for the element
        Returns:
        the upsert statement