File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
srv/src/main/java/my/bookshop Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -72,13 +72,13 @@ class CatalogServiceHandler implements EventHandler {
7272 }
7373
7474 @ Before (entity = Books_ .CDS_NAME )
75- public void beforeReadBooks (CdsReadEventContext context ) {
75+ public void alwaysSelectStock (CdsReadEventContext context ) {
7676 CqnSelect copy = CQL .copy (context .getCqn (), new Modifier () {
7777 @ Override
7878 public List <CqnSelectListItem > items (List <CqnSelectListItem > items ) {
79- CqnSelectListItem stock = CQL . get ( "stock" );
80- if (! items .contains (stock )) {
81- items .add (stock );
79+ var paths = items . stream (). filter ( i -> i . isRef ()). map ( i -> i . asRef (). path ()). collect ( Collectors . toSet () );
80+ if (paths . contains ( Books . TITLE ) && ! paths .contains (Books . STOCK )) {
81+ items .add (CQL . get ( Books . STOCK ) );
8282 }
8383 return items ;
8484 }
Original file line number Diff line number Diff line change 22
33import java .util .LinkedHashMap ;
44import java .util .Map ;
5-
65import org .springframework .boot .actuate .endpoint .annotation .Endpoint ;
76import org .springframework .boot .actuate .endpoint .annotation .ReadOperation ;
87import org .springframework .boot .autoconfigure .condition .ConditionalOnClass ;
1413 */
1514@ Component
1615@ ConditionalOnClass (Endpoint .class )
17- @ Endpoint (id = "bookshop" , enableByDefault = true )
16+ @ Endpoint (id = "bookshop" )
1817public class AppActuator {
1918
2019 @ ReadOperation
You can’t perform that action at this time.
0 commit comments