Skip to content

Commit dd4bdfa

Browse files
authored
Fix code tour and align with current content (#333)
Closes #332
1 parent 3fbb03c commit dd4bdfa

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

.tours/sample-tour.tour

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,34 @@
1111
{
1212
"file": "README.md",
1313
"description": "### Bookshop Sample\n\nThe sample implements a simple bookshop demonstrating selected features of CAP and introduces some essential concepts of CAP for Java:\n\n- [Project Setup](https://cap.cloud.sap/docs/java/getting-started) and [Layouts](https://cap.cloud.sap/docs/java/getting-started#project-layout)\n- [Domain Modeling](https://cap.cloud.sap/docs/guides/domain-models)\n- [Defining Services](https://cap.cloud.sap/docs/guides/services#defining-services)\n- [Generic Providers](https://cap.cloud.sap/docs/guides/generic)\n- [Adding Custom Logic](https://cap.cloud.sap/docs/java/provisioning-api)\n- [Using Databases](https://cap.cloud.sap/docs/guides/databases)",
14-
"line": 25
14+
"line": 33
1515
},
1616
{
1717
"file": "db/books.cds",
1818
"description": "### Entity and Type Definitions\n\nEvery CAP project usually starts with the [domain model](https://cap.cloud.sap/docs/guides/domain-models). It defines the entities and types you can use in the services your application wants to offer. Showcased here are some entity definitions which are used by the bookshop application, using [CDL](https://cap.cloud.sap/docs/cds/cdl).\n\nConcepts used:\n\n- [Entity and Type Definitions](https://cap.cloud.sap/docs/cds/cdl#entity-and-type-definitions)\n- [Associations & Compositions](https://cap.cloud.sap/docs/cds/cdl#associations)\n- [Input Validation](https://cap.cloud.sap/docs/cds/annotations#input-validation)\n- [Declaring Localized Data](https://cap.cloud.sap/docs/guides/localized-data#declaring-localized-data)",
19-
"line": 50,
19+
"line": 55,
2020
"selection": {
2121
"start": {
2222
"line": 1,
2323
"character": 1
2424
},
2525
"end": {
26-
"line": 50,
26+
"line": 55,
2727
"character": 1
2828
}
2929
}
3030
},
3131
{
3232
"file": "srv/cat-service.cds",
3333
"description": "### Service Definitions\n\nA [service](https://cap.cloud.sap/docs/cds/cdl#service-definitions) interface exposes chosen entities of your domain model for consumption. The endpoint of the exposed service is usually constructed by its name following specific conventions. Here, however the endpoint path to the `CatalogService` is overwritten by the `@path : 'browse'` annotation.\n\nThis `CatalogService` showcases the API for browsing books and adding reviews and demonstrates:\n\n- [Services](https://cap.cloud.sap/docs/java/consumption-api)\n- [Import Directives](https://cap.cloud.sap/docs/cds/cdl#imports)\n- [Namespaces](https://cap.cloud.sap/docs/cds/cdl#namespaces)\n- [Views and Projections](https://cap.cloud.sap/docs/cds/cdl#views)\n- [Annotations](https://cap.cloud.sap/docs/cds/cdl#annotations)\n- [Bound and Unbound Actions](https://cap.cloud.sap/docs/cds/cdl#actions)\n- [Restrictions](https://cap.cloud.sap/docs/guides/authorization#restrictions)",
34-
"line": 66,
34+
"line": 35,
3535
"selection": {
3636
"start": {
3737
"line": 1,
3838
"character": 1
3939
},
4040
"end": {
41-
"line": 41,
41+
"line": 35,
4242
"character": 2
4343
}
4444
}
@@ -63,49 +63,49 @@
6363
"description": "### Event Handler\n\nAfter defining your domain model and services you can [implement event handlers](https://cap.cloud.sap/docs/java/application-services) reacting to events triggered by these services. This file, for example, showcases an [event handler](https://cap.cloud.sap/docs/java/provisioning-api) for the `CatalogService`. There are various handler implementations reacting to specific [event phases](https://cap.cloud.sap/docs/java/provisioning-api#phases), as showcased in the next steps of this tour.",
6464
"selection": {
6565
"start": {
66-
"line": 79,
66+
"line": 77,
6767
"character": 2
6868
},
6969
"end": {
70-
"line": 183,
70+
"line": 180,
7171
"character": 3
7272
}
7373
}
7474
},
7575
{
7676
"file": "srv/src/main/java/my/bookshop/handlers/CatalogServiceHandler.java",
7777
"description": "### Event Handler\n\nThe method `beforeAddReview` demonstrated here is used to validate reviews that are about to be persisted, checking whether the author of the review already created one for the given book. The `ServiceException` thrown in such a case aborts further processing of the current event (of adding a review). The method is bound to the `Before` [event phase](https://cap.cloud.sap/docs/java/provisioning-api#phases), meaning it will be triggerd before the core processing of the event. In the next steps you will see some other event phase handling examples.\n\nThe query run against the database for the check is constructed via the [Query Builder Java API](https://cap.cloud.sap/docs/java/query-api#the-query-builders-java-api).\n\nConcepts used:\n\n- [Event Phase: `Before`](https://cap.cloud.sap/docs/java/provisioning-api#before)\n- [Building CQN Queries](https://cap.cloud.sap/docs/java/query-api)\n- [Indicating Errors](https://cap.cloud.sap/docs/java/indicating-errors)\n- [Static CDS Model](https://cap.cloud.sap/docs/java/advanced#staticmodel)",
78-
"line": 96,
78+
"line": 94,
7979
"selection": {
8080
"start": {
81-
"line": 79,
81+
"line": 77,
8282
"character": 2
8383
},
8484
"end": {
85-
"line": 96,
85+
"line": 94,
8686
"character": 3
8787
}
8888
}
8989
},
9090
{
9191
"file": "srv/src/main/java/my/bookshop/handlers/CatalogServiceHandler.java",
9292
"description": "### Event Handler\n\nThe `onAddReview` method is bound to the `On` phase of the `AddReview` event, as defined by the bound action in the [`CatalogService`](srv/cat-service.cds). Aside from the `Insert` [query execution](https://cap.cloud.sap/docs/java/query-execution#queries) demonstrated here, you can also see how to [complete the event processing](https://cap.cloud.sap/docs/java/provisioning-api#eventcompletion) necessary in the `On` phase. In this example we are setting the `Reviews` object from the query result in the event context.\n\nConcepts used:\n\n- [Event Phase: `On`](https://cap.cloud.sap/docs/java/provisioning-api#on)\n- [Event Contexts](https://cap.cloud.sap/docs/java/provisioning-api#eventcontext)\n- [Building CQN Queries](https://cap.cloud.sap/docs/java/query-api)\n- [Static CDS Model](https://cap.cloud.sap/docs/java/advanced#staticmodel)",
93-
"line": 123,
93+
"line": 115,
9494
"selection": {
9595
"start": {
96-
"line": 98,
96+
"line": 96,
9797
"character": 2
9898
},
9999
"end": {
100-
"line": 123,
100+
"line": 115,
101101
"character": 3
102102
}
103103
}
104104
},
105105
{
106106
"file": "srv/cat-service.cds",
107107
"description": "### Bound Action\n\nThe [bound action](https://cap.cloud.sap/docs/cds/cdl#actions) `addReview` here is bound to the `Books` entity within the [`CatalogService`](srv/cat-service.cds). Modeling an action provides you with a more specific [event context](https://cap.cloud.sap/docs/java/provisioning-api#eventcontext) object, such as the `AddReviewContext`, which is used, as shown in the previous step, to implement the `AddReview` event processing.",
108-
"line": 11,
108+
"line": 10,
109109
"selection": {
110110
"start": {
111111
"line": 10,
@@ -120,14 +120,14 @@
120120
{
121121
"file": "srv/cat-service.cds",
122122
"description": "### Unbound Action\n\nIn contrast, `submitOrder` is modeled as an [unbound action](https://cap.cloud.sap/docs/cds/cdl#actions), meaning it is not bound to an individual entity as `addReview` is bound to `Books`.\n\n[Actions and Functions](https://cap.cloud.sap/docs/java/application-services#actions) as the examples shown here and in the previous step, are generally used to enhance your application service with custom operations.",
123-
"line": 28,
123+
"line": 21,
124124
"selection": {
125125
"start": {
126-
"line": 26,
126+
"line": 19,
127127
"character": 5
128128
},
129129
"end": {
130-
"line": 28,
130+
"line": 21,
131131
"character": 7
132132
}
133133
}
@@ -148,31 +148,31 @@
148148
}
149149
},
150150
{
151-
"file": "srv/src/main/java/my/bookshop/handlers/DestinationConfiguration.java",
151+
"file": "srv/src/main/java/my/bookshop/config/DestinationConfiguration.java",
152152
"description": "### Application Start-Up\n\nAnother example of this you can find here in the `DestinationConfiguration` handler.",
153-
"line": 31,
153+
"line": 35,
154154
"selection": {
155155
"start": {
156-
"line": 21,
156+
"line": 22,
157157
"character": 2
158158
},
159159
"end": {
160-
"line": 31,
160+
"line": 35,
161161
"character": 3
162162
}
163163
}
164164
},
165165
{
166166
"file": "srv/src/main/java/my/bookshop/handlers/AdminServiceHandler.java",
167167
"description": "### SAP Fiori Drafts Support\n\nHere, you can see a handler bound to events of the [SAP Fiori Draft](https://cap.cloud.sap/docs/java/fiori-drafts) flow. Draft-specific events are enabled by annotating entities with `@odata.draft.enabled` as in the [`AdminService`](srv/admin-service.cds).\n\nConcepts used:\n\n- [Draft-based Editing](https://cap.cloud.sap/docs/advanced/fiori#fiori-draft-support)",
168-
"line": 165,
168+
"line": 158,
169169
"selection": {
170170
"start": {
171-
"line": 135,
171+
"line": 142,
172172
"character": 2
173173
},
174174
"end": {
175-
"line": 165,
175+
"line": 158,
176176
"character": 3
177177
}
178178
}
@@ -197,6 +197,5 @@
197197
"description": "### Summary\n\nThat's it! You have seen:\n\n- Entity and Type Definitions\n- Service Definitions\n- Event Handler\n- Bound and Unbound Actions\n- Fiori Draft Support\n- SAP Fiori Elements Support\n\nFor more information and details, check our [CAP](https://cap.cloud.sap/docs/) documentation."
198198
}
199199
],
200-
"ref": "guided-tours",
201200
"description": "Demonstrating CAP for Java"
202-
}
201+
}

0 commit comments

Comments
 (0)