Package com.sap.cds.util
Class CdsModelUtils
java.lang.Object
com.sap.cds.util.CdsModelUtils
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionassocKeys
(CdsElement forwardMappedAssoc) static Stream<CdsElement>
static CdsVersion
compilerVersion
(CdsModel model) static CdsElement
element
(CdsStructuredType struct, CqnElementRef ref) static CdsElement
element
(CdsStructuredType struct, List<? extends CqnReference.Segment> segments) static CdsEntity
entity
(CdsEntity root, List<? extends CqnReference.Segment> segments) static CdsEntity
entity
(CdsModel model, CqnStructuredTypeRef ref) static Optional<CdsElement>
findElement
(CdsStructuredType struct, CqnElementRef ref) static Optional<CdsElement>
findElementByPath
(CdsStructuredType structuredType, String path) static String
getDoc
(com.fasterxml.jackson.databind.JsonNode csn) static String
static <S extends CdsStructuredType>
SgetTargetOf
(CdsStructuredType structuredType, String path) static boolean
isCascading
(CdsModelUtils.CascadeType cascadeType, CdsElement association) static boolean
static boolean
static boolean
isKey
(CdsElement element) static boolean
static boolean
isPersistenceSkip
(CdsEntity entity) static boolean
isReverseAssociation
(CdsElement assoc) static boolean
isRuntimeView
(CdsEntity entity) static boolean
isSingleValued
(CdsType associationElement) static boolean
keyNames
(CdsStructuredType type) static boolean
managedToOne
(CdsType associationElement) static Supplier<CdsElementNotFoundException>
noSuchElement
(String path, CdsDefinition context) static Stream<Map<CdsElement,
List<String>>> Iteratively resolves every managed to-one association that is found within the provided association and its association reference mapping until only simple type elements have been reached.static CdsStructuredType
target
(CdsStructuredType root, List<? extends CqnReference.Segment> segments) targetKeys
(CdsElement assoc) static List<CdsStructuredType>
targets
(CdsModel model, List<? extends CqnReference.Segment> segments) static Optional<CqnElementRef>
tenantDiscriminator
(CdsStructuredType entity)
-
Method Details
-
isSingleValued
-
isToMany
-
isManyTo
-
managedToOne
-
isRuntimeView
-
isPersistenceSkip
-
tenantDiscriminator
-
targetKeys
-
assocKeys
-
isKey
-
concreteKeyNames
-
keyNames
-
findElement
-
element
-
element
public static CdsElement element(CdsStructuredType struct, List<? extends CqnReference.Segment> segments) -
isContextElementRef
-
isEtagPlaceholder
-
targets
public static List<CdsStructuredType> targets(CdsModel model, List<? extends CqnReference.Segment> segments) -
target
public static CdsStructuredType target(CdsStructuredType root, List<? extends CqnReference.Segment> segments) -
entity
-
entity
-
isReverseAssociation
-
compilerVersion
-
getDoc
-
isCascading
-
getFullRefPath
-
resolveManagedToOneAssociationMapping
public static Stream<Map<CdsElement,List<String>>> resolveManagedToOneAssociationMapping(CdsElement element) Iteratively resolves every managed to-one association that is found within the provided association and its association reference mapping until only simple type elements have been reached. The ref id paths towards these transitively targeted simple type elements are kept track of and returned together with these elements in a stream of maps. The resolution of these managed to-one associations potentially constructs a multi-level tree of ref id paths with the ref id of the provided CDS element as the root node and the transitively targeted (simple type) elements as leaf nodes. Each map of the stream contains the leaf node element as key and its respective ref id path as value.- Parameters:
element
- an association or simple type element- Returns:
- a stream of transitively targeted simple type elements and their respective ref id paths derived from the provided CDS element and its association mapping
-
columnsOf
-
findElementByPath
-
getTargetOf
public static <S extends CdsStructuredType> S getTargetOf(CdsStructuredType structuredType, String path) -
noSuchElement
public static Supplier<CdsElementNotFoundException> noSuchElement(String path, CdsDefinition context)
-