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: advanced/hana.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ Steps to match the signature of a database object in a facade entity:
50
50
* For a view, table function, or calculation view with parameters, check that the parameter names and types match, too.
51
51
Functions with table-like input parameters are not supported.
52
52
53
-
> Note: If a field of that entity is defined as `not null` and you want to disable its runtime check, you can add [`@assert.notNull: false`](../guides/providing-services#assert-notnull). This is important if you want to use, for example [SAP HANA history tables](https://help.sap.com/docs/SAP_HANA_PLATFORM/6b94445c94ae495c83a19646e7c3fd56/d0b2c5142a19405fb912f71782cd0a84.html).
53
+
> Note: If a field of that entity is defined as `not null` and you want to disable its runtime check, you can add `@assert.notNull: false`. This is important if you want to use, for example [SAP HANA history tables](https://help.sap.com/docs/SAP_HANA_PLATFORM/6b94445c94ae495c83a19646e7c3fd56/d0b2c5142a19405fb912f71782cd0a84.html).
54
54
55
55
56
56
As a result, the database name is defined by the name of the entity or its elements, after applying the SQL name mapping.
PATCH requests with delta payload are executed using batch delete and [upsert](../java/working-with-cql/query-api#bulk-upsert) statements, and are more efficient than OData [batch requests](https://docs.oasis-open.org/odata/odata/v4.01/csprd02/part1-protocol/odata-v4.01-csprd02-part1-protocol.html#sec_BatchRequests).
106
106
107
-
Use PATCH on entity collections for uploading mass data using a dedicated service, which is secured using [role-based authorization](../java/security#role-based-auth). Delta updates must be explicitly enabled by annotating the entity with
107
+
Use PATCH on entity collections for uploading mass data using a dedicated service, which is secured using [role-based authorization](../guides/security/authorization#requires). Delta updates must be explicitly enabled by annotating the entity with
Recursive hierarchies are parent-child hierarchies, where each entity references its parent and through that defines the hierarchical structure. A common example is a company organization structure or HR reporting, where each employee entity references another employee a as direct report or manager.
1144
+
1145
+
##### Domain Model
1146
+
1147
+
The simplest domain model looks as follows:
1148
+
1149
+
```cds
1150
+
entity Employee : Hierarchy {
1151
+
key ID : UUID;
1152
+
parent : Association to Employee;
1153
+
fullName : String;
1154
+
}
1155
+
1156
+
aspect Hierarchy {
1157
+
virtual LimitedDescendantCount : Integer64;
1158
+
virtual DistanceFromRoot : Integer64;
1159
+
virtual DrillState : String;
1160
+
virtual LimitedRank : Integer64;
1161
+
}
1162
+
```
1163
+
1164
+
The entity `Employee` has the element `ID`, which identifies the hierarchy node. The `parent` association references the same entity, which establishes the parent-child relationship.
1165
+
1166
+
##### Virtual Elements of a Hierarchy
1167
+
1168
+
The `Hierarchy` aspect defines a set of virtual elements, automatically calculated by the backend at runtime, to describe the state of the hierarchy. This information is requested by the UI to correctly render the hierarchy in a *TreeTable* during user interaction.
1169
+
1170
+
##### Service Model
1171
+
1172
+
The following service defines the projection on the domain model.
1173
+
1174
+
```cds
1175
+
service HRService {
1176
+
entity HREmployee as projection on Employee;
1177
+
}
1178
+
```
1179
+
1180
+
1181
+
##### OData v4 Annotations for Fiori
1182
+
1183
+
To link the backend and Fiori UI, the projected service entity must be enriched with the following annotations.
1184
+
1185
+
```cds
1186
+
annotate HRService.HREmployee with @Aggregation.RecursiveHierarchy #EmployeeHierarchy: {
1187
+
$Type: 'Aggregation.RecursiveHierarchyType',
1188
+
NodeProperty: ID,
1189
+
ParentNavigationProperty: parent
1190
+
};
1191
+
```
1192
+
1193
+
Here the `EmployeeHierarchy` specifies a hierarchy qualifier, `NodeProperty` (identifying the hierarchy node) is linked to `ID` of the entity `HREmployee`, and the `ParentNavigationProperty` is linked to a corresponding `parent` association.
1194
+
1195
+
```cds
1196
+
annotate HRService.HREmployee with @Hierarchy.RecursiveHierarchy #EmployeeHierarchy: {
1197
+
$Type: 'Hierarchy.RecursiveHierarchyType',
1198
+
LimitedDescendantCount: LimitedDescendantCount,
1199
+
DistanceFromRoot: DistanceFromRoot,
1200
+
DrillState: DrillState,
1201
+
LimitedRank: LimitedRank
1202
+
};
1203
+
```
1204
+
1205
+
Here the same qualifier `EmployeeHierarchy` is referenced to list the names of the [virtual elements of the hierarchy](#virtual-elements-of-a-hierarchy).
Copy file name to clipboardExpand all lines: advanced/publishing-apis/asyncapi.md
+37-4Lines changed: 37 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,6 +110,39 @@ service CatalogService {
110
110
}
111
111
```
112
112
113
+
## Extensions { #extensions}
114
+
115
+
`@AsyncAPI.Extensions` can be used to provide arbitrary extensions.
116
+
If a specific annotation exists for a given extension, it takes precedence over the definition using @AsyncAPI.Extensions.
117
+
For example, if both `@AsyncAPI.ShortText` and `@AsyncAPI.Extensions: { ![sap-shortText]: 'baz' }` are provided, the value from `@AsyncAPI.ShortText` will override the one defined in @AsyncAPI.Extensions.
118
+
119
+
For example:
120
+
121
+
```cds
122
+
@AsyncAPI.Extensions : {
123
+
![foo-bar] : 'baz',
124
+
![sap-shortText] : 'Service Base 1'
125
+
}
126
+
127
+
service CatalogService {
128
+
@AsyncAPI.Extensions : {
129
+
![sap-event-source] : '/{region}/sap.app.test'
130
+
}
131
+
event SampleEntity.Changed.v1 : projection on CatalogService.SampleEntity;
132
+
}
133
+
```
134
+
135
+
The `@AsyncAPI.Extensions` annotation can be applied at both the service level and the event level.
136
+
137
+
Since the AsyncAPI specification requires all extensions to be prefixed with `x-`, the compiler will automatically add this prefix. Therefore, do not include the `x-` prefix when specifying extensions in `@AsyncAPI.Extensions`.
138
+
139
+
### Behavior with `--merged` flag
140
+
141
+
When the `--merged` CLI flag is used:
142
+
143
+
- Extensions defined via `@AsyncAPI.Extensions` on `services` are **ignored**.
144
+
- Extensions defined via `@AsyncAPI.Extensions` on `events` remain effective and are applied as expected.
145
+
113
146
## Type Mapping { #mapping}
114
147
115
148
CDS Type to AsyncAPI Mapping
@@ -120,15 +153,15 @@ CDS Type to AsyncAPI Mapping
Copy file name to clipboardExpand all lines: cds/cdl.md
+29-18Lines changed: 29 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -302,20 +302,9 @@ entity Employees {
302
302
```
303
303
304
304
The text of a doc comment is stored in CSN in the property `doc`.
305
-
When generating OData EDM(X), it appears as value for the annotation `@Core.Description`.
306
-
307
-
When generating output for deployment to SAP HANA, the first paragraph of a doc comment is translated to the HANA `COMMENT` feature for tables, table columns, and for views (but not for view columns):
308
-
309
-
```sql
310
-
CREATETABLEEmployees (
311
-
ID INTEGER,
312
-
name NVARCHAR(...) COMMENT 'I am the description for "name"'
313
-
) COMMENT 'I am the description for "Employee"'
314
-
```
315
-
316
-
::: tip
317
-
Propagation of doc comments can be stopped via an empty one: `/** */`.
318
-
:::
305
+
Doc comments are not propagated. For example, a doc comment defined for an entity
306
+
isn't automatically copied to projections of this entity.
307
+
When generating OData EDM(X), doc comments are translated to the annotation `@Core.Description`.
319
308
320
309
In CAP Node.js, doc comments need to be switched on when calling the compiler:
::: tip Doc comments are enabled by default in CAP Java.
335
-
In CAP Java, doc comments are automatically enabled by the [CDS Maven Plugin](../java/developing-applications/building#cds-maven-plugin). In generated interfaces they are [converted to corresponding Javadoc comments](../java/assets/cds-maven-plugin-site/generate-mojo.html#documentation).
323
+
::: tip Doc comments are automatically enabled in CAP Java.
324
+
In CAP Java, doc comments are automatically enabled by the [CDS Maven Plugin](../java/developing-applications/building#cds-maven-plugin).
325
+
In generated interfaces they are [converted to corresponding Javadoc comments](../java/assets/cds-maven-plugin-site/generate-mojo.html#documentation).
336
326
:::
337
327
328
+
When generating output for deployment to SAP HANA, the first paragraph of a doc comment is translated
329
+
to the HANA `COMMENT` feature for tables, table columns, and for views (but not for view columns):
338
330
339
-
340
-
331
+
```sql
332
+
CREATETABLEEmployees (
333
+
ID INTEGER,
334
+
name NVARCHAR(...) COMMENT 'I am the description for "name"'
335
+
) COMMENT 'I am the description for "Employee"'
336
+
```
341
337
342
338
343
339
## Entities & Type Definitions
@@ -808,6 +804,21 @@ By using a cast, annotations and other properties are inherited from the provide
808
804
809
805
<divid="afterinferredsig" />
810
806
807
+
### Virtual elements in views
808
+
809
+
Virtual elements can be defined in views or projections like this:
810
+
```cds
811
+
entity SomeView as select from Employee {
812
+
// ...,
813
+
virtual virt1 : String(22),
814
+
virtual virt2 // virtual element without type
815
+
}
816
+
```
817
+
These virtual elements have no relation to the query source `Employee` but are new fields
818
+
in the view. Virtual elements in views or projections are handled as described in the
819
+
section on [virtual elements in entities](#virtual-elements).
0 commit comments