Skip to content

Commit 20c7034

Browse files
agoerlereugene-andreevmofterdinger
authored
Use @hierarchy annotation (#601)
Co-authored-by: Evgeny Andreev <evgeny.andreev@sap.com> Co-authored-by: Markus Ofterdinger <markus.ofterdinger@sap.com>
1 parent 15fa786 commit 20c7034

11 files changed

Lines changed: 513 additions & 399 deletions

File tree

app/admin/fiori-service.cds

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ annotate AdminService.GenreHierarchy with {
9494
ID @UI.Hidden;
9595
};
9696

97-
annotate AdminService.GenreHierarchy with @Hierarchy.RecursiveHierarchyActions #GenreHierarchy: {
97+
annotate AdminService.GenreHierarchy with @Hierarchy.RecursiveHierarchyActions #GenreHierarchyHierarchy: {
9898
$Type : 'Hierarchy.RecursiveHierarchyActionsType',
9999
// any name can be the action name with namespace/no bound action name
100100
ChangeNextSiblingAction: 'AdminService.moveSibling',
@@ -104,7 +104,7 @@ annotate AdminService.GenreHierarchy with @UI: {
104104
PresentationVariant #VH: {
105105
$Type : 'UI.PresentationVariantType',
106106
Visualizations : ['@UI.LineItem'],
107-
RecursiveHierarchyQualifier: 'GenreHierarchy'
107+
RecursiveHierarchyQualifier: 'GenreHierarchyHierarchy'
108108
},
109109
LineItem : [{
110110
$Type: 'UI.DataField',
@@ -196,19 +196,7 @@ annotate AdminService.Books.texts {
196196
//
197197
// Annotations for hierarchy ContentsHierarchy
198198
//
199-
annotate AdminService.ContentsHierarchy with @Aggregation.RecursiveHierarchy#ContentsHierarchy: {
200-
$Type: 'Aggregation.RecursiveHierarchyType',
201-
NodeProperty: ID, // identifies a node
202-
ParentNavigationProperty: parent // navigates to a node's parent
203-
};
204-
205-
annotate AdminService.ContentsHierarchy with @Hierarchy.RecursiveHierarchy#ContentsHierarchy: {
206-
$Type: 'Hierarchy.RecursiveHierarchyType',
207-
LimitedDescendantCount: LimitedDescendantCount,
208-
DistanceFromRoot: DistanceFromRoot,
209-
DrillState: DrillState,
210-
LimitedRank: LimitedRank
211-
};
199+
annotate AdminService.ContentsHierarchy with @hierarchy;
212200

213201
annotate AdminService.Books actions {
214202
@(

app/admin/webapp/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"controlConfiguration": {
125125
"contents/@com.sap.vocabularies.UI.v1.LineItem": {
126126
"tableSettings": {
127-
"hierarchyQualifier": "ContentsHierarchy",
127+
"hierarchyQualifier": "ContentsHierarchyHierarchy",
128128
"type": "TreeTable"
129129
}
130130
}

app/browse-genres/fiori-service.cds

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,5 @@
55
using CatalogService from '../../srv/cat-service';
66

77

8-
annotate CatalogService.GenreHierarchy with @Aggregation.RecursiveHierarchy#GenreHierarchy: {
9-
$Type: 'Aggregation.RecursiveHierarchyType',
10-
NodeProperty: ID, // identifies a node
11-
ParentNavigationProperty: parent // navigates to a node's parent
12-
};
8+
annotate CatalogService.GenreHierarchy with @hierarchy;
139

14-
annotate CatalogService.GenreHierarchy with @Hierarchy.RecursiveHierarchy#GenreHierarchy: {
15-
$Type: 'Hierarchy.RecursiveHierarchyType',
16-
LimitedDescendantCount: LimitedDescendantCount,
17-
DistanceFromRoot: DistanceFromRoot,
18-
DrillState: DrillState,
19-
LimitedRank: LimitedRank
20-
};

app/browse-genres/webapp/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"controlConfiguration": {
8989
"@com.sap.vocabularies.UI.v1.LineItem": {
9090
"tableSettings": {
91-
"hierarchyQualifier": "GenreHierarchy",
91+
"hierarchyQualifier": "GenreHierarchyHierarchy",
9292
"type": "TreeTable"
9393
}
9494
}

app/genres/fiori-service.cds

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,4 @@
55
using AdminService from '../../srv/admin-service';
66

77

8-
annotate AdminService.GenreHierarchy with @Aggregation.RecursiveHierarchy#GenreHierarchy: {
9-
$Type: 'Aggregation.RecursiveHierarchyType',
10-
NodeProperty: ID, // identifies a node
11-
ParentNavigationProperty: parent // navigates to a node's parent
12-
};
13-
14-
annotate AdminService.GenreHierarchy with @Hierarchy.RecursiveHierarchy#GenreHierarchy: {
15-
$Type: 'Hierarchy.RecursiveHierarchyType',
16-
// ExternalKey : null,
17-
LimitedDescendantCount: LimitedDescendantCount,
18-
DistanceFromRoot: DistanceFromRoot,
19-
DrillState: DrillState,
20-
LimitedRank: LimitedRank
21-
};
8+
annotate AdminService.GenreHierarchy with @hierarchy;

app/genres/webapp/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"controlConfiguration": {
9494
"@com.sap.vocabularies.UI.v1.LineItem": {
9595
"tableSettings": {
96-
"hierarchyQualifier": "GenreHierarchy",
96+
"hierarchyQualifier": "GenreHierarchyHierarchy",
9797
"type": "TreeTable"
9898
}
9999
}

db/books.cds

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ namespace my.bookshop;
33
using {Currency, sap, managed, cuid} from '@sap/cds/common';
44
using my.bookshop.Reviews from './reviews';
55
using my.bookshop.TechnicalBooleanFlag from './common';
6-
using {my.common.Hierarchy as Hierarchy} from './hierarchy';
76

87
@fiori.draft.enabled
98
entity Books : cuid, managed {
@@ -46,7 +45,7 @@ annotate Authors with
4645
/**
4746
* Hierarchically organized Code List for Genres
4847
*/
49-
entity Genres : sap.common.CodeList, Hierarchy {
48+
entity Genres : sap.common.CodeList {
5049
key ID : UUID;
5150
// move siblings
5251
siblingRank : Integer;
@@ -59,7 +58,7 @@ entity Genres : sap.common.CodeList, Hierarchy {
5958
/**
6059
* Hierarchically organized entity for Contents
6160
*/
62-
entity Contents: Hierarchy {
61+
entity Contents {
6362
key ID : UUID;
6463
name : String;
6564
page : Integer;

db/hierarchy.cds

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)