You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .tours/sample-tour.tour
+25-26Lines changed: 25 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -11,34 +11,34 @@
11
11
{
12
12
"file": "README.md",
13
13
"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
15
15
},
16
16
{
17
17
"file": "db/books.cds",
18
18
"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,
20
20
"selection": {
21
21
"start": {
22
22
"line": 1,
23
23
"character": 1
24
24
},
25
25
"end": {
26
-
"line": 50,
26
+
"line": 55,
27
27
"character": 1
28
28
}
29
29
}
30
30
},
31
31
{
32
32
"file": "srv/cat-service.cds",
33
33
"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,
35
35
"selection": {
36
36
"start": {
37
37
"line": 1,
38
38
"character": 1
39
39
},
40
40
"end": {
41
-
"line": 41,
41
+
"line": 35,
42
42
"character": 2
43
43
}
44
44
}
@@ -63,49 +63,49 @@
63
63
"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.",
"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)",
"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,
94
94
"selection": {
95
95
"start": {
96
-
"line": 98,
96
+
"line": 96,
97
97
"character": 2
98
98
},
99
99
"end": {
100
-
"line": 123,
100
+
"line": 115,
101
101
"character": 3
102
102
}
103
103
}
104
104
},
105
105
{
106
106
"file": "srv/cat-service.cds",
107
107
"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,
109
109
"selection": {
110
110
"start": {
111
111
"line": 10,
@@ -120,14 +120,14 @@
120
120
{
121
121
"file": "srv/cat-service.cds",
122
122
"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.",
"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,
169
169
"selection": {
170
170
"start": {
171
-
"line": 135,
171
+
"line": 142,
172
172
"character": 2
173
173
},
174
174
"end": {
175
-
"line": 165,
175
+
"line": 158,
176
176
"character": 3
177
177
}
178
178
}
@@ -197,6 +197,5 @@
197
197
"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."
0 commit comments