Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions app/admin/fiori-service.cds
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ annotate AdminService.GenreHierarchy with {
ID @UI.Hidden;
};

@Hierarchy.RecursiveHierarchyActions #GenreHierarchy: {
annotate AdminService.GenreHierarchy with @Hierarchy.RecursiveHierarchyActions #GenreHierarchy: {
$Type : 'Hierarchy.RecursiveHierarchyActionsType',
// any name can be the action name with namespace/no bound action name
ChangeNextSiblingAction: 'AdminService.moveSibling',
}
};

annotate AdminService.GenreHierarchy with @UI: {
PresentationVariant #VH: {
Expand Down Expand Up @@ -210,8 +210,6 @@ annotate AdminService.ContentsHierarchy with @Hierarchy.RecursiveHierarchy#Conte
LimitedDescendantCount: LimitedDescendantCount,
DistanceFromRoot: DistanceFromRoot,
DrillState: DrillState,
Matched: Matched,
MatchedDescendantCount: MatchedDescendantCount,
LimitedRank: LimitedRank
};

Expand Down
2 changes: 0 additions & 2 deletions app/browse-genres/fiori-service.cds
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ annotate CatalogService.GenreHierarchy with @Hierarchy.RecursiveHierarchy#GenreH
LimitedDescendantCount: LimitedDescendantCount,
DistanceFromRoot: DistanceFromRoot,
DrillState: DrillState,
Matched: Matched,
MatchedDescendantCount: MatchedDescendantCount,
LimitedRank: LimitedRank
};
2 changes: 0 additions & 2 deletions app/genres/fiori-service.cds
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@ annotate AdminService.GenreHierarchy with @Aggregation.RecursiveHierarchy#GenreH
LimitedDescendantCount: LimitedDescendantCount,
DistanceFromRoot: DistanceFromRoot,
DrillState: DrillState,
Matched: Matched,
MatchedDescendantCount: MatchedDescendantCount,
LimitedRank: LimitedRank
};
17 changes: 8 additions & 9 deletions db/books.cds
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
namespace my.bookshop;

using {
Currency,
sap,
managed,
cuid
} from '@sap/cds/common';
using {Currency, sap, managed, cuid} from '@sap/cds/common';
using my.bookshop.Reviews from './reviews';
using my.bookshop.TechnicalBooleanFlag from './common';
using {my.common.Hierarchy as Hierarchy} from './hierarchy';

@fiori.draft.enabled
entity Books : cuid, managed {
Expand Down Expand Up @@ -50,17 +46,20 @@ annotate Authors with
/**
* Hierarchically organized Code List for Genres
*/
entity Genres : sap.common.CodeList {
entity Genres : sap.common.CodeList, Hierarchy {
key ID : UUID;
siblingRank : Integer;
// move siblings
siblingRank : Integer;
parent : Association to Genres;
// for cascade delete
children : Composition of many Genres on children.parent = $self;
}


/**
* Hierarchically organized entity for Contents
*/
entity Contents {
entity Contents: Hierarchy {
key ID : UUID;
name : String;
page : Integer;
Expand Down
6 changes: 0 additions & 6 deletions srv/hierarchy.cds → db/hierarchy.cds
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ aspect Hierarchy {
virtual LimitedDescendantCount : Integer64;
virtual DistanceFromRoot : Integer64;
virtual DrillState : String;
virtual Matched : Boolean;
virtual MatchedDescendantCount : Integer64;
virtual LimitedRank : Integer64;
}

Expand All @@ -14,16 +12,12 @@ annotate Hierarchy with @Capabilities.FilterRestrictions.NonFilterableProperties
'LimitedDescendantCount',
'DistanceFromRoot',
'DrillState',
'Matched',
'MatchedDescendantCount',
'LimitedRank'
];

annotate Hierarchy with @Capabilities.SortRestrictions.NonSortableProperties: [
'LimitedDescendantCount',
'DistanceFromRoot',
'DrillState',
'Matched',
'MatchedDescendantCount',
'LimitedRank'
];
4 changes: 1 addition & 3 deletions srv/admin-service.cds
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using {sap.common.Languages as CommonLanguages, cuid} from '@sap/cds/common';
using {my.bookshop as my} from '../db/index';
using {sap.changelog as changelog} from 'com.sap.cds/change-tracking';
using {my.common.Hierarchy as Hierarchy} from './hierarchy';
using {sap.attachments.Attachments} from 'com.sap.cds/cds-feature-attachments';

extend my.Orders with changelog.changeTracked;
extend my.Genres with Hierarchy;

@path: 'admin'
@odata.apply.transformations
Expand All @@ -26,12 +24,12 @@ service AdminService @(requires: 'admin') {
entity GenreHierarchy as projection on my.Genres
excluding {children} order by siblingRank
actions {
// Custom Handler -> HierarchySiblingActionHandler.java
// Experimental UI feature, see:
// https://github.com/SAP/odata-vocabularies/blob/main/vocabularies/Hierarchy.md#template_changenextsiblingaction-experimental
action moveSibling(NextSibling : NextSibling);
};

extend my.Contents with Hierarchy;
entity ContentsHierarchy as projection on my.Contents;

@cds.persistence.skip
Expand Down