Class CdsModelUtils

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

public class CdsModelUtils extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Optional<com.sap.cds.reflect.CdsAction>
    findAction(com.sap.cds.reflect.CdsService service, com.sap.cds.reflect.CdsEntity entity, String name)
     
    static Optional<com.sap.cds.reflect.CdsFunction>
    findFunction(com.sap.cds.reflect.CdsService service, com.sap.cds.reflect.CdsEntity entity, String name)
     
    static com.sap.cds.ql.cqn.AnalysisResult
    getEntityPath(com.sap.cds.ql.cqn.CqnSelect select, com.sap.cds.reflect.CdsModel model)
     
    static com.sap.cds.ql.cqn.AnalysisResult
    getEntityPath(com.sap.cds.ql.cqn.CqnStructuredTypeRef ref, com.sap.cds.reflect.CdsModel model)
     
    getPublicEvents(com.sap.cds.reflect.CdsAnnotatable cdsModelElement)
    Returns a list of all events that are not restricted for the given model element, although the element itself might be restricted in general.
    static com.sap.cds.reflect.CdsEntity
    getRefTarget(com.sap.cds.ql.cqn.CqnStructuredTypeRef ref, com.sap.cds.reflect.CdsEntity target)
     
    getRestrictionOrNull(com.sap.cds.reflect.CdsAnnotatable cdsModelElement)
    Returns a Restriction instance reflecting @restrict resp.
    static com.sap.cds.reflect.CdsEntity
    getTargetEntity(com.sap.cds.ql.cqn.CqnSelect select, com.sap.cds.reflect.CdsModel model)
     
    static com.sap.cds.reflect.CdsEntity
    getTargetEntity(com.sap.cds.ql.cqn.CqnStructuredTypeRef ref, com.sap.cds.reflect.CdsModel model)
     
    static String
    getTargetKeysAsString(com.sap.cds.reflect.CdsModel model, com.sap.cds.ql.cqn.CqnStatement statement)
     
    static boolean
    isChildEntity(com.sap.cds.ql.cqn.CqnStructuredTypeRef ref, com.sap.cds.reflect.CdsModel model)
     
    isPublic(com.sap.cds.reflect.CdsAnnotatable cdsModelElement)
    Returns true if the passed model element (either service or entity) has no effective restriction.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • CdsModelUtils

      public CdsModelUtils(CdsRuntime runtime)
  • Method Details

    • isPublic

      public Optional<Boolean> isPublic(com.sap.cds.reflect.CdsAnnotatable cdsModelElement)
      Returns true if the passed model element (either service or entity) has no effective restriction. Please note that this does not include hierarchical dependencies.
      Parameters:
      cdsModelElement - The element from the CDS model
      Returns:
      true if public
    • getPublicEvents

      public List<String> getPublicEvents(com.sap.cds.reflect.CdsAnnotatable cdsModelElement)
      Returns a list of all events that are not restricted for the given model element, although the element itself might be restricted in general.
      Parameters:
      cdsModelElement - The CDS model element
      Returns:
      The list of public events
    • getRestrictionOrNull

      public static Restriction getRestrictionOrNull(com.sap.cds.reflect.CdsAnnotatable cdsModelElement)
      Returns a Restriction instance reflecting @restrict resp. @requires on the given service or null if not annotated.
      Parameters:
      cdsModelElement - The CDS model element to be inspected
      Returns:
      The Restriction instance
    • getEntityPath

      public static com.sap.cds.ql.cqn.AnalysisResult getEntityPath(com.sap.cds.ql.cqn.CqnStructuredTypeRef ref, com.sap.cds.reflect.CdsModel model)
    • isChildEntity

      public static boolean isChildEntity(com.sap.cds.ql.cqn.CqnStructuredTypeRef ref, com.sap.cds.reflect.CdsModel model)
    • getTargetEntity

      public static com.sap.cds.reflect.CdsEntity getTargetEntity(com.sap.cds.ql.cqn.CqnSelect select, com.sap.cds.reflect.CdsModel model)
    • getTargetEntity

      public static com.sap.cds.reflect.CdsEntity getTargetEntity(com.sap.cds.ql.cqn.CqnStructuredTypeRef ref, com.sap.cds.reflect.CdsModel model)
    • getEntityPath

      public static com.sap.cds.ql.cqn.AnalysisResult getEntityPath(com.sap.cds.ql.cqn.CqnSelect select, com.sap.cds.reflect.CdsModel model)
    • getRefTarget

      public static com.sap.cds.reflect.CdsEntity getRefTarget(com.sap.cds.ql.cqn.CqnStructuredTypeRef ref, com.sap.cds.reflect.CdsEntity target)
    • getTargetKeysAsString

      public static String getTargetKeysAsString(com.sap.cds.reflect.CdsModel model, com.sap.cds.ql.cqn.CqnStatement statement)
    • findFunction

      public static Optional<com.sap.cds.reflect.CdsFunction> findFunction(com.sap.cds.reflect.CdsService service, com.sap.cds.reflect.CdsEntity entity, String name)
    • findAction

      public static Optional<com.sap.cds.reflect.CdsAction> findAction(com.sap.cds.reflect.CdsService service, com.sap.cds.reflect.CdsEntity entity, String name)