Package com.sap.cds.services.utils.model
Class CqnUtils
java.lang.Object
com.sap.cds.services.utils.model.CqnUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic <S extends com.sap.cds.ql.cqn.CqnStatement>
SaddWhere(S cqn, com.sap.cds.ql.cqn.CqnPredicate pred) Creates aCqnStatementwith a modified where clause according to the passed function.convertToIndexMap(Object... paramValues) Converts the object array to an indexed map.static com.sap.cds.ql.Delete<?>toDelete(com.sap.cds.ql.cqn.CqnSelect s) Transform theCqnSelectinto aDeletestatic com.sap.cds.ql.Select<?>toSelect(com.sap.cds.ql.cqn.CqnDelete delete) Transforms aCqnDeleteinto aSelectstatic com.sap.cds.ql.Select<?>toSelect(com.sap.cds.ql.cqn.CqnUpdate update, com.sap.cds.reflect.CdsEntity target) Transforms aCqnUpdateinto aSelectstatic com.sap.cds.ql.Select<?>toSelect(com.sap.cds.ql.cqn.CqnUpsert upsert, com.sap.cds.reflect.CdsEntity target) Transforms aCqnUpsertinto aSelect
-
Method Details
-
convertToIndexMap
Converts the object array to an indexed map. The first object has the key0, the second1, etc.- Parameters:
paramValues- the objects- Returns:
- the indexed map
-
addWhere
public static <S extends com.sap.cds.ql.cqn.CqnStatement> S addWhere(S cqn, com.sap.cds.ql.cqn.CqnPredicate pred) Creates aCqnStatementwith a modified where clause according to the passed function. In case of a nested select, the modification applies to inner select only.- Type Parameters:
S- The type of the statement- Parameters:
cqn- The originalCqnStatement.pred- a predicate, which is set as the where clause or connected to an existing where clause with and- Returns:
- The modified
CqnStatement.
-
toDelete
public static com.sap.cds.ql.Delete<?> toDelete(com.sap.cds.ql.cqn.CqnSelect s) Transform theCqnSelectinto aDelete- Parameters:
s- theCqnSelect- Returns:
- the
Delete
-
toSelect
public static com.sap.cds.ql.Select<?> toSelect(com.sap.cds.ql.cqn.CqnDelete delete) Transforms aCqnDeleteinto aSelect- Parameters:
delete- theCqnDelete- Returns:
- the
Select
-
toSelect
public static com.sap.cds.ql.Select<?> toSelect(com.sap.cds.ql.cqn.CqnUpdate update, com.sap.cds.reflect.CdsEntity target) Transforms aCqnUpdateinto aSelect- Parameters:
update- theCqnUpdate- Returns:
- the
Select
-
toSelect
public static com.sap.cds.ql.Select<?> toSelect(com.sap.cds.ql.cqn.CqnUpsert upsert, com.sap.cds.reflect.CdsEntity target) Transforms aCqnUpsertinto aSelect- Parameters:
upsert- theCqnUpsert- Returns:
- the
Select
-