Interface Delete<T extends StructuredType<?>>

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

public interface Delete<T extends StructuredType<?>> extends CqnDelete, FilterableStatement<T,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 Details

    • 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

      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
    • from

      static Delete<StructuredType<?>> from(CdsEntity entity)
      Creates a delete statement to delete entries from a specified entity set.
      Parameters:
      entity - the model representation of the entity set obtained by reflection
      Returns:
      the delete statement
      See Also:
    • from

      static Delete<StructuredType<?>> from(CdsEntity entity, UnaryOperator<StructuredType<?>> path)
      Creates a delete statement to delete entries from 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 delete statement
      Returns:
      the delete statement
      See Also:
    • copy

      static Delete<StructuredType<?>> copy(CqnDelete delete)
      Copies the given CqnDelete into a Delete builder.
      Parameters:
      delete - the CqnDelete to be copied
      Returns:
      the modifiable delete statement copy
    • 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 this delete statement. If this delete statement already has a where condition it is replaced with the given.
      Specified by:
      where in interface FilterableStatement<T extends StructuredType<?>,Delete<T extends StructuredType<?>>>
      Parameters:
      predicate - a CqnPredicate
      Returns:
      the delete statement
    • where

      Delete<T> where(Function<T,CqnPredicate> predicate)
      Sets the where condition of this 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.
      Specified by:
      where in interface FilterableStatement<T extends StructuredType<?>,Delete<T extends StructuredType<?>>>
      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.
      Specified by:
      matching in interface FilterableStatement<T extends StructuredType<?>,Delete<T extends StructuredType<?>>>
      Parameters:
      values - the element name to value map defining the where condition
      Returns:
      the delete statement
    • byParams

      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.
      Specified by:
      byParams in interface FilterableStatement<T extends StructuredType<?>,Delete<T extends StructuredType<?>>>
      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.
      Specified by:
      byParams in interface FilterableStatement<T extends StructuredType<?>,Delete<T extends StructuredType<?>>>
      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.
      Specified by:
      byId in interface FilterableStatement<T extends StructuredType<?>,Delete<T extends StructuredType<?>>>
      Parameters:
      idValue - the value of the target entity's key element
      Returns:
      the delete statement