Package com.sap.cds.ql
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 Summary
Modifier and TypeMethodDescriptionSets 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.Sets the where condition of the delete statement.byParams
(Collection<String> elementRefs) Sets the where condition of the delete statement.static Delete<StructuredType<?>>
static Delete<StructuredType<?>>
Creates a delete statement to delete entries from a specified entity set.static Delete<StructuredType<?>>
from
(CqnStructuredTypeRef ref) Creates a delete statement to delete entries from a specified entity set.static Delete<StructuredType<?>>
Creates a delete statement to delete entries from a specified entity set.static Delete<StructuredType<?>>
from
(CdsEntity entity, UnaryOperator<StructuredType<?>> path) Creates a delete statement to delete entries from a specified entity set.static <E extends StructuredType<?>>
Delete<E>from
(E entity) Creates a delete statement to delete entries from a specified entity set.static <E extends StructuredType<E>>
Delete<E>Creates a delete statement to delete entries from a specified entity set.static <E extends StructuredType<E>,
R extends StructuredType<R>>
Delete<R>Creates a delete statement to delete entries from a specified entity set.static Delete<StructuredType<?>>
Creates a delete statement to delete entries from a specified entity set.static Delete<StructuredType<?>>
from
(String rootEntityName, UnaryOperator<StructuredType<?>> path) Creates a delete statement to delete entries from a specified entity set.Sets the where condition of the delete statement.where
(CqnPredicate predicate) Sets the where condition of this delete statement.where
(Function<T, CqnPredicate> predicate) Sets the where condition of this delete statement.Methods inherited from interface com.sap.cds.ql.cqn.CqnFilterableStatement
where
Methods inherited from interface com.sap.cds.ql.cqn.CqnStatement
asInsert, asSelect, asUpdate, asUpsert, hints, isInsert, isSelect, isUpdate, isUpsert, ref
Methods inherited from interface com.sap.cds.JSONizable
toJson
-
Method Details
-
from
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
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
Creates a delete statement to delete entries from a specified entity set.- Parameters:
rootEntityName
- the fully qualified name of the CDS entity setpath
- a path expression navigating from the root entity to the target entity of the delete statement- Returns:
- the delete statement
-
from
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 entityR
- the type of entity to be returned from path expression- Parameters:
entity
- the static model representation of the entity setpath
- a path expression navigating from the root entity to the target entity of the delete statement- Returns:
- the delete statement
-
from
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
Creates a delete statement to delete entries from a specified entity set.- Parameters:
entity
- the model representation of the entity set obtained by reflectionpath
- a path expression navigating from the root entity to the target entity of the delete statement- Returns:
- the delete statement
- See Also:
-
copy
- Parameters:
delete
- theCqnDelete
to be copied- Returns:
- the modifiable delete statement copy
-
cqn
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
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 interfaceFilterableStatement<T extends StructuredType<?>,
Delete<T extends StructuredType<?>>> - Parameters:
predicate
- aCqnPredicate
- Returns:
- the delete statement
-
where
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 interfaceFilterableStatement<T extends StructuredType<?>,
Delete<T extends StructuredType<?>>> - Parameters:
predicate
- aFunction
providing the where condition- Returns:
- the delete statement
-
matching
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 aCqnParameter
. The map entries are transformed into comparison predicates and joined via and.- Specified by:
matching
in interfaceFilterableStatement<T extends StructuredType<?>,
Delete<T extends StructuredType<?>>> - Parameters:
values
- the element name to value map defining the where condition- Returns:
- the delete statement
-
byParams
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 aCqnParameter
that has the name of the ref. The predicates are joined via and.- Specified by:
byParams
in interfaceFilterableStatement<T extends StructuredType<?>,
Delete<T extends StructuredType<?>>> - Parameters:
elementRefs
- the element references defining the where condition- Returns:
- this delete statement
-
byParams
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 aCqnParameter
that has the name of the ref. The predicates are joined via and.- Specified by:
byParams
in interfaceFilterableStatement<T extends StructuredType<?>,
Delete<T extends StructuredType<?>>> - Parameters:
elementRefs
- the element references defining the where condition- Returns:
- this delete statement
-
byId
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 interfaceFilterableStatement<T extends StructuredType<?>,
Delete<T extends StructuredType<?>>> - Parameters:
idValue
- the value of the target entity's key element- Returns:
- the delete statement
-