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
- The plugin is released to Maven Central at: https://central.sonatype.com/artifact/com.sap.cds/cds-feature-attachments
53
46
54
-
If you want to test snapshot versions of this plugin, you need to configure the Artifactory in your `${HOME}/.m2/settings.xml`.
55
-
See [here](https://maven.apache.org/settings.html#Repositories) for further details.
47
+
- Snapshots are deployed to SAP's Artifactory in DMZ: https://common.repositories.cloud.sap/artifactory/cap-java/com/sap/cds/cds-feature-attachments/
56
48
57
-
Look at the [changelog](./doc/CHANGELOG.md)to see latest changes.
49
+
- See the [changelog](./doc/CHANGELOG.md)for the latest changes.
58
50
59
-
### How to use
51
+
- If you want to test snapshot versions of this plugin, you need to configure the Artifactory in your `${HOME}/.m2/settings.xml`. See [the maven settings](https://maven.apache.org/settings.html#Repositories) for further details.
52
+
53
+
## Getting Started
60
54
61
55
The usage of CAP Java plugins is described in the [CAP Java Documentation](https://cap.cloud.sap/docs/java/building-plugins#reference-the-new-cds-model-in-an-existing-cap-java-project). Following this documentation this plugin needs to be referenced in the `srv/pom.xml` of a CAP Java application:
62
56
@@ -87,7 +81,7 @@ To be able to also use the CDS models defined in this plugin the `cds-maven-plug
87
81
```
88
82
After that, the aspect `Attachments` can be used in the application's CDS model.
89
83
90
-
####CDS Models
84
+
###Changes in CDS Models
91
85
92
86
Depending where the aspect `Attachments` shall be used in the application's CDS model, different approaches need to be implemented.
93
87
- If the aspect `Attachments` shall be used on an entity provided in the `db` module, the corresponding entity needs to be extended from a CDS file in the `srv` module. Therefore the entity from the `db` folder needs to be imported with an `using` statement. Then, this entity can be extended with a new field that is a `Composition of many Attachments`.
@@ -118,7 +112,7 @@ entity Items : cuid {
118
112
Use the aspect `Attachments` directly for the composition.
119
113
Use the correct from clause for the `using` statement. The annotations and other definitions are found and used only if `com.sap.cds/cds-feature-attachments` is used and not concrete files of the feature.
120
114
121
-
####UI
115
+
### UI
122
116
123
117
To enhance the UI with the attachments the following annotations are used for the `UI.Facets` annotations in the respective `.cds` file of your app:
124
118
@@ -171,7 +165,7 @@ annotate service.Incidents with @(
171
165
);
172
166
```
173
167
174
-
####Storage Targets
168
+
### Storage Targets
175
169
176
170
By default, the plugin operates without a dedicated storage target, storing attachments directly in the [underlying database](cds-feature-attachments/src/main/resources/cds/com.sap.cds/cds-feature-attachments/attachments.cds#L17).
177
171
@@ -181,7 +175,7 @@ Other available storage targets:
181
175
182
176
When using a dedicated storage target, the attachment is not stored in the underlying database; instead, it is saved on the specified storage target, and only a reference to the file is kept in the database, as defined in the [CDS model](cds-feature-attachments/src/main/resources/cds/com.sap.cds/cds-feature-attachments/attachments.cds#L20).
183
177
184
-
####Malware Scanner
178
+
### Malware Scanner
185
179
186
180
This plugin checks for a binding to
187
181
the [SAP Malware Scanning Service](https://help.sap.com/docs/malware-scanning-servce), this needs to have the label `malware-scanner`. The entry in the [mta-file](https://cap.cloud.sap/docs/guides/deployment/to-cf#add-mta-yaml) possibly looks like:
@@ -235,7 +229,7 @@ Scan status codes:
235
229
-`Infected`: The attachment is infected.
236
230
237
231
238
-
####Outbox
232
+
### Outbox
239
233
240
234
In this plugin the [persistent outbox](https://cap.cloud.sap/docs/java/outbox#persistent) is used to mark attachments as
241
235
deleted.
@@ -247,12 +241,12 @@ the default outbox configuration.
247
241
If the default shall be used, nothing needs to be done.
248
242
249
243
250
-
####Restore Endpoint
244
+
### Restore Endpoint
251
245
252
246
The attachment service has an event `RESTORE_ATTACHMENTS`.
253
247
This event can be called with a timestamp to restore externally stored attachments.
254
248
255
-
#####Motivation
249
+
#### Motivation
256
250
257
251
Documents which are marked as deleted can be restored.
258
252
@@ -273,7 +267,7 @@ In such cases the restore endpoint can be used to restore attachments.
273
267
How long attachments are marked as deleted before they get deleted dependents on the configuration
274
268
of the used storage.
275
269
276
-
#####HTTP Endpoint
270
+
#### HTTP Endpoint
277
271
278
272
There is no predefined endpoint for the restore action.
279
273
To call the action of the service from outside the application a service could be defined like the following example:
@@ -322,7 +316,7 @@ public class RestoreAttachmentsHandler implements EventHandler {
322
316
323
317
In the Spring Boot context the `AttachmentService` can be autowired in the handler.
324
318
325
-
#####Security
319
+
#### Security
326
320
327
321
To secure the endpoint security annotations can be used e.g. like the following example:
328
322
@@ -338,12 +332,13 @@ entity Items : cuid {
338
332
annotate RestoreAttachments with @(requires: 'internal-user');
339
333
```
340
334
341
-
Here the `RestoreAttachments` service is annotated with the `requires` annotation to secure the service.
335
+
Here, the `RestoreAttachments` service is annotated with the `requires` annotation to secure the service.
342
336
Also, other annotations can be used to secure the service.
343
337
344
338
More information about the CAP Java security concept can be found in
345
339
the [CAP Java Documentation](https://cap.cloud.sap/docs/java/security).
0 commit comments