Class CqnUtils

java.lang.Object
com.sap.cds.services.utils.model.CqnUtils

public class CqnUtils extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static <S extends com.sap.cds.ql.cqn.CqnStatement>
    S
    addWhere(S cqn, com.sap.cds.ql.cqn.CqnPredicate pred)
    Creates a CqnStatement with a modified where clause according to the passed function.
    static Map<String,Object>
    convertToIndexMap(Object... paramValues)
    Converts the object array to an indexed map.
    static com.sap.cds.ql.cqn.CqnStructuredTypeRef
    getTargetRef(com.sap.cds.ql.cqn.CqnStatement statement, boolean allowTableFunctions)
     
    static com.sap.cds.ql.Delete<?>
    toDelete(com.sap.cds.ql.cqn.CqnSelect s)
    Transform the CqnSelect into a Delete
    static com.sap.cds.ql.Select<?>
    toSelect(com.sap.cds.ql.cqn.CqnDelete delete)
    Transforms a CqnDelete into a Select
    static com.sap.cds.ql.Select<?>
    toSelect(com.sap.cds.ql.cqn.CqnUpdate update, com.sap.cds.reflect.CdsEntity target)
    Transforms a CqnUpdate into a Select

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • convertToIndexMap

      public static Map<String,Object> convertToIndexMap(Object... paramValues)
      Converts the object array to an indexed map. The first object has the key 0, the second 1, 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 a CqnStatement with 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 original CqnStatement.
      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 the CqnSelect into a Delete
      Parameters:
      s - the CqnSelect
      Returns:
      the Delete
    • toSelect

      public static com.sap.cds.ql.Select<?> toSelect(com.sap.cds.ql.cqn.CqnDelete delete)
      Transforms a CqnDelete into a Select
      Parameters:
      delete - the CqnDelete
      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 a CqnUpdate into a Select
      Parameters:
      update - the CqnUpdate
      Returns:
      the Select
    • getTargetRef

      public static com.sap.cds.ql.cqn.CqnStructuredTypeRef getTargetRef(com.sap.cds.ql.cqn.CqnStatement statement, boolean allowTableFunctions)