From dfb953f6c8ebaf6e48a97e5077509513e3f63a0c Mon Sep 17 00:00:00 2001 From: Evgeny Andreev Date: Fri, 27 Jun 2025 15:13:54 +0200 Subject: [PATCH 1/8] Update version to 4.1.0 --- app/admin/fiori-service.cds | 3 +- pom.xml | 2 +- srv/admin-service.cds | 5 - .../handlers/AdminServiceHandler.java | 7 - .../bookshop/handlers/HierarchyHandler.java | 313 ------------------ .../handlers/HierarchyHandlerSorterTest.java | 70 ---- 6 files changed, 2 insertions(+), 398 deletions(-) delete mode 100644 srv/src/main/java/my/bookshop/handlers/HierarchyHandler.java delete mode 100644 srv/src/test/java/my/bookshop/handlers/HierarchyHandlerSorterTest.java diff --git a/app/admin/fiori-service.cds b/app/admin/fiori-service.cds index 2c9758c3..4cb63190 100644 --- a/app/admin/fiori-service.cds +++ b/app/admin/fiori-service.cds @@ -40,8 +40,7 @@ annotate AdminService.Books with @(UI : { { $Type : 'UI.ReferenceFacet', Label : '{i18n>Contents}', - Target : 'contents/@UI.PresentationVariant', - @UI.Hidden: { $edmJson: { $Path: '/Info/hideTreeTable' } } + Target : 'contents/@UI.PresentationVariant' } ], FieldGroup #General : {Data : [ diff --git a/pom.xml b/pom.xml index 083ba274..a97e6356 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ 21 - 4.0.2 + 4.1.0 5.20.0 3.6.0 3.8.5 diff --git a/srv/admin-service.cds b/srv/admin-service.cds index 83bb0a52..0ea1e647 100644 --- a/srv/admin-service.cds +++ b/srv/admin-service.cds @@ -36,11 +36,6 @@ service AdminService @(requires: 'admin') { entity Upload @odata.singleton { csv : LargeBinary @Core.MediaType: 'text/csv'; } - - @cds.persistence.skip - @readonly entity Info @odata.singleton { - hideTreeTable: Boolean; - } } // Deep Search Items diff --git a/srv/src/main/java/my/bookshop/handlers/AdminServiceHandler.java b/srv/src/main/java/my/bookshop/handlers/AdminServiceHandler.java index 9785db72..fab03cc3 100644 --- a/srv/src/main/java/my/bookshop/handlers/AdminServiceHandler.java +++ b/srv/src/main/java/my/bookshop/handlers/AdminServiceHandler.java @@ -303,13 +303,6 @@ public void restoreCoversUpId(CqnStructuredTypeRef ref, BooksCovers cover) { cover.setUpId((String) analyzer.analyze(ref).rootKeys().get(Books.ID)); } - @On(event = CqnService.EVENT_READ, entity = Info_.CDS_NAME) - public Info readInfo() { - Info info = Info.create(); - info.setHideTreeTable(!env.matchesProfiles("cloud")); - return info; - } - private Supplier notFound(String message) { return () -> new ServiceException(ErrorStatuses.NOT_FOUND, message); } diff --git a/srv/src/main/java/my/bookshop/handlers/HierarchyHandler.java b/srv/src/main/java/my/bookshop/handlers/HierarchyHandler.java deleted file mode 100644 index 4ffe06c3..00000000 --- a/srv/src/main/java/my/bookshop/handlers/HierarchyHandler.java +++ /dev/null @@ -1,313 +0,0 @@ -package my.bookshop.handlers; - -import java.util.ArrayDeque; -import java.util.Comparator; -import java.util.Deque; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import org.springframework.context.annotation.Profile; -import org.springframework.stereotype.Component; - -import com.sap.cds.Row; -import com.sap.cds.ql.CQL; -import com.sap.cds.ql.Select; -import com.sap.cds.ql.cqn.CqnElementRef; -import com.sap.cds.ql.cqn.CqnPredicate; -import com.sap.cds.ql.cqn.CqnSelect; -import com.sap.cds.ql.cqn.CqnValue; -import com.sap.cds.ql.cqn.Modifier; -import com.sap.cds.ql.cqn.transformation.CqnTopLevelsTransformation; -import com.sap.cds.ql.cqn.transformation.CqnAncestorsTransformation; -import com.sap.cds.ql.cqn.transformation.CqnDescendantsTransformation; -import com.sap.cds.ql.cqn.transformation.CqnFilterTransformation; -import com.sap.cds.ql.cqn.transformation.CqnSearchTransformation; -import com.sap.cds.ql.cqn.transformation.CqnOrderByTransformation; -import com.sap.cds.ql.cqn.transformation.CqnTransformation; -import com.sap.cds.services.cds.CdsReadEventContext; -import com.sap.cds.services.cds.CqnService; -import com.sap.cds.services.handler.EventHandler; -import com.sap.cds.services.handler.annotations.Before; -import com.sap.cds.services.handler.annotations.ServiceName; -import com.sap.cds.services.persistence.PersistenceService; - -import cds.gen.catalogservice.CatalogService_; -import cds.gen.catalogservice.GenreHierarchy; -import cds.gen.catalogservice.GenreHierarchy_; - -import static cds.gen.catalogservice.CatalogService_.GENRE_HIERARCHY; - -@Component -@Profile("default") // non-HANA -@ServiceName(CatalogService_.CDS_NAME) -/** - * On HANA, requests for GenreHierarchy are handled generically. - * - * This handler is only in effect when running with the `default` profile on - * H2. It is a stand-in for non-HANA until the CAP Java runtime can also handle - * requests for hierarchies on non-HANA databases. - * - * The handler is neither functionally complete nor correct for all requests. It - * is not intended as a blue-print for custom code. - */ -public class HierarchyHandler implements EventHandler { - - private final PersistenceService db; - - HierarchyHandler(PersistenceService db) { - this.db = db; - } - - @Before(event = CqnService.EVENT_READ, entity = GenreHierarchy_.CDS_NAME) - public void readGenreHierarchy(CdsReadEventContext event) { - List trafos = event.getCqn().transformations(); - List result = null; - - if (trafos.size() < 1) { - return; - } - - if (getTopLevels(trafos) instanceof CqnTopLevelsTransformation topLevels) { - result = topLevels(topLevels, CQL.TRUE); - } else if (trafos.get(0) instanceof CqnDescendantsTransformation descendants) { - result = handleDescendants(descendants); - } else if (trafos.get(0) instanceof CqnAncestorsTransformation ancestors) { - if (trafos.size() == 2 && trafos.get(1) instanceof CqnTopLevelsTransformation topLevels) { - result = handleAncestors(ancestors, topLevels); - } else if (trafos.size() == 3 && trafos.get(2) instanceof CqnTopLevelsTransformation topLevels) { - result = handleAncestors(ancestors, topLevels); - } - } - - setResult(event, result); - } - - private CqnTopLevelsTransformation getTopLevels(List trafos) { - if (trafos.get(0) instanceof CqnTopLevelsTransformation topLevels) { - return topLevels; - } else if (trafos.size() == 2 && trafos.get(0) instanceof CqnOrderByTransformation - && trafos.get(1) instanceof CqnTopLevelsTransformation topLevels) { - return topLevels; - } - return null; - } - - private void setResult(CdsReadEventContext event, List result) { - if (!result.isEmpty()) { - addDrillState(result); - } - - event.setResult(result); - } - - private void addDrillState(List ghs) { - List ids = ghs.stream().map(gh -> gh.getId()).toList(); - Set parents = ghs.stream().map(gh -> gh.getParentId()).filter(p -> p != null) - .collect(Collectors.toSet()); - CqnSelect q = Select.from(GENRE_HIERARCHY).columns(gh -> gh.parent_ID().as("id")) - .where(gh -> gh.parent_ID().in(ids)); - Set nonLeafs = db - .run(q) - .stream().map(r -> r.get("id")).collect(Collectors.toSet()); - - for (GenreHierarchy gh : ghs) { - String id = gh.getId(); - if (nonLeafs.contains(id)) { - if (parents.contains(id)) { - gh.setDrillState("expanded"); - } else { - gh.setDrillState("collapsed"); - } - } else { - gh.setDrillState("leaf"); - } - } - } - - private CqnPredicate descendantsFilter(CqnDescendantsTransformation descendants) { - CqnTransformation trafo = descendants.transformations().get(0); - CqnPredicate start = ((CqnFilterTransformation) trafo).filter(); - CqnPredicate result = CQL.FALSE; - if (descendants.keepStart()) { - result = CQL.or(result, start); - } - CqnPredicate children = CQL.copy(start, new Modifier() { - @Override - public CqnValue ref(CqnElementRef ref) { - return CQL.get(GenreHierarchy.PARENT_ID); - } - }); - result = CQL.or(result, children); - - return result; - } - - private CqnPredicate ancestorsFilter(CqnAncestorsTransformation ancestors) { - CqnTransformation trafo = ancestors.transformations().get(0); - Select inner = Select.from(GENRE_HIERARCHY).columns(gh -> gh.ID()); - if (trafo instanceof CqnFilterTransformation filter) { - inner.where(filter.filter()); - } else if (trafo instanceof CqnSearchTransformation search) { - inner.search(search.search()); - } - - Select outer = Select.from(GENRE_HIERARCHY) - .columns(gh -> gh.ID().as("i0"), - gh -> gh.parent().ID().as("i1"), - gh -> gh.parent().parent().ID().as("i2"), - gh -> gh.parent().parent().parent().ID().as("i3"), - gh -> gh.parent().parent().parent().parent().ID().as("i4")) - .where(gh -> gh.ID().in(inner)); - - Set ancestorIds = new HashSet<>(); - db.run(outer).stream().forEach(r -> { - addIfNotNull(ancestorIds, r, "i0"); - addIfNotNull(ancestorIds, r, "i1"); - addIfNotNull(ancestorIds, r, "i2"); - addIfNotNull(ancestorIds, r, "i3"); - addIfNotNull(ancestorIds, r, "i4"); - }); - - return CQL.get(GenreHierarchy_.ID).in(ancestorIds.stream().toList()); - } - - private List handleDescendants(CqnDescendantsTransformation descendants) { - CqnPredicate filter = descendantsFilter(descendants); - CqnSelect childrenCQN = Select.from(GENRE_HIERARCHY).where(filter); - List nodes = db.run(childrenCQN).listOf(GenreHierarchy.class); - - connect(nodes); - - return nodes.stream().sorted(new Sorter()).toList(); - } - - private static void connect(List nodes) { - Map lookup = new HashMap<>(); - nodes.forEach(gh -> lookup.put(gh.getId(), gh)); - nodes.forEach(gh -> gh.setParent(lookup.get(gh.getParentId()))); - nodes.forEach(gh -> gh.setDistanceFromRoot(distanceFromRoot(gh))); - } - - private List handleAncestors(CqnAncestorsTransformation ancestors, - CqnTopLevelsTransformation topLevels) { - CqnPredicate filter = ancestorsFilter(ancestors); - - return topLevels(topLevels, filter); - } - - private void addIfNotNull(Set ancestorIds, Row r, String key) { - String id = (String) r.get(key); - if (id != null) { - ancestorIds.add(id); - } - } - - private List topLevels(CqnTopLevelsTransformation topLevels, CqnPredicate filter) { - return topLevels.levels() < 0 ? topLevelsAll(filter) : topLevelsLimit(topLevels, filter); - } - - private List topLevelsLimit(CqnTopLevelsTransformation topLevels, CqnPredicate filter) { - long limit = topLevels.levels(); - Map lookup = new HashMap<>(); - Map expandLevels = topLevels.expandLevels(); - - CqnSelect getRoots = Select.from(GENRE_HIERARCHY).where(gh -> gh.parent_ID().isNull().and(filter)); - List roots = db.run(getRoots).listOf(GenreHierarchy.class); - roots.forEach(root -> { - root.setDistanceFromRoot(0l); - lookup.put(root.getId(), root); - List parents = List.of(root.getId()); - for (long i = 1; i < limit; i++) { - List ps = parents; - CqnSelect getChildren = Select.from(GENRE_HIERARCHY) - .where(gh -> gh.parent_ID().in(ps).and(filter)); - List children = db.run(getChildren).listOf(GenreHierarchy.class); - if (children.isEmpty()) { - break; - } - long dfr = i; - parents = children.stream().peek(gh -> { - gh.setParent(lookup.get(gh.getParentId())); - gh.setDistanceFromRoot(dfr); - lookup.put(gh.getId(), gh); - }).map(GenreHierarchy::getId).toList(); - } - }); - - if (!expandLevels.isEmpty()) { - List expandedIds = expandLevels.keySet().stream().map(key -> (String) key).toList(); - CqnSelect expandedCQN = Select.from(CatalogService_.GENRE_HIERARCHY).where(gh -> CQL.and(filter, - CQL.or(gh.ID().in(expandedIds), gh.parent_ID().in(expandedIds)))); - - List expanded = db.run(expandedCQN).listOf(GenreHierarchy.class); - expanded.forEach(gh -> { - if (!lookup.keySet().contains(gh.getId())) { - gh.setParent(lookup.get(gh.getParentId())); - gh.setDistanceFromRoot(distanceFromRoot(gh)); - lookup.put(gh.getId(), gh); - } - }); - - } - - return lookup.values().stream().sorted(new Sorter()).toList(); - } - - private List topLevelsAll(CqnPredicate filter) { - CqnSelect allCqn = Select.from(GENRE_HIERARCHY).where(filter); - var all = db.run(allCqn).listOf(GenreHierarchy.class); - - connect(all); - - return all.stream().sorted(new Sorter()).toList(); - } - - private static long distanceFromRoot(GenreHierarchy gh) { - long dfr = 0; - while (gh.getParent() != null) { - dfr++; - gh = gh.getParent(); - } - - return dfr; - } - - static class Sorter implements Comparator { - - @Override - public int compare(GenreHierarchy gh1, GenreHierarchy gh2) { - Deque path1 = getPath(gh1); - Deque path2 = getPath(gh2); - int res = 0; - - while (true) { - if (path1.isEmpty()) { - return path2.isEmpty() ? 0 : -1; - } - if (path2.isEmpty()) { - return +1; - } - String last1 = path1.pop(); - String last2 = path2.pop(); - res = last1.compareTo(last2); - if (res != 0) { - return res; - } - } - } - - Deque getPath(GenreHierarchy gh) { - Deque path = new ArrayDeque<>(); - do { - path.push(gh.getName()); - gh = gh.getParent(); - } while (gh != null); - - return path; - } - } -} diff --git a/srv/src/test/java/my/bookshop/handlers/HierarchyHandlerSorterTest.java b/srv/src/test/java/my/bookshop/handlers/HierarchyHandlerSorterTest.java deleted file mode 100644 index 57ea139d..00000000 --- a/srv/src/test/java/my/bookshop/handlers/HierarchyHandlerSorterTest.java +++ /dev/null @@ -1,70 +0,0 @@ -package my.bookshop.handlers; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import java.util.List; -import org.junit.jupiter.api.Test; - -import cds.gen.catalogservice.GenreHierarchy; -import my.bookshop.handlers.HierarchyHandler.Sorter; - -public class HierarchyHandlerSorterTest { - - @Test - public void testSortRoots() { - GenreHierarchy r1 = genre("Philosophical fiction"); - GenreHierarchy r2 = genre("Epic"); - List sorted = sorted(r1, r2); - - assertEquals("Epic", sorted.get(0).getName()); - assertEquals("Philosophical fiction", sorted.get(1).getName()); - } - - @Test - public void testSortSiblings() { - GenreHierarchy root = genre("Folklore"); - GenreHierarchy g1 = genre("Urban legend", root); - GenreHierarchy g2 = genre("Fairy tale", root); - List sorted = sorted(g1, g2); - - assertEquals("Fairy tale", sorted.get(0).getName()); - assertEquals("Urban legend", sorted.get(1).getName()); - } - - @Test - public void testSortChildrenWithDifRoot() { - GenreHierarchy r1 = genre("Thriller"); - GenreHierarchy r2 = genre("Folklore"); - GenreHierarchy g2 = genre("Urban legend", r2); - List sorted = sorted(r1, g2); - - assertEquals("Urban legend", sorted.get(0).getName()); - assertEquals("Thriller", sorted.get(1).getName()); - } - - @Test - public void testSortChildrenSameRoot() { - GenreHierarchy r1 = genre("Folklore"); - GenreHierarchy g1 = genre("Urban legend", r1); - List sorted = sorted(g1, r1); - - assertEquals("Folklore", sorted.get(0).getName()); - assertEquals("Urban legend", sorted.get(1).getName()); - } - - private static GenreHierarchy genre(String name, GenreHierarchy parent) { - GenreHierarchy genre = GenreHierarchy.create(); - genre.setName(name); - if (parent != null) { - genre.setParent(parent); - } - return genre; - } - - private static GenreHierarchy genre(String name) { - return genre(name, null); - } - - private static List sorted(GenreHierarchy... h) { - return List.of(h).stream().sorted(new Sorter()).toList(); - } -} From ad2af3c3a3ecf156cb96775cd674a2f18aa89e2e Mon Sep 17 00:00:00 2001 From: Evgeny Andreev Date: Mon, 30 Jun 2025 15:35:01 +0200 Subject: [PATCH 2/8] fix test + address comments --- .../main/java/my/bookshop/handlers/AdminServiceHandler.java | 6 +----- .../my/bookshop/handlers/HierarchySiblingActionHandler.java | 2 -- srv/src/test/java/my/bookshop/GenreHierarchyTest.java | 4 ++-- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/srv/src/main/java/my/bookshop/handlers/AdminServiceHandler.java b/srv/src/main/java/my/bookshop/handlers/AdminServiceHandler.java index fab03cc3..439dd748 100644 --- a/srv/src/main/java/my/bookshop/handlers/AdminServiceHandler.java +++ b/srv/src/main/java/my/bookshop/handlers/AdminServiceHandler.java @@ -47,8 +47,6 @@ import cds.gen.adminservice.BooksAddToOrderContext; import cds.gen.adminservice.BooksCovers; import cds.gen.adminservice.Books_; -import cds.gen.adminservice.Info; -import cds.gen.adminservice.Info_; import cds.gen.adminservice.OrderItems; import cds.gen.adminservice.OrderItems_; import cds.gen.adminservice.Orders; @@ -70,13 +68,11 @@ class AdminServiceHandler implements EventHandler { private final PersistenceService db; private final Messages messages; private final CqnAnalyzer analyzer; - private final Environment env; - AdminServiceHandler(AdminService.Draft adminService, PersistenceService db, Messages messages, CdsModel model, Environment env) { + AdminServiceHandler(AdminService.Draft adminService, PersistenceService db, Messages messages, CdsModel model) { this.adminService = adminService; this.db = db; this.messages = messages; - this.env = env; // model is a tenant-dependant model proxy this.analyzer = CqnAnalyzer.create(model); diff --git a/srv/src/main/java/my/bookshop/handlers/HierarchySiblingActionHandler.java b/srv/src/main/java/my/bookshop/handlers/HierarchySiblingActionHandler.java index 31f08b6c..0791daaf 100644 --- a/srv/src/main/java/my/bookshop/handlers/HierarchySiblingActionHandler.java +++ b/srv/src/main/java/my/bookshop/handlers/HierarchySiblingActionHandler.java @@ -4,7 +4,6 @@ import java.util.List; -import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; import com.sap.cds.ql.CQL; @@ -26,7 +25,6 @@ /** * Example of a custom handler for nextSiblingAction */ -@Profile("cloud") public class HierarchySiblingActionHandler implements EventHandler { private final PersistenceService db; diff --git a/srv/src/test/java/my/bookshop/GenreHierarchyTest.java b/srv/src/test/java/my/bookshop/GenreHierarchyTest.java index e005ff2a..54a61e71 100644 --- a/srv/src/test/java/my/bookshop/GenreHierarchyTest.java +++ b/srv/src/test/java/my/bookshop/GenreHierarchyTest.java @@ -106,7 +106,7 @@ void testExpandNonFiction() throws Exception { void testCollapseAll() throws Exception { client.perform(get(genresURI + "?$select=DrillState,ID,name" - + "&$apply=com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/GenreHierarchy,HierarchyQualifier='GenreHierarchy',NodeProperty='ID',Levels=1)" + + "&$apply=orderby(name)/com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/GenreHierarchy,HierarchyQualifier='GenreHierarchy',NodeProperty='ID',Levels=1)" + "&$count=true&$skip=0&$top=238")) .andExpect(status().isOk()) .andExpect(jsonPath("$.value[0].name").value("Fiction")) @@ -121,7 +121,7 @@ void testCollapseAll() throws Exception { void testExpandAll() throws Exception { String url = genresURI + "?$select=DistanceFromRoot,DrillState,ID,LimitedDescendantCount,name" - + "&$apply=com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/GenreHierarchy,HierarchyQualifier='GenreHierarchy',NodeProperty='ID')" + + "&$apply=orderby(name)/com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/GenreHierarchy,HierarchyQualifier='GenreHierarchy',NodeProperty='ID')" + "&$count=true&$skip=0&$top=238"; ResultActions expectations = client.perform(get(url)) From 8d23c2ba385996d1cc83391bdb7900c00c22143a Mon Sep 17 00:00:00 2001 From: Evgeny Andreev Date: Mon, 30 Jun 2025 15:42:40 +0200 Subject: [PATCH 3/8] readme --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 29311a48..3ff8f8b9 100644 --- a/README.md +++ b/README.md @@ -90,9 +90,8 @@ User Interface related Features: - [Model Localization](https://cap.cloud.sap/docs/guides/i18n) for [English](app/_i18n/i18n.properties) and [German](app/_i18n/i18n_de.properties) language for static texts - [Custom File Upload extension](app/admin/webapp/extension/Upload.js) which provides a button for uploading `CSV` files - A simple Swagger UI for the CatalogService API at -- UI5 [Tree Table](app/genres/webapp/manifest.json) with CRUD requests and Value Help for [GenreHierarchy](app/admin/fiori-service.cds). Only on HANA. To check tree table `Contents` embedded into `Books`, please remove `@UI.Hidden` annotation from [Fiori Service](app/admin/fiori-service.cds) -- [Custom event handlers](https://cap.cloud.sap/docs/java/provisioning-api) for Tree Table such as the [Custom business logic for GenreHierarchy](srv/src/main/java/my/bookshop/handlers/HierarchyHandler.java). - Please note, that Tree Tables must be used with HANA. Custom event handler in this case provides a limited support ment for local testing. +- UI5 [Tree Table](app/genres/webapp/manifest.json) with CRUD requests and Value Help for [GenreHierarchy](app/admin/fiori-service.cds). + Please note, that Tree Tables must be used with HANA (for productive usage) or H2 (for local development and testing). - [Custom actions](https://cap.cloud.sap/docs/cds/cdl#actions) such as `moveSibling` in the [Admin Service](srv/admin-service.cds). This action demonstrates experimental UI feature [ChangeNextSiblingAction](https://github.com/SAP/odata-vocabularies/blob/main/vocabularies/Hierarchy.md#template_changenextsiblingaction-experimental). The Action implementation is in the [Hierarchy Sibling Action Handler](srv/src/main/java/my/bookshop/handlers/HierarchySiblingActionHandler.java) CDS Maven Plugin Features: From 2bb64bd736f9fdcc9e0f069a4e85084ccdf482f8 Mon Sep 17 00:00:00 2001 From: Evgeny Andreev Date: Thu, 3 Jul 2025 13:02:50 +0200 Subject: [PATCH 4/8] remove unused import --- .../main/java/my/bookshop/handlers/AdminServiceHandler.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/srv/src/main/java/my/bookshop/handlers/AdminServiceHandler.java b/srv/src/main/java/my/bookshop/handlers/AdminServiceHandler.java index 439dd748..c517f493 100644 --- a/srv/src/main/java/my/bookshop/handlers/AdminServiceHandler.java +++ b/srv/src/main/java/my/bookshop/handlers/AdminServiceHandler.java @@ -15,10 +15,7 @@ import java.util.UUID; import java.util.function.Supplier; import java.util.stream.Stream; - -import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; - import com.sap.cds.Result; import com.sap.cds.ql.Select; import com.sap.cds.ql.Update; From d3b7df0f1f28a2d993a6e38d3c4945a106287413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20G=C3=B6rler?= Date: Fri, 4 Jul 2025 10:25:36 +0200 Subject: [PATCH 5/8] add index on genres.parent_ID --- srv/src/main/resources/application.yaml | 1 + srv/src/main/resources/indices-h2.sql | 1 + 2 files changed, 2 insertions(+) create mode 100644 srv/src/main/resources/indices-h2.sql diff --git a/srv/src/main/resources/application.yaml b/srv/src/main/resources/application.yaml index 498ed1a1..2096b3cf 100644 --- a/srv/src/main/resources/application.yaml +++ b/srv/src/main/resources/application.yaml @@ -126,6 +126,7 @@ cds: spring: config.activate.on-profile: default sql.init.platform: h2 + sql.init.schema-locations: classpath:schema-h2.sql,classpath:indices-h2.sql cds: data-source: auto-config.enabled: false diff --git a/srv/src/main/resources/indices-h2.sql b/srv/src/main/resources/indices-h2.sql new file mode 100644 index 00000000..4f2dddef --- /dev/null +++ b/srv/src/main/resources/indices-h2.sql @@ -0,0 +1 @@ +CREATE INDEX genres_parent_id ON my_bookshop_Genres(parent_ID); \ No newline at end of file From 8e0f0fae4311ebae3946f36e17a46425038e54fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20G=C3=B6rler?= Date: Fri, 4 Jul 2025 16:55:18 +0200 Subject: [PATCH 6/8] use cds4j 4.1.1 --- srv/pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/srv/pom.xml b/srv/pom.xml index f0ab50e7..3db4de12 100644 --- a/srv/pom.xml +++ b/srv/pom.xml @@ -17,6 +17,13 @@ + + com.sap.cds + cds4j-runtime + 4.1.1 + runtime + + com.sap.cds cds-starter-spring-boot From fe105fa9ccd952817e2d744ff0efbb4120609549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20G=C3=B6rler?= Date: Fri, 4 Jul 2025 17:54:42 +0200 Subject: [PATCH 7/8] 4.1.1 --- pom.xml | 2 +- srv/pom.xml | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index a97e6356..c1c88ad7 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ 21 - 4.1.0 + 4.1.1 5.20.0 3.6.0 3.8.5 diff --git a/srv/pom.xml b/srv/pom.xml index 3db4de12..f0ab50e7 100644 --- a/srv/pom.xml +++ b/srv/pom.xml @@ -17,13 +17,6 @@ - - com.sap.cds - cds4j-runtime - 4.1.1 - runtime - - com.sap.cds cds-starter-spring-boot From 5af0c9ecadab3597de521c4e418e3fe5d3d0eb31 Mon Sep 17 00:00:00 2001 From: Evgeny Andreev Date: Mon, 7 Jul 2025 13:12:21 +0200 Subject: [PATCH 8/8] Add more genres (#509) --- db/data/my.bookshop-Books.csv | 12 +- db/data/my.bookshop-Genres.csv | 304 ++++++++++++++++-- .../java/my/bookshop/GenreHierarchyTest.java | 115 +++---- 3 files changed, 319 insertions(+), 112 deletions(-) diff --git a/db/data/my.bookshop-Books.csv b/db/data/my.bookshop-Books.csv index a081cbc3..a32fdeab 100644 --- a/db/data/my.bookshop-Books.csv +++ b/db/data/my.bookshop-Books.csv @@ -1,6 +1,6 @@ -ID;TITLE;DESCR;AUTHOR_ID;STOCK;PRICE;CURRENCY_CODE;GENRE_ID;RATING;ISBN -f846b0b9-01d4-4f6d-82a4-d79204f62278;Wuthering Heights;"Wuthering Heights, Emily Brontë's only novel, was published in 1847 under the pseudonym ""Ellis Bell"". It was written between October 1845 and June 1846. Wuthering Heights and Anne Brontë's Agnes Grey were accepted by publisher Thomas Newby before the success of their sister Charlotte's novel Jane Eyre. After Emily's death, Charlotte edited the manuscript of Wuthering Heights and arranged for the edited version to be published as a posthumous second edition in 1850.";335c7bcd-b826-4f14-a788-e0bf6738617a;12;11.11;GBP;f283b1b3-b763-42f9-95f0-38e1d78a1d7e;4.5;979-8698267973 -9b084139-0b1e-43b6-b12a-7b3669d75f02;Jane Eyre;"Jane Eyre /ɛər/ (originally published as Jane Eyre: An Autobiography) is a novel by English writer Charlotte Brontë, published under the pen name ""Currer Bell"", on 16 October 1847, by Smith, Elder & Co. of London. The first American edition was published the following year by Harper & Brothers of New York. Primarily a bildungsroman, Jane Eyre follows the experiences of its eponymous heroine, including her growth to adulthood and her love for Mr. Rochester, the brooding master of Thornfield Hall. The novel revolutionised prose fiction in that the focus on Jane's moral and spiritual development is told through an intimate, first-person narrative, where actions and events are coloured by a psychological intensity. The book contains elements of social criticism, with a strong sense of Christian morality at its core and is considered by many to be ahead of its time because of Jane's individualistic character and how the novel approaches the topics of class, sexuality, religion and feminism.";e3da2c2e-72ee-45d5-8def-52964c7b252a;11;12.34;GBP;d74eb118-ff57-4776-96d3-0d649278bf6b;3.0;979-8598716472 -51061ce3-ddde-4d70-a2dc-6314afbcc73e;The Raven;"“The Raven"" is a narrative poem by American writer Edgar Allan Poe. First published in January 1845, the poem is often noted for its musicality, stylized language, and supernatural atmosphere. It tells of a talking raven's mysterious visit to a distraught lover, tracing the man's slow fall into madness. The lover, often identified as being a student, is lamenting the loss of his love, Lenore. Sitting on a bust of Pallas, the raven seems to further distress the protagonist with its constant repetition of the word ""Nevermore"". The poem makes use of folk, mythological, religious, and classical references.";e7643aae-2d2f-4656-bb2d-1328ad3c8045;333;13.13;USD;7125da65-b3ae-4a0b-a735-1db410a3e079;2.5;978-1092909747 -aebdfc8a-0dfa-4468-bd36-48aabd65e663;Eleonora;"""Eleonora"" is a short story by Edgar Allan Poe, first published in 1842 in Philadelphia in the literary annual The Gift. It is often regarded as somewhat autobiographical and has a relatively ""happy"" ending.";e7643aae-2d2f-4656-bb2d-1328ad3c8045;555;14;USD;a530cd31-b0cf-4a32-9f28-72ee7b9f29fc;1.0;979-8669820985 -4a519e61-3c3a-4bd9-ab12-d7e0c5329933;Catweazle;Catweazle is a British fantasy television series, starring Geoffrey Bayldon in the title role, and created by Richard Carpenter for London Weekend Television. The first series, produced and directed by Quentin Lawrence, was screened in the UK on ITV in 1970. The second series, directed by David Reid and David Lane, was shown in 1971. Each series had thirteen episodes, most but not all written by Carpenter, who also published two books based on the scripts.;3c081d9d-abda-4da9-8b6a-4f4555bb26bc;22;15;EUR;5b091c64-8b4f-401a-a06d-61b19857635b;4.0;978-3473523023 +ID;TITLE;DESCR;AUTHOR_ID;STOCK;PRICE;CURRENCY_CODE;GENRE_ID;RATING;ISBN +f846b0b9-01d4-4f6d-82a4-d79204f62278;Wuthering Heights;"Wuthering Heights, Emily Brontë's only novel, was published in 1847 under the pseudonym ""Ellis Bell"". It was written between October 1845 and June 1846. Wuthering Heights and Anne Brontë's Agnes Grey were accepted by publisher Thomas Newby before the success of their sister Charlotte's novel Jane Eyre. After Emily's death, Charlotte edited the manuscript of Wuthering Heights and arranged for the edited version to be published as a posthumous second edition in 1850.";335c7bcd-b826-4f14-a788-e0bf6738617a;12;11.11;GBP;8bbf14c6-b378-4e35-9b4f-05a9c8878161;4.5;979-8698267973 +9b084139-0b1e-43b6-b12a-7b3669d75f02;Jane Eyre;"Jane Eyre /ɛər/ (originally published as Jane Eyre: An Autobiography) is a novel by English writer Charlotte Brontë, published under the pen name ""Currer Bell"", on 16 October 1847, by Smith, Elder & Co. of London. The first American edition was published the following year by Harper & Brothers of New York. Primarily a bildungsroman, Jane Eyre follows the experiences of its eponymous heroine, including her growth to adulthood and her love for Mr. Rochester, the brooding master of Thornfield Hall. The novel revolutionised prose fiction in that the focus on Jane's moral and spiritual development is told through an intimate, first-person narrative, where actions and events are coloured by a psychological intensity. The book contains elements of social criticism, with a strong sense of Christian morality at its core and is considered by many to be ahead of its time because of Jane's individualistic character and how the novel approaches the topics of class, sexuality, religion and feminism.";e3da2c2e-72ee-45d5-8def-52964c7b252a;11;12.34;GBP;8bbf14c6-b378-4e35-9b4f-05a9c8878161;3.0;979-8598716472 +51061ce3-ddde-4d70-a2dc-6314afbcc73e;The Raven;"“The Raven"" is a narrative poem by American writer Edgar Allan Poe. First published in January 1845, the poem is often noted for its musicality, stylized language, and supernatural atmosphere. It tells of a talking raven's mysterious visit to a distraught lover, tracing the man's slow fall into madness. The lover, often identified as being a student, is lamenting the loss of his love, Lenore. Sitting on a bust of Pallas, the raven seems to further distress the protagonist with its constant repetition of the word ""Nevermore"". The poem makes use of folk, mythological, religious, and classical references.";e7643aae-2d2f-4656-bb2d-1328ad3c8045;333;13.13;USD;8bbf14c6-b378-4e35-9b4f-05a9c8878065;2.5;978-1092909747 +aebdfc8a-0dfa-4468-bd36-48aabd65e663;Eleonora;"""Eleonora"" is a short story by Edgar Allan Poe, first published in 1842 in Philadelphia in the literary annual The Gift. It is often regarded as somewhat autobiographical and has a relatively ""happy"" ending.";e7643aae-2d2f-4656-bb2d-1328ad3c8045;555;14;USD;8bbf14c6-b378-4e35-9b4f-05a9c8878086;1.0;979-8669820985 +4a519e61-3c3a-4bd9-ab12-d7e0c5329933;Catweazle;Catweazle is a British fantasy television series, starring Geoffrey Bayldon in the title role, and created by Richard Carpenter for London Weekend Television. The first series, produced and directed by Quentin Lawrence, was screened in the UK on ITV in 1970. The second series, directed by David Reid and David Lane, was shown in 1971. Each series had thirteen episodes, most but not all written by Carpenter, who also published two books based on the scripts.;3c081d9d-abda-4da9-8b6a-4f4555bb26bc;22;15;EUR;8bbf14c6-b378-4e35-9b4f-05a9c8878031;4.0;978-3473523023 diff --git a/db/data/my.bookshop-Genres.csv b/db/data/my.bookshop-Genres.csv index 2bc412b2..5c84fb9d 100644 --- a/db/data/my.bookshop-Genres.csv +++ b/db/data/my.bookshop-Genres.csv @@ -1,34 +1,270 @@ -ID;parent_ID;name;siblingRank -8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;;Fiction;1000 -08467c69-4b69-4b30-bf51-998f9c4b8a12;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Action;1500 -c5247996-2516-40c5-b3ea-02492a1e1f4d;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Adventure;3000 -d74eb118-ff57-4776-96d3-0d649278bf6b;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Drama;4000 -b84a7e92-cc0c-4599-8b62-9e3ae39e343f;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Poetry;5000 -445a6c1e-071f-4e9d-b0bb-670ec73b0a49;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Fantasy;6000 -0d4f268f-c5c5-4a82-b54a-2120271cf54e;445a6c1e-071f-4e9d-b0bb-670ec73b0a49;Epic fantasy;7000 -5ccfe8e7-009f-4744-91fd-c1c1e9a0c9c6;445a6c1e-071f-4e9d-b0bb-670ec73b0a49;High fantasy;8000 -86e9f4d5-3e7c-4c06-8421-8b6d72fe9c93;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Science Fiction;9000 -9f8653a2-6d6d-4fd7-b02f-b90d15d6f67f;86e9f4d5-3e7c-4c06-8421-8b6d72fe9c93;Utopian and Dystopian;10000 -7c7b2c30-c24e-4627-bb84-0f9d09f9e91b;9f8653a2-6d6d-4fd7-b02f-b90d15d6f67f;Dystopia;11000 -34f6a939-2708-4cc0-9882-daf36a8ed5e6;7c7b2c30-c24e-4627-bb84-0f9d09f9e91b;Cyberpunk;12000 -4297bff9-c4b3-4097-b68f-5605f89c6e4c;34f6a939-2708-4cc0-9882-daf36a8ed5e6;Steampunk;13000 -f283b1b3-b763-42f9-95f0-38e1d78a1d7e;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Romance;14000 -5d2c5060-84cf-4a94-9118-8d9ad88f2a24;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Mystery;15000 -7d6cc413-cf8c-4cf9-b30a-bf8cf6f97b72;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Graphic Novel;16000 -f846b0b9-01d4-4f6d-82a4-d79204f62576;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Thriller;17000 -82f9a2d9-bd77-4cfd-9c76-d03b8f6827a3;f846b0b9-01d4-4f6d-82a4-d79204f62576;Suspense;18000 -a7b5b4d7-bff3-430d-9d7e-25fd67b66022;f846b0b9-01d4-4f6d-82a4-d79204f62576;Crime thriller;19000 -5f93c395-6f8a-43de-84c1-bf22cfba8f56;f846b0b9-01d4-4f6d-82a4-d79204f62576;Spy thriller;20000 -3ff51d9c-5ff5-421f-8d0d-d75b08e32a25;f846b0b9-01d4-4f6d-82a4-d79204f62576;Political thriller;21000 -a530cd31-b0cf-4a32-9f28-72ee7b9f29fc;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Short Story;23000 -5b091c64-8b4f-401a-a06d-61b19857635b;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Fairy Tale;24000 -7125da65-b3ae-4a0b-a735-1db410a3e079;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Horror;25000 -a02b5c9b-b79f-43ef-b2ab-28e4b431cc18;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Historical Fiction;26000 -d6c3448e-d771-47f0-b6c7-8d2159b29d2a;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Contemporary Fiction;27000 -7ed5cfab-8c4d-46a3-b89b-c5b8fa74f049;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Magical Realism;28000 -23e86990-66d3-4488-8272-98ed056710b5;8bbf14c6-b378-4e35-9b4f-5a9c8b8762da;Literary Fiction;29000 -85b5a640-7e9a-468e-80e2-e9268486031b;;Non-Fiction;30000 -10d19b1a-832b-4d60-bf9b-88dcd089db85;85b5a640-7e9a-468e-80e2-e9268486031b;Biography;31000 -1f1c8b5b-451e-48f6-bdbb-759be4ea1a8f;10d19b1a-832b-4d60-bf9b-88dcd089db85;Autobiography;32000 -4bc5ad4d-b7a3-47a7-9938-325c6fdf8041;85b5a640-7e9a-468e-80e2-e9268486031b;Essay;33000 -e0d350c2-1f42-45b5-b768-67cccd997b56;85b5a640-7e9a-468e-80e2-e9268486031b;Speech;34000 \ No newline at end of file +ID;NAME;PARENT_ID;siblingRank +8bbf14c6-b378-4e35-9b4f-05a9c8878001;Fiction;;1000 +8bbf14c6-b378-4e35-9b4f-05a9c8878002;Non-Fiction;;1010 +8bbf14c6-b378-4e35-9b4f-05a9c8878003;Action & Adventure;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1020 +8bbf14c6-b378-4e35-9b4f-05a9c8878004;Alternate History;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1030 +8bbf14c6-b378-4e35-9b4f-05a9c8878005;Anthology;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1040 +8bbf14c6-b378-4e35-9b4f-05a9c8878006;Art;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1050 +8bbf14c6-b378-4e35-9b4f-05a9c8878007;Autobiography;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1060 +8bbf14c6-b378-4e35-9b4f-05a9c8878008;Biography;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1070 +8bbf14c6-b378-4e35-9b4f-05a9c8878009;Business;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1080 +8bbf14c6-b378-4e35-9b4f-05a9c8878010;Chick Lit;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1090 +8bbf14c6-b378-4e35-9b4f-05a9c8878011;Children's;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1100 +8bbf14c6-b378-4e35-9b4f-05a9c8878012;Christian;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1110 +8bbf14c6-b378-4e35-9b4f-05a9c8878013;Classic;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1120 +8bbf14c6-b378-4e35-9b4f-05a9c8878014;Comic Book;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1130 +8bbf14c6-b378-4e35-9b4f-05a9c8878015;Coming-of-Age;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1140 +8bbf14c6-b378-4e35-9b4f-05a9c8878016;Contemporary;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1150 +8bbf14c6-b378-4e35-9b4f-05a9c8878017;Cookbook;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1160 +8bbf14c6-b378-4e35-9b4f-05a9c8878018;Crime;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1170 +8bbf14c6-b378-4e35-9b4f-05a9c8878019;Cyberpunk;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1180 +8bbf14c6-b378-4e35-9b4f-05a9c8878020;Dark Fantasy;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1190 +8bbf14c6-b378-4e35-9b4f-05a9c8878021;Detective;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1200 +8bbf14c6-b378-4e35-9b4f-05a9c8878022;Diary;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1210 +8bbf14c6-b378-4e35-9b4f-05a9c8878023;Dystopian;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1220 +8bbf14c6-b378-4e35-9b4f-05a9c8878024;Economics;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1230 +8bbf14c6-b378-4e35-9b4f-05a9c8878025;Education;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1240 +8bbf14c6-b378-4e35-9b4f-05a9c8878026;Epic;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1250 +8bbf14c6-b378-4e35-9b4f-05a9c8878027;Erotica;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1260 +8bbf14c6-b378-4e35-9b4f-05a9c8878028;Essay;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1270 +8bbf14c6-b378-4e35-9b4f-05a9c8878029;Fairy Tale;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1280 +8bbf14c6-b378-4e35-9b4f-05a9c8878030;Family Saga;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1290 +8bbf14c6-b378-4e35-9b4f-05a9c8878031;Fantasy;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1300 +8bbf14c6-b378-4e35-9b4f-05a9c8878032;Feminist;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1310 +8bbf14c6-b378-4e35-9b4f-05a9c8878034;Folklore;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1320 +8bbf14c6-b378-4e35-9b4f-05a9c8878035;Food & Drink;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1330 +8bbf14c6-b378-4e35-9b4f-05a9c8878036;Forensic;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1340 +8bbf14c6-b378-4e35-9b4f-05a9c8878038;Gothic;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1360 +8bbf14c6-b378-4e35-9b4f-05a9c8878039;Graphic Novel;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1370 +8bbf14c6-b378-4e35-9b4f-05a9c8878040;Hard Science Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1380 +8bbf14c6-b378-4e35-9b4f-05a9c8878041;Health;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1390 +8bbf14c6-b378-4e35-9b4f-05a9c8878042;Historical;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1400 +8bbf14c6-b378-4e35-9b4f-05a9c8878043;Historical Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1410 +8bbf14c6-b378-4e35-9b4f-05a9c8878044;History;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1420 +8bbf14c6-b378-4e35-9b4f-05a9c8878045;Holiday;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1430 +8bbf14c6-b378-4e35-9b4f-05a9c8878046;Horror;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1440 +8bbf14c6-b378-4e35-9b4f-05a9c8878047;Humor;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1450 +8bbf14c6-b378-4e35-9b4f-05a9c8878048;Inspirational;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1460 +8bbf14c6-b378-4e35-9b4f-05a9c8878049;Journal;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1470 +8bbf14c6-b378-4e35-9b4f-05a9c8878050;Legal Thriller;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1480 +8bbf14c6-b378-4e35-9b4f-05a9c8878052;Light Novel;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1490 +8bbf14c6-b378-4e35-9b4f-05a9c8878053;Literary Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1500 +8bbf14c6-b378-4e35-9b4f-05a9c8878054;Magic Realism;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1510 +8bbf14c6-b378-4e35-9b4f-05a9c8878055;Manga;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1520 +8bbf14c6-b378-4e35-9b4f-05a9c8878056;Martial Arts;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1530 +8bbf14c6-b378-4e35-9b4f-05a9c8878057;Mathematics;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1540 +8bbf14c6-b378-4e35-9b4f-05a9c8878058;Medical;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1550 +8bbf14c6-b378-4e35-9b4f-05a9c8878059;Memoir;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1560 +8bbf14c6-b378-4e35-9b4f-05a9c8878060;Metaphysical;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1570 +8bbf14c6-b378-4e35-9b4f-05a9c8878061;Military;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1580 +8bbf14c6-b378-4e35-9b4f-05a9c8878062;Modern Classic;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1590 +8bbf14c6-b378-4e35-9b4f-05a9c8878063;Monograph;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1600 +8bbf14c6-b378-4e35-9b4f-05a9c8878064;Music;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1610 +8bbf14c6-b378-4e35-9b4f-05a9c8878065;Mystery;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1620 +8bbf14c6-b378-4e35-9b4f-05a9c8878066;Mythology;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1630 +8bbf14c6-b378-4e35-9b4f-05a9c8878067;Narrative Nonfiction;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1640 +8bbf14c6-b378-4e35-9b4f-05a9c8878068;Nature;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1650 +8bbf14c6-b378-4e35-9b4f-05a9c8878069;New Adult;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1660 +8bbf14c6-b378-4e35-9b4f-05a9c8878070;Noir;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1670 +8bbf14c6-b378-4e35-9b4f-05a9c8878071;Occult;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1680 +8bbf14c6-b378-4e35-9b4f-05a9c8878072;Paranormal;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1690 +8bbf14c6-b378-4e35-9b4f-05a9c8878073;Parenting;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1700 +8bbf14c6-b378-4e35-9b4f-05a9c8878074;Philosophy;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1710 +8bbf14c6-b378-4e35-9b4f-05a9c8878075;Picture Book;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1720 +8bbf14c6-b378-4e35-9b4f-05a9c8878076;Play;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1730 +8bbf14c6-b378-4e35-9b4f-05a9c8878077;Poetry;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1740 +8bbf14c6-b378-4e35-9b4f-05a9c8878078;Political;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1750 +8bbf14c6-b378-4e35-9b4f-05a9c8878079;Post-Apocalyptic;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1760 +8bbf14c6-b378-4e35-9b4f-05a9c8878080;Prayer;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1770 +8bbf14c6-b378-4e35-9b4f-05a9c8878081;Psychological Thriller;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1780 +8bbf14c6-b378-4e35-9b4f-05a9c8878082;Reference;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1790 +8bbf14c6-b378-4e35-9b4f-05a9c8878083;Regency;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1800 +8bbf14c6-b378-4e35-9b4f-05a9c8878084;Religion;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1810 +8bbf14c6-b378-4e35-9b4f-05a9c8878085;Religious Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1820 +8bbf14c6-b378-4e35-9b4f-05a9c8878086;Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1830 +8bbf14c6-b378-4e35-9b4f-05a9c8878087;Romantic Comedy;8bbf14c6-b378-4e35-9b4f-05a9c8878086;1840 +8bbf14c6-b378-4e35-9b4f-05a9c8878088;Romantic Suspense;8bbf14c6-b378-4e35-9b4f-05a9c8878086;1850 +8bbf14c6-b378-4e35-9b4f-05a9c8878089;Saga;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1860 +8bbf14c6-b378-4e35-9b4f-05a9c8878090;Satire;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1870 +8bbf14c6-b378-4e35-9b4f-05a9c8878091;Science;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1880 +8bbf14c6-b378-4e35-9b4f-05a9c8878092;Science Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1890 +8bbf14c6-b378-4e35-9b4f-05a9c8878093;Self-Help;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1900 +8bbf14c6-b378-4e35-9b4f-05a9c8878094;Short Story;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1910 +8bbf14c6-b378-4e35-9b4f-05a9c8878095;Slice of Life;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1920 +8bbf14c6-b378-4e35-9b4f-05a9c8878096;Social Science;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1930 +8bbf14c6-b378-4e35-9b4f-05a9c8878097;Society;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1940 +8bbf14c6-b378-4e35-9b4f-05a9c8878098;Soft Science Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878092;1950 +8bbf14c6-b378-4e35-9b4f-05a9c8878099;Space Opera;8bbf14c6-b378-4e35-9b4f-05a9c8878092;1960 +8bbf14c6-b378-4e35-9b4f-05a9c8878100;Spirituality;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1970 +8bbf14c6-b378-4e35-9b4f-05a9c8878101;Sports;8bbf14c6-b378-4e35-9b4f-05a9c8878002;1980 +8bbf14c6-b378-4e35-9b4f-05a9c8878102;Spy;8bbf14c6-b378-4e35-9b4f-05a9c8878001;1990 +8bbf14c6-b378-4e35-9b4f-05a9c8878103;Steampunk;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2000 +8bbf14c6-b378-4e35-9b4f-05a9c8878104;Superhero;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2010 +8bbf14c6-b378-4e35-9b4f-05a9c8878105;Supernatural;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2020 +8bbf14c6-b378-4e35-9b4f-05a9c8878106;Suspense;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2030 +8bbf14c6-b378-4e35-9b4f-05a9c8878107;Techno-thriller;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2040 +8bbf14c6-b378-4e35-9b4f-05a9c8878108;Teen;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2050 +8bbf14c6-b378-4e35-9b4f-05a9c8878109;Thriller;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2060 +8bbf14c6-b378-4e35-9b4f-05a9c8878110;Time Travel;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2070 +8bbf14c6-b378-4e35-9b4f-05a9c8878111;Travel;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2080 +8bbf14c6-b378-4e35-9b4f-05a9c8878112;True Crime;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2090 +8bbf14c6-b378-4e35-9b4f-05a9c8878113;Urban;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2100 +8bbf14c6-b378-4e35-9b4f-05a9c8878114;Urban Fantasy;8bbf14c6-b378-4e35-9b4f-05a9c8878031;2110 +8bbf14c6-b378-4e35-9b4f-05a9c8878115;Utopian;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2120 +8bbf14c6-b378-4e35-9b4f-05a9c8878116;Vampire;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2130 +8bbf14c6-b378-4e35-9b4f-05a9c8878117;War;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2140 +8bbf14c6-b378-4e35-9b4f-05a9c8878118;Western;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2150 +8bbf14c6-b378-4e35-9b4f-05a9c8878119;Women's Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2160 +8bbf14c6-b378-4e35-9b4f-05a9c8878120;Young Adult;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2170 +8bbf14c6-b378-4e35-9b4f-05a9c8878121;Adventure;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2180 +8bbf14c6-b378-4e35-9b4f-05a9c8878122;African American;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2190 +8bbf14c6-b378-4e35-9b4f-05a9c8878123;Alien Invasion;8bbf14c6-b378-4e35-9b4f-05a9c8878092;2200 +8bbf14c6-b378-4e35-9b4f-05a9c8878124;Alternate Universe;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2210 +8bbf14c6-b378-4e35-9b4f-05a9c8878125;Animal;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2220 +8bbf14c6-b378-4e35-9b4f-05a9c8878126;Anthropology;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2230 +8bbf14c6-b378-4e35-9b4f-05a9c8878127;Apocalyptic;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2240 +8bbf14c6-b378-4e35-9b4f-05a9c8878128;Archaeology;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2250 +8bbf14c6-b378-4e35-9b4f-05a9c8878129;Art History;8bbf14c6-b378-4e35-9b4f-05a9c8878006;2260 +8bbf14c6-b378-4e35-9b4f-05a9c8878130;Asian Literature;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2270 +8bbf14c6-b378-4e35-9b4f-05a9c8878131;Astronomy;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2280 +8bbf14c6-b378-4e35-9b4f-05a9c8878132;Aviation;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2290 +8bbf14c6-b378-4e35-9b4f-05a9c8878133;Beach Read;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2300 +8bbf14c6-b378-4e35-9b4f-05a9c8878134;Biblical;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2310 +8bbf14c6-b378-4e35-9b4f-05a9c8878135;Board Book;8bbf14c6-b378-4e35-9b4f-05a9c8878011;2320 +8bbf14c6-b378-4e35-9b4f-05a9c8878136;Body;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2330 +8bbf14c6-b378-4e35-9b4f-05a9c8878137;Campus;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2340 +8bbf14c6-b378-4e35-9b4f-05a9c8878138;Canadian Literature;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2350 +8bbf14c6-b378-4e35-9b4f-05a9c8878139;Cartoon;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2360 +8bbf14c6-b378-4e35-9b4f-05a9c8878140;Celebrity;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2370 +8bbf14c6-b378-4e35-9b4f-05a9c8878141;Chick Noir;8bbf14c6-b378-4e35-9b4f-05a9c8878010;2380 +8bbf14c6-b378-4e35-9b4f-05a9c8878142;Christian Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2390 +8bbf14c6-b378-4e35-9b4f-05a9c8878143;Christian Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;2400 +8bbf14c6-b378-4e35-9b4f-05a9c8878144;Classic Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;2410 +8bbf14c6-b378-4e35-9b4f-05a9c8878145;Climate Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878092;2420 +8bbf14c6-b378-4e35-9b4f-05a9c8878146;Comedy;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2430 +8bbf14c6-b378-4e35-9b4f-05a9c8878148;Conspiracy;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2450 +8bbf14c6-b378-4e35-9b4f-05a9c8878149;Contemporary Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;2460 +8bbf14c6-b378-4e35-9b4f-05a9c8878150;Cooking Memoir;8bbf14c6-b378-4e35-9b4f-05a9c8878059;2470 +8bbf14c6-b378-4e35-9b4f-05a9c8878151;Cozy Mystery;8bbf14c6-b378-4e35-9b4f-05a9c8878065;2480 +8bbf14c6-b378-4e35-9b4f-05a9c8878152;Crafts & Hobbies;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2490 +8bbf14c6-b378-4e35-9b4f-05a9c8878153;Crime Thriller;8bbf14c6-b378-4e35-9b4f-05a9c8878109;2500 +8bbf14c6-b378-4e35-9b4f-05a9c8878154;Cultural;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2510 +8bbf14c6-b378-4e35-9b4f-05a9c8878155;Cyber Thriller;8bbf14c6-b378-4e35-9b4f-05a9c8878109;2520 +8bbf14c6-b378-4e35-9b4f-05a9c8878156;Dark Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;2530 +8bbf14c6-b378-4e35-9b4f-05a9c8878157;Detective Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878021;2540 +8bbf14c6-b378-4e35-9b4f-05a9c8878158;Disaster;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2550 +8bbf14c6-b378-4e35-9b4f-05a9c8878159;Divorce;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2560 +8bbf14c6-b378-4e35-9b4f-05a9c8878160;Domestic Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2570 +8bbf14c6-b378-4e35-9b4f-05a9c8878161;Drama;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2580 +8bbf14c6-b378-4e35-9b4f-05a9c8878162;Eastern Philosophy;8bbf14c6-b378-4e35-9b4f-05a9c8878074;2590 +8bbf14c6-b378-4e35-9b4f-05a9c8878163;Ecology;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2600 +8bbf14c6-b378-4e35-9b4f-05a9c8878164;Epic Fantasy;8bbf14c6-b378-4e35-9b4f-05a9c8878031;2610 +8bbf14c6-b378-4e35-9b4f-05a9c8878165;Espionage;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2620 +8bbf14c6-b378-4e35-9b4f-05a9c8878166;Experimental;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2630 +8bbf14c6-b378-4e35-9b4f-05a9c8878167;Family Drama;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2640 +8bbf14c6-b378-4e35-9b4f-05a9c8878168;Fantasy Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;2650 +8bbf14c6-b378-4e35-9b4f-05a9c8878169;Feminist Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878032;2660 +8bbf14c6-b378-4e35-9b4f-05a9c8878170;Fictional Biography;8bbf14c6-b378-4e35-9b4f-05a9c8878008;2670 +8bbf14c6-b378-4e35-9b4f-05a9c8878171;Folklore Retelling;8bbf14c6-b378-4e35-9b4f-05a9c8878034;2680 +8bbf14c6-b378-4e35-9b4f-05a9c8878172;Foreign Language;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2690 +8bbf14c6-b378-4e35-9b4f-05a9c8878173;Friendship;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2700 +8bbf14c6-b378-4e35-9b4f-05a9c8878174;Gastronomy;8bbf14c6-b378-4e35-9b4f-05a9c8878035;2710 +8bbf14c6-b378-4e35-9b4f-05a9c8878175;Gender Studies;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2720 +8bbf14c6-b378-4e35-9b4f-05a9c8878176;Ghost Story;8bbf14c6-b378-4e35-9b4f-05a9c8878046;2730 +8bbf14c6-b378-4e35-9b4f-05a9c8878177;Gothic Horror;8bbf14c6-b378-4e35-9b4f-05a9c8878038;2740 +8bbf14c6-b378-4e35-9b4f-05a9c8878178;Graphic Memoir;8bbf14c6-b378-4e35-9b4f-05a9c8878059;2750 +8bbf14c6-b378-4e35-9b4f-05a9c8878179;Greek Mythology;8bbf14c6-b378-4e35-9b4f-05a9c8878066;2760 +8bbf14c6-b378-4e35-9b4f-05a9c8878180;Hard Boiled;8bbf14c6-b378-4e35-9b4f-05a9c8878065;2770 +8bbf14c6-b378-4e35-9b4f-05a9c8878181;Haunted House;8bbf14c6-b378-4e35-9b4f-05a9c8878046;2780 +8bbf14c6-b378-4e35-9b4f-05a9c8878182;Heroic Fantasy;8bbf14c6-b378-4e35-9b4f-05a9c8878031;2790 +8bbf14c6-b378-4e35-9b4f-05a9c8878183;Historical Mystery;8bbf14c6-b378-4e35-9b4f-05a9c8878065;2800 +8bbf14c6-b378-4e35-9b4f-05a9c8878184;Historical Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;2810 +8bbf14c6-b378-4e35-9b4f-05a9c8878185;Holiday Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;2820 +8bbf14c6-b378-4e35-9b4f-05a9c8878186;Horror Comedy;8bbf14c6-b378-4e35-9b4f-05a9c8878046;2830 +8bbf14c6-b378-4e35-9b4f-05a9c8878187;Humorous Mystery;8bbf14c6-b378-4e35-9b4f-05a9c8878065;2840 +8bbf14c6-b378-4e35-9b4f-05a9c8878188;Inspirational Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;2850 +8bbf14c6-b378-4e35-9b4f-05a9c8878189;International;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2860 +8bbf14c6-b378-4e35-9b4f-05a9c8878190;Islamic Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2870 +8bbf14c6-b378-4e35-9b4f-05a9c8878191;Jewish Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2880 +8bbf14c6-b378-4e35-9b4f-05a9c8878192;Juvenile;8bbf14c6-b378-4e35-9b4f-05a9c8878011;2890 +8bbf14c6-b378-4e35-9b4f-05a9c8878193;Legal Drama;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2900 +8bbf14c6-b378-4e35-9b4f-05a9c8878195;Literary Criticism;8bbf14c6-b378-4e35-9b4f-05a9c8878002;2920 +8bbf14c6-b378-4e35-9b4f-05a9c8878196;Literary Mystery;8bbf14c6-b378-4e35-9b4f-05a9c8878065;2930 +8bbf14c6-b378-4e35-9b4f-05a9c8878197;Magical Girl;8bbf14c6-b378-4e35-9b4f-05a9c8878031;2940 +8bbf14c6-b378-4e35-9b4f-05a9c8878198;Magical Realism;8bbf14c6-b378-4e35-9b4f-05a9c8878054;2950 +8bbf14c6-b378-4e35-9b4f-05a9c8878199;Martial Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2960 +8bbf14c6-b378-4e35-9b4f-05a9c8878200;Medical Thriller;8bbf14c6-b378-4e35-9b4f-05a9c8878109;2970 +8bbf14c6-b378-4e35-9b4f-05a9c8878201;Men's Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;2980 +8bbf14c6-b378-4e35-9b4f-05a9c8878202;Middle Grade;8bbf14c6-b378-4e35-9b4f-05a9c8878011;2990 +8bbf14c6-b378-4e35-9b4f-05a9c8878203;Military Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878061;3000 +8bbf14c6-b378-4e35-9b4f-05a9c8878204;Mind & Body;8bbf14c6-b378-4e35-9b4f-05a9c8878002;3010 +8bbf14c6-b378-4e35-9b4f-05a9c8878205;Modern Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;3020 +8bbf14c6-b378-4e35-9b4f-05a9c8878206;Monster;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3030 +8bbf14c6-b378-4e35-9b4f-05a9c8878207;Music Biography;8bbf14c6-b378-4e35-9b4f-05a9c8878008;3040 +8bbf14c6-b378-4e35-9b4f-05a9c8878208;Musical;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3050 +8bbf14c6-b378-4e35-9b4f-05a9c8878209;Mythopoeia;8bbf14c6-b378-4e35-9b4f-05a9c8878066;3060 +8bbf14c6-b378-4e35-9b4f-05a9c8878210;Native American;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3070 +8bbf14c6-b378-4e35-9b4f-05a9c8878211;Nature Writing;8bbf14c6-b378-4e35-9b4f-05a9c8878068;3080 +8bbf14c6-b378-4e35-9b4f-05a9c8878212;New Weird;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3090 +8bbf14c6-b378-4e35-9b4f-05a9c8878213;Norse Mythology;8bbf14c6-b378-4e35-9b4f-05a9c8878066;3100 +8bbf14c6-b378-4e35-9b4f-05a9c8878214;Novella;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3110 +8bbf14c6-b378-4e35-9b4f-05a9c8878215;Occult Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878071;3120 +8bbf14c6-b378-4e35-9b4f-05a9c8878216;Paranormal Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;3130 +8bbf14c6-b378-4e35-9b4f-05a9c8878217;Parenting Memoir;8bbf14c6-b378-4e35-9b4f-05a9c8878059;3140 +8bbf14c6-b378-4e35-9b4f-05a9c8878218;Personal Development;8bbf14c6-b378-4e35-9b4f-05a9c8878002;3150 +8bbf14c6-b378-4e35-9b4f-05a9c8878219;Philosophical Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878074;3160 +8bbf14c6-b378-4e35-9b4f-05a9c8878220;Picture Book Biography;8bbf14c6-b378-4e35-9b4f-05a9c8878008;3170 +8bbf14c6-b378-4e35-9b4f-05a9c8878221;Pirate;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3180 +8bbf14c6-b378-4e35-9b4f-05a9c8878222;Plant & Garden;8bbf14c6-b378-4e35-9b4f-05a9c8878002;3190 +8bbf14c6-b378-4e35-9b4f-05a9c8878223;Police Procedural;8bbf14c6-b378-4e35-9b4f-05a9c8878065;3200 +8bbf14c6-b378-4e35-9b4f-05a9c8878224;Political Thriller;8bbf14c6-b378-4e35-9b4f-05a9c8878109;3210 +8bbf14c6-b378-4e35-9b4f-05a9c8878225;Pop Culture;8bbf14c6-b378-4e35-9b4f-05a9c8878002;3220 +8bbf14c6-b378-4e35-9b4f-05a9c8878226;Postmodern;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3230 +8bbf14c6-b378-4e35-9b4f-05a9c8878227;Prehistoric;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3240 +8bbf14c6-b378-4e35-9b4f-05a9c8878228;Prison;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3250 +8bbf14c6-b378-4e35-9b4f-05a9c8878229;Psychological Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3260 +8bbf14c6-b378-4e35-9b4f-05a9c8878231;Quest;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3280 +8bbf14c6-b378-4e35-9b4f-05a9c8878232;Realistic Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3290 +8bbf14c6-b378-4e35-9b4f-05a9c8878233;Religious Mystery;8bbf14c6-b378-4e35-9b4f-05a9c8878065;3300 +8bbf14c6-b378-4e35-9b4f-05a9c8878234;Retelling;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3310 +8bbf14c6-b378-4e35-9b4f-05a9c8878235;Road Trip;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3320 +8bbf14c6-b378-4e35-9b4f-05a9c8878236;Romantic Fantasy;8bbf14c6-b378-4e35-9b4f-05a9c8878086;3330 +8bbf14c6-b378-4e35-9b4f-05a9c8878237;Romantic Thriller;8bbf14c6-b378-4e35-9b4f-05a9c8878109;3340 +8bbf14c6-b378-4e35-9b4f-05a9c8878238;Royalty;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3350 +8bbf14c6-b378-4e35-9b4f-05a9c8878239;Satirical Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878090;3360 +8bbf14c6-b378-4e35-9b4f-05a9c8878240;School Story;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3370 +8bbf14c6-b378-4e35-9b4f-05a9c8878241;Science Fantasy;8bbf14c6-b378-4e35-9b4f-05a9c8878031;3380 +8bbf14c6-b378-4e35-9b4f-05a9c8878242;Sea Story;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3390 +8bbf14c6-b378-4e35-9b4f-05a9c8878243;Self-Improvement;8bbf14c6-b378-4e35-9b4f-05a9c8878093;3400 +8bbf14c6-b378-4e35-9b4f-05a9c8878244;Serial Killer;8bbf14c6-b378-4e35-9b4f-05a9c8878065;3410 +8bbf14c6-b378-4e35-9b4f-05a9c8878245;Shapeshifter;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3420 +8bbf14c6-b378-4e35-9b4f-05a9c8878246;Short Nonfiction;8bbf14c6-b378-4e35-9b4f-05a9c8878002;3430 +8bbf14c6-b378-4e35-9b4f-05a9c8878247;Sibling Story;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3440 +8bbf14c6-b378-4e35-9b4f-05a9c8878248;Slice of Life Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;3450 +8bbf14c6-b378-4e35-9b4f-05a9c8878249;Small Town;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3460 +8bbf14c6-b378-4e35-9b4f-05a9c8878250;Soccer;8bbf14c6-b378-4e35-9b4f-05a9c8878101;3470 +8bbf14c6-b378-4e35-9b4f-05a9c8878251;Space Exploration;8bbf14c6-b378-4e35-9b4f-05a9c8878092;3480 +8bbf14c6-b378-4e35-9b4f-05a9c8878252;Speculative Fiction;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3490 +8bbf14c6-b378-4e35-9b4f-05a9c8878253;Sports Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;3500 +8bbf14c6-b378-4e35-9b4f-05a9c8878254;Spy Thriller;8bbf14c6-b378-4e35-9b4f-05a9c8878109;3510 +8bbf14c6-b378-4e35-9b4f-05a9c8878255;Steamy Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;3520 +8bbf14c6-b378-4e35-9b4f-05a9c8878256;Supernatural Thriller;8bbf14c6-b378-4e35-9b4f-05a9c8878109;3530 +8bbf14c6-b378-4e35-9b4f-05a9c8878257;Survival;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3540 +8bbf14c6-b378-4e35-9b4f-05a9c8878258;Sword & Sorcery;8bbf14c6-b378-4e35-9b4f-05a9c8878031;3550 +8bbf14c6-b378-4e35-9b4f-05a9c8878259;Tech;8bbf14c6-b378-4e35-9b4f-05a9c8878002;3560 +8bbf14c6-b378-4e35-9b4f-05a9c8878260;Teen Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;3570 +8bbf14c6-b378-4e35-9b4f-05a9c8878261;Time Slip;8bbf14c6-b378-4e35-9b4f-05a9c8878110;3580 +8bbf14c6-b378-4e35-9b4f-05a9c8878263;Travel Memoir;8bbf14c6-b378-4e35-9b4f-05a9c8878059;3600 +8bbf14c6-b378-4e35-9b4f-05a9c8878264;True Adventure;8bbf14c6-b378-4e35-9b4f-05a9c8878121;3610 +8bbf14c6-b378-4e35-9b4f-05a9c8878265;Urban Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;3620 +8bbf14c6-b378-4e35-9b4f-05a9c8878266;Vampire Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878116;3630 +8bbf14c6-b378-4e35-9b4f-05a9c8878267;Victorian;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3640 +8bbf14c6-b378-4e35-9b4f-05a9c8878268;Virtual Reality;8bbf14c6-b378-4e35-9b4f-05a9c8878092;3650 +8bbf14c6-b378-4e35-9b4f-05a9c8878269;Visual Arts;8bbf14c6-b378-4e35-9b4f-05a9c8878006;3660 +8bbf14c6-b378-4e35-9b4f-05a9c8878270;War Memoir;8bbf14c6-b378-4e35-9b4f-05a9c8878059;3670 +8bbf14c6-b378-4e35-9b4f-05a9c8878271;Werewolf;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3680 +8bbf14c6-b378-4e35-9b4f-05a9c8878272;Western Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;3690 +8bbf14c6-b378-4e35-9b4f-05a9c8878273;Women's History;8bbf14c6-b378-4e35-9b4f-05a9c8878119;3700 +8bbf14c6-b378-4e35-9b4f-05a9c8878274;Workplace Romance;8bbf14c6-b378-4e35-9b4f-05a9c8878086;3710 +8bbf14c6-b378-4e35-9b4f-05a9c8878275;World War II;8bbf14c6-b378-4e35-9b4f-05a9c8878117;3720 +8bbf14c6-b378-4e35-9b4f-05a9c8878277;Zombie;8bbf14c6-b378-4e35-9b4f-05a9c8878001;3730 diff --git a/srv/src/test/java/my/bookshop/GenreHierarchyTest.java b/srv/src/test/java/my/bookshop/GenreHierarchyTest.java index 54a61e71..33a107d7 100644 --- a/srv/src/test/java/my/bookshop/GenreHierarchyTest.java +++ b/srv/src/test/java/my/bookshop/GenreHierarchyTest.java @@ -10,11 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.core.env.Environment; -import org.springframework.core.env.Profiles; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.ResultActions; import org.springframework.web.util.UriComponentsBuilder; @SpringBootTest @@ -24,9 +21,6 @@ public class GenreHierarchyTest { @Autowired private MockMvc client; - @Autowired - Environment env; - private static final String genresURI = "/api/browse/GenreHierarchy"; @Test @@ -40,7 +34,7 @@ void testGetAll() throws Exception { void testCountAll() throws Exception { client.perform(get(genresURI + "/$count")) .andExpect(status().isOk()) - .andExpect(jsonPath("$").value(33)); + .andExpect(jsonPath("$").value(269)); } @Test @@ -52,11 +46,11 @@ void testStartOneLevel() throws Exception { + "com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/GenreHierarchy,HierarchyQualifier='GenreHierarchy',NodeProperty='ID',Levels=1)" + "&$count=true")) .andExpect(status().isOk()) - .andExpect(jsonPath("$.value[0].ID").value("8bbf14c6-b378-4e35-9b4f-5a9c8b8762da")) + .andExpect(jsonPath("$.value[0].ID").value("8bbf14c6-b378-4e35-9b4f-05a9c8878001")) .andExpect(jsonPath("$.value[0].name").value("Fiction")) .andExpect(jsonPath("$.value[0].DistanceFromRoot").value(0)) .andExpect(jsonPath("$.value[0].DrillState").value("collapsed")) - .andExpect(jsonPath("$.value[1].ID").value("85b5a640-7e9a-468e-80e2-e9268486031b")) + .andExpect(jsonPath("$.value[1].ID").value("8bbf14c6-b378-4e35-9b4f-05a9c8878002")) .andExpect(jsonPath("$.value[1].name").value("Non-Fiction")) .andExpect(jsonPath("$.value[1].DistanceFromRoot").value(0)) .andExpect(jsonPath("$.value[1].DrillState").value("collapsed")) @@ -75,13 +69,13 @@ void testStartTwoLevels() throws Exception { .andExpect(jsonPath("$.value[0].name").value("Fiction")) .andExpect(jsonPath("$.value[0].DrillState").value("expanded")) .andExpect(jsonPath("$.value[0].DistanceFromRoot").value(0)) - .andExpect(jsonPath("$.value[1].name").value("Action")) + .andExpect(jsonPath("$.value[1].name").value("Action & Adventure")) .andExpect(jsonPath("$.value[1].DrillState").value("leaf")) .andExpect(jsonPath("$.value[1].DistanceFromRoot").value(1)) - .andExpect(jsonPath("$.value[21].name").value("Speech")) - .andExpect(jsonPath("$.value[21].DrillState").value("leaf")) - .andExpect(jsonPath("$.value[21].DistanceFromRoot").value(1)) - .andExpect(jsonPath("$.value[22]").doesNotExist()); + .andExpect(jsonPath("$.value[182].name").value("True Crime")) + .andExpect(jsonPath("$.value[182].DrillState").value("leaf")) + .andExpect(jsonPath("$.value[182].DistanceFromRoot").value(1)) + .andExpect(jsonPath("$.value[183]").doesNotExist()); } @Test @@ -89,16 +83,12 @@ void testStartTwoLevels() throws Exception { void testExpandNonFiction() throws Exception { client.perform(get(genresURI + "?$select=DrillState,ID,name" - + "&$apply=descendants($root/GenreHierarchy,GenreHierarchy,ID,filter(ID eq 85b5a640-7e9a-468e-80e2-e9268486031b),1)" + + "&$apply=descendants($root/GenreHierarchy,GenreHierarchy,ID,filter(ID eq 8bbf14c6-b378-4e35-9b4f-05a9c8878021),1)" + "/orderby(ID)")) .andExpect(status().isOk()) - .andExpect(jsonPath("$.value[0].name").value("Biography")) - .andExpect(jsonPath("$.value[0].DrillState").value("collapsed")) - .andExpect(jsonPath("$.value[1].name").value("Essay")) - .andExpect(jsonPath("$.value[1].DrillState").value("leaf")) - .andExpect(jsonPath("$.value[2].name").value("Speech")) - .andExpect(jsonPath("$.value[2].DrillState").value("leaf")) - .andExpect(jsonPath("$.value[3]").doesNotExist()); + .andExpect(jsonPath("$.value[0].name").value("Detective Fiction")) + .andExpect(jsonPath("$.value[0].DrillState").value("leaf")) + .andExpect(jsonPath("$.value[1]").doesNotExist()); } @Test @@ -118,31 +108,28 @@ void testCollapseAll() throws Exception { @Test @WithMockUser(username = "admin") - void testExpandAll() throws Exception { + void testExpandAllTop100() throws Exception { String url = genresURI + "?$select=DistanceFromRoot,DrillState,ID,LimitedDescendantCount,name" + "&$apply=orderby(name)/com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/GenreHierarchy,HierarchyQualifier='GenreHierarchy',NodeProperty='ID')" - + "&$count=true&$skip=0&$top=238"; + + "&$count=true&$skip=0&$top=100"; - ResultActions expectations = client.perform(get(url)) + client.perform(get(url)) .andExpect(status().isOk()) .andExpect(jsonPath("$.value[0].name").value("Fiction")) .andExpect(jsonPath("$.value[0].DrillState").value("expanded")) .andExpect(jsonPath("$.value[0].DistanceFromRoot").value(0)) - .andExpect(jsonPath("$.value[32].name").value("Speech")) - .andExpect(jsonPath("$.value[32].DrillState").value("leaf")) - .andExpect(jsonPath("$.value[33]").doesNotExist()); - if (isOnHana()) { - expectations.andExpect(jsonPath("$.value[0].LimitedDescendantCount").value(24)); - } + .andExpect(jsonPath("$.value[99].name").value("New Weird")) + .andExpect(jsonPath("$.value[99].DrillState").value("leaf")) + .andExpect(jsonPath("$.value[100]").doesNotExist()); } @Test @WithMockUser(username = "admin") void testSearch() throws Exception { - ResultActions expectations = client.perform(get(genresURI + client.perform(get(genresURI + "?$select=DistanceFromRoot,DrillState,ID,LimitedDescendantCount,name" - + "&$apply=ancestors($root/GenreHierarchy,GenreHierarchy,ID,search(\"ry\"),keep start)" + + "&$apply=ancestors($root/GenreHierarchy,GenreHierarchy,ID,search(\"true\"),keep start)" + "/orderby(name)" + "/com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/GenreHierarchy,HierarchyQualifier='GenreHierarchy',NodeProperty='ID')" + "&$count=true")) @@ -150,29 +137,19 @@ void testSearch() throws Exception { .andExpect(jsonPath("$.value[0].name").value("Fiction")) .andExpect(jsonPath("$.value[0].DrillState").value("expanded")) .andExpect(jsonPath("$.value[0].DistanceFromRoot").value(0)) - .andExpect(jsonPath("$.value[1].name").value("Contemporary Fiction")) - .andExpect(jsonPath("$.value[1].DrillState").value("leaf")) + .andExpect(jsonPath("$.value[1].name").value("Adventure")) + .andExpect(jsonPath("$.value[1].DrillState").value("expanded")) .andExpect(jsonPath("$.value[1].DistanceFromRoot").value(1)) - .andExpect(jsonPath("$.value[2].name").value("Fairy Tale")) + .andExpect(jsonPath("$.value[2].name").value("True Adventure")) .andExpect(jsonPath("$.value[2].DrillState").value("leaf")) - .andExpect(jsonPath("$.value[2].DistanceFromRoot").value(1)) - .andExpect(jsonPath("$.value[3].name").value("Literary Fiction")) - .andExpect(jsonPath("$.value[3].DrillState").value("leaf")) - .andExpect(jsonPath("$.value[4].name").value("Mystery")) + .andExpect(jsonPath("$.value[2].DistanceFromRoot").value(2)) + .andExpect(jsonPath("$.value[3].name").value("Non-Fiction")) + .andExpect(jsonPath("$.value[3].DrillState").value("expanded")) + .andExpect(jsonPath("$.value[3].DistanceFromRoot").value(0)) + .andExpect(jsonPath("$.value[4].name").value("True Crime")) .andExpect(jsonPath("$.value[4].DrillState").value("leaf")) - .andExpect(jsonPath("$.value[5].name").value("Poetry")) - .andExpect(jsonPath("$.value[5].DrillState").value("leaf")) - .andExpect(jsonPath("$.value[6].name").value("Short Story")) - .andExpect(jsonPath("$.value[6].DrillState").value("leaf")) - .andExpect(jsonPath("$.value[6].DistanceFromRoot").value(1)) - .andExpect(jsonPath("$.value[7]").doesNotExist()) - ; - if (isOnHana()) { - expectations.andExpect(jsonPath("$.value[0].LimitedDescendantCount").value(6)) - .andExpect(jsonPath("$.value[1].LimitedDescendantCount").value(0)) - .andExpect(jsonPath("$.value[2].LimitedDescendantCount").value(0)) - .andExpect(jsonPath("$.value[6].LimitedDescendantCount").value(0)); - } + .andExpect(jsonPath("$.value[4].DistanceFromRoot").value(1)) + .andExpect(jsonPath("$.value[5]").doesNotExist()); } @Test @@ -193,7 +170,7 @@ void testFilterNotExpanded() throws Exception { @WithMockUser(username = "admin") void testFilterExpandLevels() throws Exception { String expandLevelsJson = """ - [{"NodeID":"8bbf14c6-b378-4e35-9b4f-5a9c8b8762da","Levels":1},{"NodeID":"85b5a640-7e9a-468e-80e2-e9268486031b","Levels":1}]\ + [{"NodeID":"8bbf14c6-b378-4e35-9b4f-05a9c8878002","Levels":1},{"NodeID":"8bbf14c6-b378-4e35-9b4f-05a9c8878031","Levels":1}]\ """; String unencoded = genresURI + "?$select=DistanceFromRoot,DrillState,ID,LimitedDescendantCount,name" + "&$apply=ancestors($root/GenreHierarchy,GenreHierarchy,ID,filter(name eq 'Autobiography'),keep start)/orderby(name)" @@ -211,22 +188,16 @@ void testFilterExpandLevels() throws Exception { @Test @WithMockUser(username = "admin") - void testStartTwoLevelsOrderByDescHANA() throws Exception { - if (isOnHana()) { - client.perform(get(genresURI - + "?$select=DrillState,ID,name,DistanceFromRoot" - + "&$apply=orderby(name desc)/" - + "com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/GenreHierarchy,HierarchyQualifier='GenreHierarchy',NodeProperty='ID',Levels=2)" - + "&$count=true")) - .andExpect(status().isOk()) - .andExpect(jsonPath("$.value[0].name").value("Non-Fiction")) - .andExpect(jsonPath("$.value[1].name").value("Speech")) - .andExpect(jsonPath("$.value[21].name").value("Action")) - .andExpect(jsonPath("$.value[22]").doesNotExist()); - } - } - - private boolean isOnHana() { - return env.acceptsProfiles(Profiles.of("cloud")); + void testStartTwoLevelsOrderByDesc() throws Exception { + client.perform(get(genresURI + + "?$select=DrillState,ID,name,DistanceFromRoot" + + "&$apply=orderby(name desc)/" + + "com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/GenreHierarchy,HierarchyQualifier='GenreHierarchy',NodeProperty='ID',Levels=2)" + + "&$count=true")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.value[0].name").value("Non-Fiction")) + .andExpect(jsonPath("$.value[1].name").value("True Crime")) + .andExpect(jsonPath("$.value[182].name").value("Action & Adventure")) + .andExpect(jsonPath("$.value[183]").doesNotExist()); } -} \ No newline at end of file +}