-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
145 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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;103;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;103;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;117;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;117;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;110;4.0;978-3473523023 | ||
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;f846b0b9-01d4-4f6d-82a4-d79204f62369;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;f846b0b9-01d4-4f6d-82a4-d79204f62571;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;d846b0b9-01d4-4f6d-82a4-d79204f62487;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;d846b0b9-01d4-4f6d-82a4-d79204f62590;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;d846b0b9-01d4-4f6d-82a4-d79204f62590;4.0;978-3473523023 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,18 @@ | ||
ID;parent_ID;name | ||
100;;Fiction | ||
101;100;Action | ||
102;100;Adventure | ||
103;100;Drama | ||
105;100;Poetry | ||
106;100;Science Fiction | ||
107;106;Utopian and Dystopian | ||
108;107;Dystopia | ||
109;108;Cyberpunk | ||
110;109;Steampunk | ||
104;100;Fantasy | ||
111;104;Epic fantasy | ||
112;104;High fantasy | ||
113;100;Graphic Novel | ||
115;100;Short Story | ||
116;100;Romance | ||
117;100;Mystery | ||
123;117;Thriller | ||
124;117;Suspense | ||
118;100;Horror | ||
119;100;Historical Fiction | ||
120;100;Contemporary Fiction | ||
121;100;Magical Realism | ||
122;100;Literary Fiction | ||
128;100;Fairy Tale | ||
200;;Non-Fiction | ||
201;200;Biography | ||
202;201;Autobiography | ||
203;200;Essay | ||
204;200;Speech | ||
f846b0b9-01d4-4f6d-82a4-d79204f62369;;Fiction | ||
f846b0b9-01d4-4f6d-82a4-d79204f62570;f846b0b9-01d4-4f6d-82a4-d79204f62369;Drama | ||
f846b0b9-01d4-4f6d-82a4-d79204f62571;f846b0b9-01d4-4f6d-82a4-d79204f62369;Poetry | ||
f846b0b9-01d4-4f6d-82a4-d79204f62572;f846b0b9-01d4-4f6d-82a4-d79204f62369;Fantasy | ||
f846b0b9-01d4-4f6d-82a4-d79204f62592;f846b0b9-01d4-4f6d-82a4-d79204f62572;Epic fantasy | ||
f846b0b9-01d4-4f6d-82a4-d79204f62593;f846b0b9-01d4-4f6d-82a4-d79204f62572;High fantasy | ||
f846b0b9-01d4-4f6d-82a4-d79204f62573;f846b0b9-01d4-4f6d-82a4-d79204f62369;Science Fiction | ||
f846b0b9-01d4-4f6d-82a4-d79204f62574;f846b0b9-01d4-4f6d-82a4-d79204f62369;Romance | ||
f846b0b9-01d4-4f6d-82a4-d79204f62575;f846b0b9-01d4-4f6d-82a4-d79204f62369;Mystery | ||
f846b0b9-01d4-4f6d-82a4-d79204f62576;f846b0b9-01d4-4f6d-82a4-d79204f62369;Thriller | ||
f846b0b9-01d4-4f6d-82a4-d79204f62577;f846b0b9-01d4-4f6d-82a4-d79204f62369;Dystopia | ||
f846b0b9-01d4-4f6d-82a4-d79204f62578;f846b0b9-01d4-4f6d-82a4-d79204f62369;Fairy Tale | ||
d846b0b9-01d4-4f6d-82a4-d79204f62487;;Non-Fiction | ||
d846b0b9-01d4-4f6d-82a4-d79204f62588;d846b0b9-01d4-4f6d-82a4-d79204f62487;Biography | ||
d846b0b9-01d4-4f6d-82a4-d79204f62589;d846b0b9-01d4-4f6d-82a4-d79204f62588;Autobiography | ||
d846b0b9-01d4-4f6d-82a4-d79204f62590;d846b0b9-01d4-4f6d-82a4-d79204f62487;Essay | ||
d846b0b9-01d4-4f6d-82a4-d79204f62591;d846b0b9-01d4-4f6d-82a4-d79204f62487;Speech |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
srv/src/main/java/my/bookshop/handlers/HierarchyExpandHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package my.bookshop.handlers; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.stereotype.Component; | ||
|
||
import com.sap.cds.ql.CQL; | ||
import com.sap.cds.ql.cqn.CqnSelect; | ||
import com.sap.cds.ql.cqn.CqnSelectListItem; | ||
import com.sap.cds.ql.cqn.Modifier; | ||
import com.sap.cds.ql.cqn.transformation.CqnAncestorsTransformation; | ||
import com.sap.cds.ql.cqn.transformation.CqnTransformation; | ||
import com.sap.cds.services.cds.CdsReadEventContext; | ||
|
||
import com.sap.cds.services.handler.EventHandler; | ||
import com.sap.cds.services.handler.annotations.On; | ||
import com.sap.cds.services.handler.annotations.ServiceName; | ||
|
||
import cds.gen.adminservice.AdminService_; | ||
import cds.gen.adminservice.GenreHierarchy_; | ||
|
||
|
||
@Component | ||
@ServiceName(AdminService_.CDS_NAME) | ||
/** | ||
* For testing purposes of modifying requests for hierarchies | ||
*/ | ||
@Profile("hybrid") | ||
public class HierarchyExpandHandler implements EventHandler { | ||
|
||
@On(entity = GenreHierarchy_.CDS_NAME) | ||
void removeExpand(CdsReadEventContext event) { | ||
List<CqnTransformation> trafos = event.getCqn().transformations(); | ||
if (trafos.size() < 1) { | ||
return; | ||
} | ||
if (trafos.get(0) instanceof CqnAncestorsTransformation) { | ||
CqnSelect original = event.getCqn(); | ||
CqnSelect copy = CQL.copy(original, new Modifier() { | ||
public List<CqnSelectListItem> items(List<CqnSelectListItem> items) { | ||
return items.stream().filter(i -> !i.isExpand()).toList(); | ||
} | ||
}); | ||
event.setCqn(copy); | ||
} | ||
event.proceed(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
srv/src/test/java/my/bookshop/handlers/HierarchyHandlerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* 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.adminservice.GenreHierarchy; | ||
import my.bookshop.handlers.HierarchyHandler.Sorter; | ||
public class HierarchyHandlerTest { | ||
@Test | ||
public void testSortingRoots() { | ||
GenreHierarchy h1 = GenreHierarchy.create(); | ||
h1.setName("Philosophical fiction"); | ||
GenreHierarchy h2 = GenreHierarchy.create(); | ||
h2.setName("Epic"); | ||
List<GenreHierarchy> list = List.of(h1,h2); | ||
List<GenreHierarchy> sorted = list.stream().sorted(new Sorter()).toList(); | ||
assertEquals("Epic", sorted.get(0).getName()); | ||
} | ||
@Test | ||
public void testSortingChildren() { | ||
GenreHierarchy root = GenreHierarchy.create(); | ||
root.setName("Folklore"); | ||
GenreHierarchy h1 = GenreHierarchy.create(); | ||
h1.setName("Urban legend"); | ||
h1.setParnt(root); | ||
GenreHierarchy h2 = GenreHierarchy.create(); | ||
h2.setName("Fairy tale"); | ||
h2.setParnt(root); | ||
List<GenreHierarchy> list = List.of(h1,h2); | ||
List<GenreHierarchy> sorted = list.stream().sorted(new Sorter()).toList(); | ||
assertEquals("Fairy tale", sorted.get(0).getName()); | ||
} | ||
@Test | ||
public void testSortingChildrenWithDifRoot() { | ||
GenreHierarchy root1 = GenreHierarchy.create(); | ||
root1.setName("Thriller"); | ||
GenreHierarchy root2 = GenreHierarchy.create(); | ||
root2.setName("Folklore"); | ||
GenreHierarchy h2 = GenreHierarchy.create(); | ||
h2.setName("Urban legend"); | ||
h2.setParnt(root2); | ||
List<GenreHierarchy> list = List.of(root1,h2); | ||
List<GenreHierarchy> sorted = list.stream().sorted(new Sorter()).toList(); | ||
assertEquals("Urban legend", sorted.get(0).getName()); | ||
} | ||
@Test | ||
public void testSortingChildrenSameRoot() { | ||
GenreHierarchy root = GenreHierarchy.create(); | ||
root.setName("Folklore"); | ||
GenreHierarchy h1 = GenreHierarchy.create(); | ||
h1.setName("Urban legend"); | ||
h1.setParnt(root); | ||
List<GenreHierarchy> list = List.of(h1,root); | ||
List<GenreHierarchy> sorted = list.stream().sorted(new Sorter()).toList(); | ||
assertEquals("Folklore", sorted.get(0).getName()); | ||
} | ||
} | ||
*/ |