Skip to content

Commit 0052e95

Browse files
authored
Demonstrate cds-feature-attachments with bookshop (#377)
This PR demonstrates the usage of the cds-feature-attachments in the bookshop.
1 parent 4d570bb commit 0052e95

File tree

8 files changed

+45
-5
lines changed

8 files changed

+45
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Welcome to the bookshop-java project. It demonstrates how to build business appl
1515
- [Demonstrated Features](#demonstrated-features)
1616
- [Getting Started](#getting-started)
1717
- [Prerequisites](#prerequisites)
18-
- [Clone Build & Run](#clone-build--run)
18+
- [Clone Build & Run](#clone-build-run)
1919
- [Using VS Code](#using-vs-code)
2020
- [Using Eclipse](#using-eclipse)
2121
- [Building and Running](#building-and-running)

app/_i18n/i18n.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ModifiedBy = Modified By
77
General = General
88
Details = Details
99
Admin = Administrative
10+
Translations = Translations
1011

1112
ID = ID
1213
Currency = Currency
@@ -68,3 +69,11 @@ AddReview = Add Review
6869
Notes = Notes
6970
Note = Note
7071
ISBN = ISBN
72+
73+
attachment_content = Content
74+
attachment_mimeType = MIME Type
75+
attachment_fileName = File Name
76+
attachment_status = Status
77+
attachment_note = Note
78+
attachment = Cover
79+
attachments = Covers

app/_i18n/i18n_de.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ModifiedBy = Bearbeitet von
77
General = Generelles
88
Details = Details
99
Admin = Administratives
10+
Translations = Übersetzungen
1011

1112
ID = ID
1213
Currency = W\u00E4hrung
@@ -68,3 +69,11 @@ AddReview = Rezension hinzufügen
6869
Notes = Notizen
6970
Note = Notiz
7071
ISBN = ISBN
72+
73+
attachment_content = Inhalt
74+
attachment_mimeType = MIME-Typ
75+
attachment_fileName = Dateiname
76+
attachment_status = Status
77+
attachment_note = Notiz
78+
attachment = Buchcover
79+
attachments = Buchcovers

app/admin/fiori-service.cds

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,16 @@ annotate AdminService.Books with @(UI : {
2626
Label : '{i18n>Details}',
2727
Target : '@UI.FieldGroup#Details'
2828
},
29+
{
30+
$Type : 'UI.ReferenceFacet',
31+
ID : 'AttachmentsFacet',
32+
Target : 'covers/@UI.LineItem'
33+
},
2934
{
3035
$Type : 'UI.ReferenceFacet',
3136
Label : '{i18n>Admin}',
3237
Target : '@UI.FieldGroup#Admin'
33-
},
38+
}
3439
],
3540
FieldGroup #General : {Data : [
3641
{Value : title},
@@ -131,3 +136,6 @@ annotate AdminService.Books actions {
131136
quantity @title : '{i18n>Quantity}'
132137
)
133138
}
139+
140+
// Hides technical field up__ID in View Setitings dialog for Books.covers
141+
annotate AdminService.Books.covers:up_ with @UI.Hidden;

app/fiori.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
};
1515
</script>
1616

17-
<script id="sap-ushell-bootstrap" src="https://sapui5.hana.ondemand.com/1.129.0/test-resources/sap/ushell/bootstrap/sandbox.js"></script>
18-
<script id="sap-ui-bootstrap" src="https://sapui5.hana.ondemand.com/1.129.0/resources/sap-ui-core.js"
17+
<script id="sap-ushell-bootstrap" src="https://sapui5.hana.ondemand.com/1.131.0/test-resources/sap/ushell/bootstrap/sandbox.js"></script>
18+
<script id="sap-ui-bootstrap" src="https://sapui5.hana.ondemand.com/1.131.0/resources/sap-ui-core.js"
1919
data-sap-ui-libs="sap.m, sap.ushell, sap.collaboration, sap.ui.layout"
2020
data-sap-ui-compatVersion="edge"
2121
data-sap-ui-theme="sap_horizon"

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<xsuaa.version>3.5.3</xsuaa.version>
2929
<cf-java-logging-support.version>3.8.4</cf-java-logging-support.version>
3030
<cds.cdsdk-version>8.4.2</cds.cdsdk-version>
31+
<cds-feature-attachments.version>1.0.5</cds-feature-attachments.version>
3132
</properties>
3233

3334
<modules>

srv/admin-service.cds

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using {sap.common.Languages as CommonLanguages} from '@sap/cds/common';
22
using {my.bookshop as my} from '../db/index';
33
using {sap.changelog as changelog} from 'com.sap.cds/change-tracking';
4+
using {sap.attachments.Attachments} from `com.sap.cds/cds-feature-attachments`;
45

56
extend my.Orders with changelog.changeTracked;
67

@@ -62,4 +63,9 @@ annotate AdminService.Orders with @changelog: [OrderNo];
6263
annotate AdminService.OrderItems with @changelog: [
6364
parent.OrderNo,
6465
book.title,
65-
];
66+
];
67+
68+
// Extends the Books entity with the Attachments composition
69+
extend my.Books with {
70+
covers : Composition of many Attachments;
71+
};

srv/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@
5858
<scope>runtime</scope>
5959
</dependency>
6060

61+
<dependency>
62+
<groupId>com.sap.cds</groupId>
63+
<artifactId>cds-feature-attachments</artifactId>
64+
<version>${cds-feature-attachments.version}</version>
65+
<scope>runtime</scope>
66+
</dependency>
67+
6168
<!-- CLOUD SDK dependencies -->
6269
<dependency>
6370
<groupId>com.sap.cloud.sdk.cloudplatform</groupId>

0 commit comments

Comments
 (0)