Skip to content

Commit

Permalink
Hierarchical line items (#325)
Browse files Browse the repository at this point in the history
This is PR is about the possibility to apply a hierarchy (and later one
aggregation ) on existing list definition (aka UI.LineItem). We start
with three different proposals: adding a new property to
UI.PresentationVariant, adding a new term that can be applied on
UI.LineItem annotations, adding a new term that uses UI.LineItem as
BaseTerm.

---------

Co-authored-by: Ralf Handl <[email protected]>
  • Loading branch information
BerSie and ralfhandl authored Jul 11, 2024
1 parent c94544c commit 1ac31b8
Show file tree
Hide file tree
Showing 5 changed files with 375 additions and 249 deletions.
51 changes: 51 additions & 0 deletions examples/UI.ApplyRecursiveHierarchy-sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$Version": "4.0",
"$Reference": {
"https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.json": {
"$Include": [{ "$Namespace": "Org.OData.Core.V1", "$Alias": "Core" }]
},
"https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Aggregation.V1.json": {
"$Include": [{ "$Namespace": "Org.OData.Aggregation.V1", "$Alias": "Aggregation" }]
},
"https://sap.github.io/odata-vocabularies/vocabularies/UI.json": {
"$Include": [{ "$Namespace": "com.sap.vocabularies.UI.v1", "$Alias": "UI" }]
}
},
"Examples": {
"container": {
"$Kind": "EntityContainer",
"HierarchySet": { "$Collection": true, "$Type": "Examples.Hierarchy_Type" }
},
"Hierarchy_Type": {
"$Kind": "EntityType",
"$Key": ["ID"],
"ID": { "$MaxLength": 10 },
"StatusText": { "$Nullable": true, "$MaxLength": 30 },
"Node": { "$Type": "Edm.Guid" },
"to_Parent": { "$Kind": "NavigationProperty", "$Type": "Hierarchy_Type", "$Nullable": true }
},
"$Annotations": {
"Examples.Hierarchy_Type": {
"@Aggregation.RecursiveHierarchy#myHierarchyQualifier": {
"Node": "Node",
"ParentNavigationProperty": "to_Parent"
},
"@UI.LineItem#useHierarchy": [
{
"@odata.type": "https://sap.github.io/odata-vocabularies/vocabularies/UI.xml#UI.DataField",
"Value": { "$Path": "ID" }
},
{
"@odata.type": "https://sap.github.io/odata-vocabularies/vocabularies/UI.xml#UI.DataField",
"Value": { "$Path": "StatusText" }
}
],
"@UI.PresentationVariant": {
"Visualizations": ["UI.LineItem#useHierarchy"],
"RecursiveHierarchyQualifier": "myHierarchyQualifier"
}
}
}
},
"$EntityContainer": "Examples.container"
}
65 changes: 65 additions & 0 deletions examples/UI.ApplyRecursiveHierarchy-sample.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml">
<edmx:Include Namespace="Org.OData.Core.V1" Alias="Core" />
</edmx:Reference>
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Aggregation.V1.xml">
<edmx:Include Namespace="Org.OData.Aggregation.V1" Alias="Aggregation" />
</edmx:Reference>
<edmx:Reference Uri="https://sap.github.io/odata-vocabularies/vocabularies/UI.xml">
<edmx:Include Namespace="com.sap.vocabularies.UI.v1" Alias="UI" />
</edmx:Reference>

<edmx:DataServices>
<Schema Namespace="Examples" xmlns="http://docs.oasis-open.org/odata/ns/edm">

<EntityContainer Name="container">
<EntitySet Name="HierarchySet" EntityType="Examples.Hierarchy_Type" />
</EntityContainer>

<EntityType Name="Hierarchy_Type">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Edm.String" Nullable="false" MaxLength="10" />
<Property Name="StatusText" Type="Edm.String" MaxLength="30" />
<Property Name="Node" Type="Edm.Guid" Nullable="false" />
<NavigationProperty Name="to_Parent" Type="Hierarchy_Type" />
<!-- ... and a lot more -->
</EntityType>

<Annotations Target="Examples.Hierarchy_Type">

<Annotation Term="Aggregation.RecursiveHierarchy" Qualifier="myHierarchyQualifier">
<Record>
<PropertyValue Property="Node" PropertyPath="Node" />
<PropertyValue Property="ParentNavigationProperty" NavigationPropertyPath="to_Parent" />
</Record>
</Annotation>

<Annotation Term="UI.LineItem" Qualifier="useHierarchy">
<Collection>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="ID" />
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="StatusText" />
</Record>
</Collection>
</Annotation>
<Annotation Term="UI.PresentationVariant">
<Record>
<PropertyValue Property="Visualizations">
<Collection>
<AnnotationPath>UI.LineItem#useHierarchy</AnnotationPath>
</Collection>
</PropertyValue>
<PropertyValue Property="RecursiveHierarchyQualifier" String="myHierarchyQualifier" />
</Record>
</Annotation>

</Annotations>

</Schema>
</edmx:DataServices>
</edmx:Edmx>
6 changes: 6 additions & 0 deletions vocabularies/UI.json
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,12 @@
"@Core.Description": "Lists available visualization types. Currently supported types are `UI.LineItem`, `UI.Chart`, and `UI.DataPoint`.\n For each type, no more than a single annotation is meaningful. Multiple instances of the same visualization type\n shall be modeled with different presentation variants.\n A reference to `UI.Lineitem` should always be part of the collection (least common denominator for renderers).\n The first entry of the collection is the default visualization.\n ",
"@Validation.AllowedTerms": ["UI.Chart", "UI.DataPoint", "UI.LineItem"]
},
"RecursiveHierarchyQualifier": {
"$Type": "Aggregation.HierarchyQualifier",
"$Nullable": true,
"@Common.Experimental": true,
"@Core.Description": "Qualifier of the recursive hierarchy that should be applied to the Visualization"
},
"RequestAtLeast": {
"$Collection": true,
"$Type": "Edm.PropertyPath",
Expand Down
Loading

0 comments on commit 1ac31b8

Please sign in to comment.