File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
srv/src/main/java/my/bookshop/handlers Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,8 @@ annotate AdminService.GenreHierarchy with @UI: {
104104 LineItem : [{
105105 $Type : ' UI.DataField ' ,
106106 Value : name ,
107- }]
107+ Label : ' Genre '
108+ }],
108109};
109110
110111annotate AdminService.ContentsHierarchy with @ UI : {
@@ -123,8 +124,8 @@ annotate AdminService.ContentsHierarchy with @UI: {
123124 }],
124125 HeaderInfo : {
125126 $Type : ' UI.HeaderInfoType ' ,
126- TypeName : ' Organization Level' ,
127- TypeNamePlural : ' Organization Levels' ,
127+ TypeName : ' Contents Level' ,
128+ TypeNamePlural : ' Contents Levels' ,
128129 Title : {
129130 $Type : ' UI.DataField ' ,
130131 Value : name ,
Original file line number Diff line number Diff line change 11package my .bookshop .handlers ;
2-
32import java .util .List ;
43
54import org .springframework .context .annotation .Profile ;
2120import cds .gen .adminservice .GenreHierarchy_ ;
2221
2322
23+
2424@ Component
2525@ ServiceName (AdminService_ .CDS_NAME )
2626/**
2727 * For testing purposes of modifying requests for hierarchies
28+ * Remove when generic solution for $apply and $expand is available
2829 */
2930@ Profile ("hybrid" )
3031public class HierarchyExpandHandler implements EventHandler {
@@ -37,12 +38,15 @@ void removeExpand(CdsReadEventContext event) {
3738 }
3839 if (trafos .get (0 ) instanceof CqnAncestorsTransformation ) {
3940 CqnSelect original = event .getCqn ();
40- CqnSelect copy = CQL .copy (original , new Modifier () {
41- public List <CqnSelectListItem > items (List <CqnSelectListItem > items ) {
42- return items .stream ().filter (i -> !i .isExpand ()).toList ();
43- }
44- });
41+ Boolean isExpand = original .items ().stream ().filter (CqnSelectListItem ::isExpand ).findAny ().isPresent ();
42+ if (isExpand ) {
43+ CqnSelect copy = CQL .copy (original , new Modifier () {
44+ public List <CqnSelectListItem > items (List <CqnSelectListItem > items ) {
45+ return items .stream ().filter (i -> !i .isExpand ()).toList ();
46+ }
47+ });
4548 event .setCqn (copy );
49+ }
4650 }
4751 event .proceed ();
4852 }
You can’t perform that action at this time.
0 commit comments