Interface Delete<T extends StructuredType<?>>

  • Type Parameters:
    T - the type of the entity set targeted by this delete statement
    All Superinterfaces:
    CqnDelete, CqnStatement, JSONizable, Statement<Delete<T>>

    public interface Delete<T extends StructuredType<?>>
    extends CqnDelete, Statement<Delete<T>>
    The Delete Builder allows to construct CDS QL delete statements, which can be executed via the CdsDataStore. Note that some methods in this interface mutually exclude each other and cannot be combined. For example, the methods byId, byParams, matching, and where all set the where condition of the enclosing statement, overwriting any previously stored conditions.
    • Method Detail

      • from

        static Delete<StructuredType<?>> from​(String qualifiedName)
        Creates a delete statement to delete entries from a specified entity set.
        Parameters:
        qualifiedName - the fully qualified name of the CDS entity set
        Returns:
        the delete statement
      • from

        static Delete<StructuredType<?>> from​(CqnStructuredTypeRef ref)
        Creates a delete statement to delete entries from a specified entity set.
        Parameters:
        ref - the ref to the entity
        Returns:
        the delete statement
      • from

        static <E extends StructuredType<?>> Delete<E> from​(E entity)
        Creates a delete statement to delete entries from a specified entity set.
        Type Parameters:
        E - the type of the entity set
        Parameters:
        entity - the structured type representing the entity set
        Returns:
        the delete statement
      • from

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

        static <E extends StructuredType<E>> Delete<E> from​(Class<E> entity)
        Creates a delete statement to delete entries from a specified entity set.
        Type Parameters:
        E - the type of root entity
        Parameters:
        entity - the static model representation of the entity set
        Returns:
        the delete statement
      • from

        static <E extends StructuredType<E>,​R extends StructuredType<R>> Delete<R> from​(Class<E> entity,
                                                                                              Function<E,​R> path)
        Creates a delete statement to delete entries from a specified entity set.
        Type Parameters:
        E - the type of root entity
        R - the type of entity to be returned from path expression
        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 delete statement
        Returns:
        the delete statement
      • cqn

        static Delete<StructuredType<?>> cqn​(String cqnDelete)
        Creates a delete statement to delete entries from a specified entity set.
        Parameters:
        cqnDelete - the CQN representation of delete statement
        Returns:
        the delete statement
      • where

        Delete<T> where​(CqnPredicate predicate)
        Sets the where condition of the delete statement.
        Parameters:
        predicate - a CqnPredicate
        Returns:
        the delete statement
      • where

        Delete<T> where​(Function<T,​CqnPredicate> predicate)
        Sets the where condition of the delete statement. The where condition is provided as a function that accepts a model object representing the entity targeted by the delete and returning the where condition.
        Parameters:
        predicate - a Function providing the where condition
        Returns:
        the delete statement
      • matching

        Delete<T> matching​(Map<String,​?> values)
        Sets the where condition of the delete statement. The where condition is computed from a map of element names of the target entity set to their values, or a CqnParameter. The map entries are transformed into comparison predicates and joined via and.
        Parameters:
        values - the element name to value map defining the where condition
        Returns:
        the delete statement
      • byParams

        default Delete<T> byParams​(String... elementRefs)
        Sets the where condition of the delete statement. The where condition is computed from the given vararg of element references of the target entity. For each element reference a predicate is created comparing the element ref with a CqnParameter that has the name of the ref. The predicates are joined via and.
        Parameters:
        elementRefs - the element references defining the where condition
        Returns:
        this delete statement
      • byParams

        Delete<T> byParams​(Collection<String> elementRefs)
        Sets the where condition of the delete statement. The where condition is computed from the given collection of element references of the target entity. For each element ref a predicate is created comparing the ref with a CqnParameter that has the name of the ref. The predicates are joined via and.
        Parameters:
        elementRefs - the element references defining the where condition
        Returns:
        this delete statement
      • byId

        Delete<T> byId​(Object idValue)
        Sets the where condition of the delete statement, requiring that the value of the single key element of the target entity set is equal to the given idValue.
        Parameters:
        idValue - the value of the target entity's key element
        Returns:
        the delete statement