OpenSAP course officesupplies

This commit is contained in:
Harini Gunabalan
2020-02-27 14:57:46 +01:00
parent 06755978b2
commit a82e7a9c9f
136 changed files with 1660 additions and 2647 deletions

View File

@@ -1 +0,0 @@
using from '@sap/capire-bookshop/app';

View File

@@ -1,25 +0,0 @@
/*
In this model we demonstrate how to add Genres to Books in
as if it was an external extension. For example we use
CDS Aspects' to extend the core domain model's Books entity
as well as the AdminService.
*/
namespace sap.capire.bookshop;
using { sap.capire.reviews.ReviewsService as external } from '@sap/capire-reviews';
using { sap.capire.bookshop.Books } from '@sap/capire-bookshop/db/schema';
using { sap.common.CodeList } from '@sap/cds/common';
// Extending Books by Reviews and Genres
extend Books with {
reviews : Composition of many external.Reviews on reviews.subject = ID;
rating : external.Reviews.rating;
genre : Association to Genres;
}
// Hierarchical Code List for Genres
entity Genres : CodeList {
key ID : Integer;
children : Composition of many Genres on children.parent = $self;
parent : Association to Genres;
}

View File

@@ -1,29 +0,0 @@
{
"name": "@sap/capire-bookshop-enhanced",
"version": "1.0.0",
"description": "A sample for extending a base application package, in this case bookshop, e.g. in context of verticalization or customization.",
"repository": "https://github.com/SAP-samples/cloud-cap-samples.git",
"license": "SAP SAMPLE CODE LICENSE",
"dependencies": {
"@sap/capire-bookshop": "^1.0.0",
"@sap/capire-reviews": "^1.0.0",
"@sap/cds": "latest",
"express": "*"
},
"scripts": {
"reviews-service": "PORT=5005 cds run ../reviews-service --bind --in-memory?",
"start": "cds run --in-memory?",
"watch": "cds watch"
},
"cds": {
"requires": {
"sap.capire.reviews.ReviewsService": {
"kind": "odata",
"model": "@sap/capire-reviews"
},
"messaging": {
"kind": "file-based-messaging"
}
}
}
}

View File

@@ -1,9 +0,0 @@
namespace sap.capire.bookshop;
using { AdminService } from '@sap/capire-bookshop/srv/admin-service';
using { sap.capire.bookshop } from '../db/schema';
@impl:'srv/services'
extend service AdminService with {
entity Genres as projection on bookshop.Genres;
}

View File

@@ -1,30 +0,0 @@
const cds = require ('@sap/cds')
module.exports = cds.service.impl (async()=>{
const ReviewsService = await cds.connect.to ('sap.capire.reviews.ReviewsService')
const CatalogService = await cds.connect.to ('CatalogService')
const db = await cds.connect.to ('db')
// import model definitions from connected services to work with subsequently
const { Books } = db.entities
const { Reviews } = ReviewsService.entities
CatalogService.impl (srv => {
// delegate requests to read reviews to ReviewsService
srv.on ('READ', 'Books/reviews', (req) => {
const [ subject ] = req.params
const tx = ReviewsService.transaction (req)
return tx.run (SELECT.from (Reviews) .where ({subject}))
})
})
// react on event messages from reviews service
ReviewsService.on ('reviewed', (msg) => {
console.debug ('> received:', msg.event, msg.data)
const { subject, rating } = msg.data
const tx = db // TODO: db.transaction (msg)
return tx.run (UPDATE (Books, subject) .with ({rating}))
// return tx.update (Books, subject) .with ({rating})
})
})

View File

@@ -1,33 +0,0 @@
#################################################
#
# Genres
#
GET http://localhost:4004/admin/Genres?
###
POST http://localhost:4004/admin/Genres?
Content-Type: application/json
{ "ID":100, "name":"Some Sample Genres...", "children":[
{ "ID":101, "name":"Cat", "children":[
{ "ID":102, "name":"Kitty", "children":[
{ "ID":103, "name":"Kitty Cat", "children":[
{ "ID":104, "name":"Aristocat" } ]},
{ "ID":105, "name":"Kitty Bat" } ]},
{ "ID":106, "name":"Catwoman", "children":[
{ "ID":107, "name":"Catalina" } ]} ]},
{ "ID":108, "name":"Catweazle" }
]}
###
GET http://localhost:4004/admin/Genres(100)?
# &$expand=children
# &$expand=children($expand=children($expand=children($expand=children)))
###
DELETE http://localhost:4004/admin/Genres(103)
###
DELETE http://localhost:4004/admin/Genres(100)
###

View File

@@ -1,32 +0,0 @@
#################################################
#
# Reviews Service
#
### Use this one for ReviewsService running as a separate process
# Note: use 5005 instead of 4004 in case of separate service
POST http://localhost:5005/reviews/Reviews
# POST http://localhost:4004/reviews/Reviews
Content-Type: application/json;IEEE754Compatible=true
{"subject":"201", "rating":"5", "title":"boo"}
### Direct Request to ReviewsService
# Note: use 5005 instead of 4004 in case of separate service
GET http://localhost:5005/reviews/Reviews?
# GET http://localhost:4004/reviews/Reviews?
# &$filter=subject eq '201'
### Request to CatalogService > delegated to ReviewsService
GET http://localhost:4004/browse/Books(201)/reviews
### Alternative OData URL
GET http://localhost:4004/browse/Books/201/reviews
###
GET http://localhost:4004/browse/Books(201)?
&$select=ID,title,rating
# &$expand=reviews
# Note: the latter only works in case of ReviewsService in same process

View File

@@ -1,13 +0,0 @@
Books = Books
Book = Book
ID = ID
Title = Title
Author = Author
AuthorID = Author ID
Stock = Stock
Name = Name
AuthorName = Author's Name
Authors = Authors
Order = Order
Orders = Orders
Price = Price

View File

@@ -1,13 +0,0 @@
Books = Bücher
Book = Buch
ID = ID
Title = Titel
Authors = Autoren
Author = Autor
AuthorID = ID des Autors
AuthorName = Name des Autors
Name = Name
Stock = Bestand
Order = Bestellung
Orders = Bestellungen
Price = Preis

View File

@@ -1,37 +0,0 @@
using AdminService from '../../srv/admin-service';
////////////////////////////////////////////////////////////////////////////
//
// Books Object Page
//
annotate AdminService.Books with @(
UI: {
Facets: [
{$Type: 'UI.ReferenceFacet', Label: '{i18n>General}', Target: '@UI.FieldGroup#General'},
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Details'},
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Admin}', Target: '@UI.FieldGroup#Admin'},
],
FieldGroup#General: {
Data: [
{Value: title},
{Value: author_ID},
{Value: descr},
]
},
FieldGroup#Details: {
Data: [
{Value: stock},
{Value: price},
{Value: currency_code, Label: '{i18n>Currency}'},
]
},
FieldGroup#Admin: {
Data: [
{Value: createdBy},
{Value: createdAt},
{Value: modifiedBy},
{Value: modifiedAt}
]
}
}
);

View File

@@ -1,22 +0,0 @@
sap.ui.define(["sap/fe/AppComponent"], ac => ac.extend("admin.Component", {
metadata:{ manifest:'json' }
}))
// sap.ui.define (["sap/ui/core/UIComponent"], ui5 => ui5.extend("bookshop.Component", {
// metadata: { manifest: "json" }
// }))
// sap.ui.define (["sap/ui/generic/app/AppComponent"], ui5 => ui5.extend("bookshop.Component", {
// metadata: { manifest: "json" }
// }))
// jQuery.sap.declare("bookshop.Component");
// sap.ui.getCore().loadLibrary("sap.ui.generic.app");
// jQuery.sap.require("sap.ui.generic.app.AppComponent");
// sap.ui.generic.app.AppComponent.extend("bookshop.Component", {
// metadata: {
// manifest: "json"
// }
// });
/* eslint no-undef:0 */

View File

@@ -1,11 +0,0 @@
# This is the resource bundle of itelo
# __ldi.translation.uuid=c3431418-9caf-11e8-98d0-529269fb1459
# JCI app descriptor contains lower case TITLE
appTitle=Bookshop Sample
# JCI app descriptor contains lower case DESCRIPTION
appSubTitle=CAP Sample Application
# JCI app descriptor contains lower case DESCRIPTION
appDescription=CDS Sample Service

View File

@@ -1,128 +0,0 @@
{
"_version": "1.8.0",
"sap.app": {
"id": "admin",
"type": "application",
"title": "Manage Books",
"description": "Sample Application",
"i18n": "i18n/i18n.properties",
"dataSources": {
"AdminService": {
"uri": "/admin/",
"type": "OData",
"settings": {
"odataVersion": "4.0"
}
}
},
"-sourceTemplate": {
"id": "ui5template.basicSAPUI5ApplicationProject",
"-id": "ui5template.smartTemplate",
"-version": "1.40.12"
}
},
"sap.ui5": {
"dependencies": {
"libs": {
"sap.fe": {}
}
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"uri": "i18n/i18n.properties"
},
"": {
"dataSource": "AdminService",
"settings": {
"synchronizationMode": "None",
"operationMode": "Server",
"autoExpandSelect" : true,
"earlyRequests": true,
"groupProperties": {
"default": {
"submit": "Auto"
}
}
}
}
},
"routing": {
"routes": [
{
"pattern": ":?query:",
"name": "BooksList",
"target": "BooksList"
},
{
"pattern": "Books({key}):?query:",
"name": "BooksDetails",
"target": "BooksDetails"
},
{
"pattern": "Books({key}/author({key2}):?query:",
"name": "AuthorsDetails",
"target": "AuthorsDetails"
}
],
"targets": {
"BooksList": {
"type": "Component",
"id": "BooksList",
"name": "sap.fe.templates.ListReport",
"options": {
"settings" : {
"entitySet" : "Books",
"navigation" : {
"Books" : {
"detail" : {
"route" : "BooksDetails"
}
}
}
}
}
},
"BooksDetails": {
"type": "Component",
"id": "BooksDetailsList",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings" : {
"entitySet" : "Books",
"navigation" : {
"Authors" : {
"detail" : {
"route" : "AuthorsDetails"
}
}
}
}
}
},
"AuthorsDetails": {
"type": "Component",
"id": "AuthorsDetailsList",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings" : {
"entitySet" : "Authors"
}
}
}
}
},
"contentDensities": {
"compact": true,
"cozy": true
}
},
"sap.ui": {
"technology": "UI5",
"fullWidth": false
},
"sap.fiori": {
"registrationIds": [],
"archeType": "transactional"
}
}

View File

@@ -1,47 +0,0 @@
using CatalogService from '../../srv/cat-service';
////////////////////////////////////////////////////////////////////////////
//
// Books Object Page
//
annotate CatalogService.Books with @(
UI: {
HeaderInfo: {
Description: {Value: author}
},
HeaderFacets: [
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Description}', Target: '@UI.FieldGroup#Descr'},
],
Facets: [
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Price'},
],
FieldGroup#Descr: {
Data: [
{Value: descr},
]
},
FieldGroup#Price: {
Data: [
{Value: price},
{Value: currency.symbol, Label: '{i18n>Currency}'},
]
},
}
);
////////////////////////////////////////////////////////////////////////////
//
// Books Object Page
//
annotate CatalogService.Books with @(
UI: {
SelectionFields: [ ID, price, currency_code ],
LineItem: [
{Value: title},
{Value: author, Label:'{i18n>Author}'},
{Value: price},
{Value: currency.symbol, Label:' '},
]
},
);

View File

@@ -1,22 +0,0 @@
sap.ui.define(["sap/fe/AppComponent"], ac => ac.extend("bookshop.Component", {
metadata:{ manifest:'json' }
}))
// sap.ui.define (["sap/ui/core/UIComponent"], ui5 => ui5.extend("bookshop.Component", {
// metadata: { manifest: "json" }
// }))
// sap.ui.define (["sap/ui/generic/app/AppComponent"], ui5 => ui5.extend("bookshop.Component", {
// metadata: { manifest: "json" }
// }))
// jQuery.sap.declare("bookshop.Component");
// sap.ui.getCore().loadLibrary("sap.ui.generic.app");
// jQuery.sap.require("sap.ui.generic.app.AppComponent");
// sap.ui.generic.app.AppComponent.extend("bookshop.Component", {
// metadata: {
// manifest: "json"
// }
// });
/* eslint no-undef:0 */

View File

@@ -1,11 +0,0 @@
# This is the resource bundle of itelo
# __ldi.translation.uuid=c3431418-9caf-11e8-98d0-529269fb1459
# JCI app descriptor contains lower case TITLE
appTitle=Bookshop Sample
# JCI app descriptor contains lower case DESCRIPTION
appSubTitle=CAP Sample Application
# JCI app descriptor contains lower case DESCRIPTION
appDescription=CDS Sample Service

View File

@@ -1,106 +0,0 @@
{
"_version": "1.8.0",
"sap.app": {
"id": "bookshop",
"type": "application",
"title": "Browse Books",
"description": "Sample Application",
"i18n": "i18n/i18n.properties",
"dataSources": {
"CatalogService": {
"uri": "/browse/",
"type": "OData",
"settings": {
"odataVersion": "4.0"
}
}
},
"-sourceTemplate": {
"id": "ui5template.basicSAPUI5ApplicationProject",
"-id": "ui5template.smartTemplate",
"-version": "1.40.12"
}
},
"sap.ui5": {
"dependencies": {
"libs": {
"sap.fe": {}
}
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"uri": "i18n/i18n.properties"
},
"": {
"dataSource": "CatalogService",
"settings": {
"synchronizationMode": "None",
"operationMode": "Server",
"autoExpandSelect": true,
"earlyRequests": true,
"groupProperties": {
"default": {
"submit": "Auto"
}
}
}
}
},
"routing": {
"routes": [
{
"pattern": ":?query:",
"name": "BooksList",
"target": "BooksList"
},
{
"pattern": "Books({key}):?query:",
"name": "BooksDetails",
"target": "BooksDetails"
}
],
"targets": {
"BooksList": {
"type": "Component",
"id": "BooksList",
"name": "sap.fe.templates.ListReport",
"options": {
"settings": {
"entitySet": "Books",
"navigation": {
"Books": {
"detail": {
"route": "BooksDetails"
}
}
}
}
}
},
"BooksDetails": {
"type": "Component",
"id": "BooksDetailsList",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings": {
"entitySet": "Books"
}
}
}
}
},
"contentDensities": {
"compact": true,
"cozy": true
}
},
"sap.ui": {
"technology": "UI5",
"fullWidth": false
},
"sap.fiori": {
"registrationIds": [],
"archeType": "transactional"
}
}

View File

@@ -1,74 +0,0 @@
/*
Common Annotations shared by all apps
*/
using { sap.capire.bookshop as my } from '../db/schema';
////////////////////////////////////////////////////////////////////////////
//
// Books Lists
//
annotate my.Books with @(
UI: {
Identification: [{Value:title}],
SelectionFields: [ ID, author_ID, price, currency_code ],
LineItem: [
{Value: ID},
{Value: title},
{Value: author.name, Label:'{i18n>Author}'},
{Value: stock},
{Value: price},
{Value: currency.symbol, Label:' '},
]
}
) {
author @ValueList.entity:'Authors';
};
annotate my.Authors with @(
UI: {
Identification: [{Value:name}],
}
);
////////////////////////////////////////////////////////////////////////////
//
// Books Details
//
annotate my.Books with @(
UI: {
HeaderInfo: {
TypeName: '{i18n>Book}',
TypeNamePlural: '{i18n>Books}',
Title: {Value: title},
Description: {Value: author.name}
},
}
);
////////////////////////////////////////////////////////////////////////////
//
// Books Elements
//
annotate my.Books with {
ID @title:'{i18n>ID}' @UI.HiddenFilter;
title @title:'{i18n>Title}';
author @title:'{i18n>AuthorID}';
price @title:'{i18n>Price}';
stock @title:'{i18n>Stock}';
descr @UI.MultiLineText;
}
////////////////////////////////////////////////////////////////////////////
//
// Authors Elements
//
annotate my.Authors with {
ID @title:'{i18n>ID}' @UI.HiddenFilter;
name @title:'{i18n>AuthorName}';
}

View File

@@ -1,55 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Bookshop</title>
<script>
window["sap-ushell-config"] = {
defaultRenderer: "fiori2",
applications: {
"browse-books": {
title: "Browse Books",
description: "... testing FE v42",
additionalInformation: "SAPUI5.Component=bookshop",
applicationType : "URL",
url: "/browse/webapp",
navigationMode: "embedded"
},
"manage-books": {
title: "Manage Books",
description: "... testing FE v42",
additionalInformation: "SAPUI5.Component=admin",
applicationType : "URL",
url: "/admin/webapp",
navigationMode: "embedded"
},
"manage-orders": {
title: "Manage Orders",
description: "... testing FE v42",
additionalInformation: "SAPUI5.Component=orders",
applicationType : "URL",
url: "/orders/webapp",
navigationMode: "embedded"
}
}
};
</script>
<script src="https://sapui5.hana.ondemand.com/test-resources/sap/ushell/bootstrap/sandbox.js"></script>
<script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-libs="sap.m, sap.ushell, sap.collaboration, sap.ui.layout"
data-sap-ui-compatVersion="edge"
data-sap-ui-theme="sap_fiori_3"
data-sap-ui-frameOptions="allow"
></script>
<script>
sap.ui.getCore().attachInit(()=> sap.ushell.Container.createRenderer().placeAt("content"))
</script>
</head>
<body class="sapUiBody" id="content"></body>
</html>

View File

@@ -1,8 +0,0 @@
/*
This model controls what gets served to Fiori frontends...
*/
using from './admin/fiori-service';
using from './browse/fiori-service';
using from './orders/fiori-service';
using from './common';

View File

@@ -1,118 +0,0 @@
using AdminService from '../../srv/admin-service';
annotate AdminService.Books with {
price @Common.FieldControl: #ReadOnly;
}
////////////////////////////////////////////////////////////////////////////
//
// Common
//
annotate AdminService.OrderItems with {
book @(
Common: {
Text: book.title,
FieldControl: #Mandatory
},
ValueList.entity:'Books',
);
amount @(
Common.FieldControl: #Mandatory
);
}
@odata.draft.enabled
annotate AdminService.Orders with @(
UI: {
////////////////////////////////////////////////////////////////////////////
//
// Lists of Orders
//
SelectionFields: [ createdAt, createdBy ],
LineItem: [
{Value: createdBy, Label:'Customer'},
{Value: createdAt, Label:'Date'}
],
////////////////////////////////////////////////////////////////////////////
//
// Order Details
//
HeaderInfo: {
TypeName: 'Order', TypeNamePlural: 'Orders',
Title: {
Label: 'Order number ', //A label is possible but it is not considered on the ObjectPage yet
Value: OrderNo
},
Description: {Value: createdBy}
},
Identification: [ //Is the main field group
{Value: createdBy, Label:'Customer'},
{Value: createdAt, Label:'Date'},
{Value: OrderNo },
],
HeaderFacets: [
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Created}', Target: '@UI.FieldGroup#Created'},
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Modified}', Target: '@UI.FieldGroup#Modified'},
],
Facets: [
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Details'},
{$Type: 'UI.ReferenceFacet', Label: '{i18n>OrderItems}', Target: 'Items/@UI.LineItem'},
],
FieldGroup#Details: {
Data: [
{Value: currency_code, Label:'Currency'}
]
},
FieldGroup#Created: {
Data: [
{Value: createdBy},
{Value: createdAt},
]
},
FieldGroup#Modified: {
Data: [
{Value: modifiedBy},
{Value: modifiedAt},
]
},
},
) {
createdAt @UI.HiddenFilter:false;
createdBy @UI.HiddenFilter:false;
};
//The enity types name is AdminService.my_bookshop_OrderItems
//The annotations below are not generated in edmx WHY?
annotate AdminService.OrderItems with @(
UI: {
HeaderInfo: {
TypeName: 'Order Item', TypeNamePlural: ' ',
Title: {
Value: book.title
},
Description: {Value: book.descr}
},
// There is no filterbar for items so the selctionfileds is not needed
SelectionFields: [ book_ID ],
////////////////////////////////////////////////////////////////////////////
//
// Lists of OrderItems
//
LineItem: [
{Value: book_ID, Label:'Book'},
//The following entry is only used to have the assoication followed in the read event
{Value: book.price, Label:'Book Price'},
{Value: amount, Label:'Quantity'},
],
Identification: [ //Is the main field group
//{Value: ID, Label:'ID'}, //A guid shouldn't be on the UI
{Value: book_ID, Label:'Book'},
{Value: amount, Label:'Amount'},
],
Facets: [
{$Type: 'UI.ReferenceFacet', Label: '{i18n>OrderItems}', Target: '@UI.Identification'},
],
},
);

View File

@@ -1,22 +0,0 @@
sap.ui.define(["sap/fe/AppComponent"], ac => ac.extend("orders.Component", {
metadata:{ manifest:'json' }
}))
// sap.ui.define (["sap/ui/core/UIComponent"], ui5 => ui5.extend("bookshop.Component", {
// metadata: { manifest: "json" }
// }))
// sap.ui.define (["sap/ui/generic/app/AppComponent"], ui5 => ui5.extend("bookshop.Component", {
// metadata: { manifest: "json" }
// }))
// jQuery.sap.declare("bookshop.Component");
// sap.ui.getCore().loadLibrary("sap.ui.generic.app");
// jQuery.sap.require("sap.ui.generic.app.AppComponent");
// sap.ui.generic.app.AppComponent.extend("bookshop.Component", {
// metadata: {
// manifest: "json"
// }
// });
/* eslint no-undef:0 */

View File

@@ -1,11 +0,0 @@
# This is the resource bundle of itelo
# __ldi.translation.uuid=c3431418-9caf-11e8-98d0-529269fb1459
# JCI app descriptor contains lower case TITLE
appTitle=Bookshop Sample
# JCI app descriptor contains lower case DESCRIPTION
appSubTitle=CAP Sample Application
# JCI app descriptor contains lower case DESCRIPTION
appDescription=CDS Sample Service

View File

@@ -1,170 +0,0 @@
{
"_version": "1.8.0",
"sap.app": {
"id": "orders",
"type": "application",
"title": "Manage Orders",
"description": "Sample Application",
"i18n": "i18n/i18n.properties",
"dataSources": {
"AdminService": {
"uri": "/admin/",
"type": "OData",
"settings": {
"odataVersion": "4.0"
}
}
},
"-sourceTemplate": {
"id": "ui5template.basicSAPUI5ApplicationProject",
"-id": "ui5template.smartTemplate",
"-version": "1.40.12"
}
},
"sap.ui5": {
"dependencies": {
"libs": {
"sap.fe": {}
}
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"uri": "i18n/i18n.properties"
},
"": {
"dataSource": "AdminService",
"settings": {
"synchronizationMode": "None",
"operationMode": "Server",
"autoExpandSelect" : true,
"earlyRequests": true,
"groupProperties": {
"default": {
"submit": "Auto"
}
}
}
}
},
"routing": {
"routes": [
{
"pattern": ":?query:",
"name": "OrdersList",
"target": "OrdersList"
},
{
"pattern": "Orders({key}):?query:",
"name": "OrdersDetails",
"target": "OrdersDetails"
},
{
"pattern": "Orders({boo})/Items({boo2}):?query:",
"name": "OrderItemsDetails",
"target": "OrderItemsDetails"
},
{
"pattern": "Books({key}):?query:",
"name": "BooksDetails",
"target": "BooksDetails"
}
],
"targets": {
"OrdersList": {
"type": "Component",
"id": "OrdersList",
"name": "sap.fe.templates.ListReport",
"options": {
"settings" : {
"entitySet" : "Orders",
"navigation" : {
"Orders" : {
"detail" : {
"route" : "OrdersDetails"
}
}
}
}
}
},
"OrdersDetails": {
"type": "Component",
"id": "OrdersDetails",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings" : {
"entitySet": "Orders",
"navigation" : {
"Items": {
"detail": {
"route": "OrderItemsDetails"
}
},
"book": {
"detail": {
"route": "BooksDetails"
}
},
"dummy": {
"detail": {
"route": "BooksDetails"
}
}
}
}
}
},
"OrderItemsDetails": {
"type": "Component",
"id": "OrderItemsDetails",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings" : {
"entitySet": "OrderItems"
}
}
},
"BooksDetails": {
"type": "Component",
"id": "BooksDetails",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings" : {
"entitySet": "Books",
"navigation": {
"author": {
"detail": {
"route": "AuthorsDetails"
}
}
}
}
}
},
"AuthorsDetails": {
"type": "Component",
"id": "AuthorsDetails",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings" : {
"entitySet": "Authors"
}
}
}
}
},
"contentDensities": {
"compact": true,
"cozy": true
}
},
"sap.ui": {
"technology": "UI5",
"fullWidth": false
},
"sap.fiori": {
"registrationIds": [],
"archeType": "transactional"
}
}

View File

@@ -1,5 +0,0 @@
ID;name;dateOfBirth;placeOfBirth;dateOfDeath;placeOfDeath
101;Emily Brontë;1818-07-30;Thornton, Yorkshire;1848-12-19;Haworth, Yorkshire
107;Charlotte Brontë;1818-04-21;Thornton, Yorkshire;1855-03-31;Haworth, Yorkshire
150;Edgar Allen Poe;1809-01-19;Boston, Massachusetts;1849-10-07;Baltimore, Maryland
170;Richard Carpenter;1929-08-14;Kings Lynn, Norfolk;2012-02-26;Hertfordshire, England
1 ID name dateOfBirth placeOfBirth dateOfDeath placeOfDeath
2 101 Emily Brontë 1818-07-30 Thornton, Yorkshire 1848-12-19 Haworth, Yorkshire
3 107 Charlotte Brontë 1818-04-21 Thornton, Yorkshire 1855-03-31 Haworth, Yorkshire
4 150 Edgar Allen Poe 1809-01-19 Boston, Massachusetts 1849-10-07 Baltimore, Maryland
5 170 Richard Carpenter 1929-08-14 King’s Lynn, Norfolk 2012-02-26 Hertfordshire, England

View File

@@ -1,6 +0,0 @@
ID;title;descr;author_ID;stock;price;currency_code
201;Wuthering Heights;"Wuthering Heights, Emily Brontë's only novel, was published in 1847 under the pseudonym ""Ellis Bell"". It was written between October 1845 and June 1846. Wuthering Heights and Anne Brontë's Agnes Grey were accepted by publisher Thomas Newby before the success of their sister Charlotte's novel Jane Eyre. After Emily's death, Charlotte edited the manuscript of Wuthering Heights and arranged for the edited version to be published as a posthumous second edition in 1850.";101;12;11.11;GBP
207;Jane Eyre;"Jane Eyre /ɛər/ (originally published as Jane Eyre: An Autobiography) is a novel by English writer Charlotte Brontë, published under the pen name ""Currer Bell"", on 16 October 1847, by Smith, Elder & Co. of London. The first American edition was published the following year by Harper & Brothers of New York. Primarily a bildungsroman, Jane Eyre follows the experiences of its eponymous heroine, including her growth to adulthood and her love for Mr. Rochester, the brooding master of Thornfield Hall. The novel revolutionised prose fiction in that the focus on Jane's moral and spiritual development is told through an intimate, first-person narrative, where actions and events are coloured by a psychological intensity. The book contains elements of social criticism, with a strong sense of Christian morality at its core and is considered by many to be ahead of its time because of Jane's individualistic character and how the novel approaches the topics of class, sexuality, religion and feminism.";107;11;12.34;GBP
251;The Raven;"""The Raven"" is a narrative poem by American writer Edgar Allan Poe. First published in January 1845, the poem is often noted for its musicality, stylized language, and supernatural atmosphere. It tells of a talking raven's mysterious visit to a distraught lover, tracing the man's slow fall into madness. The lover, often identified as being a student, is lamenting the loss of his love, Lenore. Sitting on a bust of Pallas, the raven seems to further distress the protagonist with its constant repetition of the word ""Nevermore"". The poem makes use of folk, mythological, religious, and classical references.";150;333;13.13;USD
252;Eleonora;"""Eleonora"" is a short story by Edgar Allan Poe, first published in 1842 in Philadelphia in the literary annual The Gift. It is often regarded as somewhat autobiographical and has a relatively ""happy"" ending.";150;555;14;USD
271;Catweazle;Catweazle is a British fantasy television series, starring Geoffrey Bayldon in the title role, and created by Richard Carpenter for London Weekend Television. The first series, produced and directed by Quentin Lawrence, was screened in the UK on ITV in 1970. The second series, directed by David Reid and David Lane, was shown in 1971. Each series had thirteen episodes, most but not all written by Carpenter, who also published two books based on the scripts.;170;22;15;EUR
1 ID title descr author_ID stock price currency_code
2 201 Wuthering Heights Wuthering Heights, Emily Brontë's only novel, was published in 1847 under the pseudonym "Ellis Bell". It was written between October 1845 and June 1846. Wuthering Heights and Anne Brontë's Agnes Grey were accepted by publisher Thomas Newby before the success of their sister Charlotte's novel Jane Eyre. After Emily's death, Charlotte edited the manuscript of Wuthering Heights and arranged for the edited version to be published as a posthumous second edition in 1850. 101 12 11.11 GBP
3 207 Jane Eyre Jane Eyre /ɛər/ (originally published as Jane Eyre: An Autobiography) is a novel by English writer Charlotte Brontë, published under the pen name "Currer Bell", on 16 October 1847, by Smith, Elder & Co. of London. The first American edition was published the following year by Harper & Brothers of New York. Primarily a bildungsroman, Jane Eyre follows the experiences of its eponymous heroine, including her growth to adulthood and her love for Mr. Rochester, the brooding master of Thornfield Hall. The novel revolutionised prose fiction in that the focus on Jane's moral and spiritual development is told through an intimate, first-person narrative, where actions and events are coloured by a psychological intensity. The book contains elements of social criticism, with a strong sense of Christian morality at its core and is considered by many to be ahead of its time because of Jane's individualistic character and how the novel approaches the topics of class, sexuality, religion and feminism. 107 11 12.34 GBP
4 251 The Raven "The Raven" is a narrative poem by American writer Edgar Allan Poe. First published in January 1845, the poem is often noted for its musicality, stylized language, and supernatural atmosphere. It tells of a talking raven's mysterious visit to a distraught lover, tracing the man's slow fall into madness. The lover, often identified as being a student, is lamenting the loss of his love, Lenore. Sitting on a bust of Pallas, the raven seems to further distress the protagonist with its constant repetition of the word "Nevermore". The poem makes use of folk, mythological, religious, and classical references. 150 333 13.13 USD
5 252 Eleonora "Eleonora" is a short story by Edgar Allan Poe, first published in 1842 in Philadelphia in the literary annual The Gift. It is often regarded as somewhat autobiographical and has a relatively "happy" ending. 150 555 14 USD
6 271 Catweazle Catweazle is a British fantasy television series, starring Geoffrey Bayldon in the title role, and created by Richard Carpenter for London Weekend Television. The first series, produced and directed by Quentin Lawrence, was screened in the UK on ITV in 1970. The second series, directed by David Reid and David Lane, was shown in 1971. Each series had thirteen episodes, most but not all written by Carpenter, who also published two books based on the scripts. 170 22 15 EUR

View File

@@ -1,4 +0,0 @@
ID;locale;title;descr
201;de;Sturmhöhe;Sturmhöhe (Originaltitel: Wuthering Heights) ist der einzige Roman der englischen Schriftstellerin Emily Brontë (18181848). Der 1847 unter dem Pseudonym Ellis Bell veröffentlichte Roman wurde vom viktorianischen Publikum weitgehend abgelehnt, heute gilt er als ein Klassiker der britischen Romanliteratur des 19. Jahrhunderts.
207;de;Jane Eyre;Jane Eyre. Eine Autobiographie (Originaltitel: Jane Eyre. An Autobiography), erstmals erschienen im Jahr 1847 unter dem Pseudonym Currer Bell, ist der erste veröffentlichte Roman der britischen Autorin Charlotte Brontë und ein Klassiker der viktorianischen Romanliteratur des 19. Jahrhunderts. Der Roman erzählt in Form einer Ich-Erzählung die Lebensgeschichte von Jane Eyre (ausgesprochen /ˌdʒeɪn ˈɛə/), die nach einer schweren Kindheit eine Stelle als Gouvernante annimmt und sich in ihren Arbeitgeber verliebt, jedoch immer wieder um ihre Freiheit und Selbstbestimmung kämpfen muss. Als klein, dünn, blass, stets schlicht dunkel gekleidet und mit strengem Mittelscheitel beschrieben, gilt die Heldin des Romans Jane Eyre nicht zuletzt aufgrund der Kino- und Fernsehversionen der melodramatischen Romanvorlage als die bekannteste englische Gouvernante der Literaturgeschichte
252;de;Eleonora;“Eleonora” ist eine Erzählung von Edgar Allan Poe. Sie wurde 1841 erstveröffentlicht. In ihr geht es um das Paradox der Treue in der Treulosigkeit.
1 ID locale title descr
2 201 de Sturmhöhe Sturmhöhe (Originaltitel: Wuthering Heights) ist der einzige Roman der englischen Schriftstellerin Emily Brontë (1818–1848). Der 1847 unter dem Pseudonym Ellis Bell veröffentlichte Roman wurde vom viktorianischen Publikum weitgehend abgelehnt, heute gilt er als ein Klassiker der britischen Romanliteratur des 19. Jahrhunderts.
3 207 de Jane Eyre Jane Eyre. Eine Autobiographie (Originaltitel: Jane Eyre. An Autobiography), erstmals erschienen im Jahr 1847 unter dem Pseudonym Currer Bell, ist der erste veröffentlichte Roman der britischen Autorin Charlotte Brontë und ein Klassiker der viktorianischen Romanliteratur des 19. Jahrhunderts. Der Roman erzählt in Form einer Ich-Erzählung die Lebensgeschichte von Jane Eyre (ausgesprochen /ˌdʒeɪn ˈɛə/), die nach einer schweren Kindheit eine Stelle als Gouvernante annimmt und sich in ihren Arbeitgeber verliebt, jedoch immer wieder um ihre Freiheit und Selbstbestimmung kämpfen muss. Als klein, dünn, blass, stets schlicht dunkel gekleidet und mit strengem Mittelscheitel beschrieben, gilt die Heldin des Romans Jane Eyre nicht zuletzt aufgrund der Kino- und Fernsehversionen der melodramatischen Romanvorlage als die bekannteste englische Gouvernante der Literaturgeschichte
4 252 de Eleonora “Eleonora” ist eine Erzählung von Edgar Allan Poe. Sie wurde 1841 erstveröffentlicht. In ihr geht es um das Paradox der Treue in der Treulosigkeit.

View File

@@ -1,4 +0,0 @@
ID;amount;parent_ID;book_ID;netAmount
58040e66-1dcd-4ffb-ab10-fdce32028b79;1;7e2f2640-6866-4dcf-8f4d-3027aa831cad;201;11.11
64e718c9-ff99-47f1-8ca3-950c850777d4;1;7e2f2640-6866-4dcf-8f4d-3027aa831cad;271;15
e9641166-e050-4261-bfee-d1e797e6cb7f;2;64e718c9-ff99-47f1-8ca3-950c850777d4;252;28
1 ID amount parent_ID book_ID netAmount
2 58040e66-1dcd-4ffb-ab10-fdce32028b79 1 7e2f2640-6866-4dcf-8f4d-3027aa831cad 201 11.11
3 64e718c9-ff99-47f1-8ca3-950c850777d4 1 7e2f2640-6866-4dcf-8f4d-3027aa831cad 271 15
4 e9641166-e050-4261-bfee-d1e797e6cb7f 2 64e718c9-ff99-47f1-8ca3-950c850777d4 252 28

View File

@@ -1,3 +0,0 @@
ID;modifiedAt;createdAt;createdBy;modifiedBy;OrderNo;currency_code
7e2f2640-6866-4dcf-8f4d-3027aa831cad;;2019-01-31;john.doe@test.com;;1;EUR
64e718c9-ff99-47f1-8ca3-950c850777d4;;2019-01-30;jane.doe@test.com;;2;EUR
1 ID modifiedAt createdAt createdBy modifiedBy OrderNo currency_code
2 7e2f2640-6866-4dcf-8f4d-3027aa831cad 2019-01-31 john.doe@test.com 1 EUR
3 64e718c9-ff99-47f1-8ca3-950c850777d4 2019-01-30 jane.doe@test.com 2 EUR

View File

@@ -1,7 +0,0 @@
code;symbol;name;descr
EUR;€;Euro;European Euro
USD;$;US Dollar;United States Dollar
CAD;$;Canadian Dollar;Canadian Dollar
AUD;$;Australian Dollar;Australian Dollar
GBP;£;Pound;Great Britain Pound
ILS;₪;Shekel;Israeli New Shekel
1 code symbol name descr
2 EUR Euro European Euro
3 USD $ US Dollar United States Dollar
4 CAD $ Canadian Dollar Canadian Dollar
5 AUD $ Australian Dollar Australian Dollar
6 GBP £ Pound Great Britain Pound
7 ILS Shekel Israeli New Shekel

View File

@@ -1,13 +0,0 @@
code;locale;name;descr
EUR;de;Euro;European Euro
USD;de;US-Dollar;United States Dollar
CAD;de;Kanadischer Dollar;Kanadischer Dollar
AUD;de;Australischer Dollar;Australischer Dollar
GBP;de;Pfund;Britische Pfund
ILS;de;Schekel;Israelische Schekel
EUR;fr;euro;de la Zone euro
USD;fr;dollar;dollar des États-Unis
CAD;fr;dollar canadien;dollar canadien
AUD;fr;dollar australien;dollar australien
GBP;fr;livre sterling;pound sterling
ILS;fr;Shekel;shekel israelien
1 code locale name descr
2 EUR de Euro European Euro
3 USD de US-Dollar United States Dollar
4 CAD de Kanadischer Dollar Kanadischer Dollar
5 AUD de Australischer Dollar Australischer Dollar
6 GBP de Pfund Britische Pfund
7 ILS de Schekel Israelische Schekel
8 EUR fr euro de la Zone euro
9 USD fr dollar dollar des États-Unis
10 CAD fr dollar canadien dollar canadien
11 AUD fr dollar australien dollar australien
12 GBP fr livre sterling pound sterling
13 ILS fr Shekel shekel israelien

View File

@@ -1,35 +0,0 @@
namespace sap.capire.bookshop;
using { Currency, managed, cuid } from '@sap/cds/common';
entity Books : managed {
key ID : Integer;
title : localized String(111);
descr : localized String(1111);
author : Association to Authors;
stock : Integer;
price : Decimal(9,2);
currency : Currency;
}
entity Authors : managed {
key ID : Integer;
name : String(111);
dateOfBirth : Date;
dateOfDeath : Date;
placeOfBirth : String;
placeOfDeath : String;
books : Association to many Books on books.author = $self;
}
entity Orders : cuid, managed {
OrderNo : String @title:'Order Number'; //> readable key
Items : Composition of many OrderItems on Items.parent = $self;
total : Decimal(9,2) @readonly;
currency : Currency;
}
entity OrderItems : cuid {
parent : Association to Orders;
book : Association to Books;
amount : Integer;
netAmount : Decimal(9,2);
}

View File

@@ -1,21 +0,0 @@
{
"name": "@sap/capire-bookshop",
"version": "1.0.0",
"description": "A simple bookshop application, build in a self-contained all-in-one fashion, i.e. w/o reusing other packages.",
"license": "SAP SAMPLE CODE LICENSE",
"dependencies": {
"@sap/cds": "latest",
"express": "*"
},
"scripts": {
"start": "cds run --in-memory?",
"watch": "cds watch"
},
"cds": {
"requires": {
"db": {
"kind": "sql"
}
}
}
}

View File

@@ -1,7 +0,0 @@
using { sap.capire.bookshop as my } from '../db/schema';
service AdminService @(_requires:'authenticated-user') {
entity Books as projection on my.Books;
entity Authors as projection on my.Authors;
entity Orders as select from my.Orders;
}

View File

@@ -1,13 +0,0 @@
using { sap.capire.bookshop as my } from '../db/schema';
@path:'/browse'
service CatalogService {
@readonly entity Books as SELECT from my.Books {*,
author.name as author
} excluding { createdBy, modifiedBy };
@requires_: 'authenticated-user'
@insertonly entity Orders as projection on my.Orders;
}

View File

@@ -1,26 +0,0 @@
const cds = require('@sap/cds')
const { Books } = cds.entities
/** Service implementation for CatalogService */
module.exports = cds.service.impl(function() {
this.after ('READ', 'Books', each => each.stock > 111 && _addDiscount2(each,11))
this.before ('CREATE', 'Orders', _reduceStock)
})
/** Add some discount for overstocked books */
function _addDiscount2 (each,discount) {
each.title += ` -- ${discount}% discount!`
}
/** Reduce stock of ordered books if available stock suffices */
async function _reduceStock (req) {
const { Items: OrderItems } = req.data
return cds.transaction(req) .run (()=> OrderItems.map (order =>
UPDATE (Books) .set ('stock -=', order.amount)
.where ('ID =', order.book_ID) .and ('stock >=', order.amount)
)) .then (all => all.forEach ((affectedRows,i) => {
if (affectedRows === 0) req.error (409,
`${OrderItems[i].amount} exceeds stock for book #${OrderItems[i].book_ID}`
)
}))
}

View File

@@ -1,18 +0,0 @@
### Service Document
GET http://localhost:4004/browse
### Service $metadata document
GET http://localhost:4004/browse/$metadata
### Browsing Books
GET http://localhost:4004/browse/Books?
# &$select=title,author
# &$expand=currency
# &sap-language=de
### Browsing Authors
GET http://localhost:4004/admin/Authors?
# &$select=name,dateOfBirth,placeOfBirth
# &$expand=books($select=title;$expand=currency)
# &$filter=ID eq 101
# &sap-language=de

View File

@@ -1,18 +0,0 @@
### List Books with their current stocks
GET http://localhost:4004/admin/Books?$select=ID,stock
### List all Orders
GET http://localhost:4004/admin/Orders?
&$expand=Items
### Submit Orders
POST http://localhost:4004/browse/Orders
Content-Type: application/json
{ "OrderNo":"2019-09...", "Items":[
{ "book_ID":201, "amount":5 },
{ "book_ID":207, "amount":3 }
]}
# Sending this three times should result in a 409: 5 exceeds stock for book #201

View File

@@ -1,5 +0,0 @@
ID;firstname;lastname;dateOfBirth;placeOfBirth;dateOfDeath;placeOfDeath
101;Emily;Brontë;1818-07-30;Thornton, Yorkshire;1848-12-19;Haworth, Yorkshire
107;Charlotte;Brontë;1818-04-21;Thornton, Yorkshire;1855-03-31;Haworth, Yorkshire
150;Edgar Allen;Poe;1809-01-19;Boston, Massachusetts;1849-10-07;Baltimore, Maryland
170;Richard;Carpenter;1929-08-14;Kings Lynn, Norfolk;2012-02-26;Hertfordshire, England
1 ID firstname lastname dateOfBirth placeOfBirth dateOfDeath placeOfDeath
2 101 Emily Brontë 1818-07-30 Thornton, Yorkshire 1848-12-19 Haworth, Yorkshire
3 107 Charlotte Brontë 1818-04-21 Thornton, Yorkshire 1855-03-31 Haworth, Yorkshire
4 150 Edgar Allen Poe 1809-01-19 Boston, Massachusetts 1849-10-07 Baltimore, Maryland
5 170 Richard Carpenter 1929-08-14 King’s Lynn, Norfolk 2012-02-26 Hertfordshire, England

View File

@@ -1,11 +0,0 @@
ID;parent_ID;name
1;;Poetry
2;;Biography
3;;Fantasy
4;;Science Fiction
5;;Romance
6;;Mystery
7;;Thriller
8;;Dystopia
9;;Tragedy
10;;Novel
1 ID parent_ID name
2 1 Poetry
3 2 Biography
4 3 Fantasy
5 4 Science Fiction
6 5 Romance
7 6 Mystery
8 7 Thriller
9 8 Dystopia
10 9 Tragedy
11 10 Novel

View File

@@ -1,6 +0,0 @@
ID;title;descr;author_ID;stock;price;currency_code;category_ID
201;Wuthering Heights;"Wuthering Heights, Emily Brontë's only novel, was published in 1847 under the pseudonym ""Ellis Bell"". It was written between October 1845 and June 1846. Wuthering Heights and Anne Brontë's Agnes Grey were accepted by publisher Thomas Newby before the success of their sister Charlotte's novel Jane Eyre. After Emily's death, Charlotte edited the manuscript of Wuthering Heights and arranged for the edited version to be published as a posthumous second edition in 1850.";101;12;11.11;GBP;9
207;Jane Eyre;"Jane Eyre /ɛər/ (originally published as Jane Eyre: An Autobiography) is a novel by English writer Charlotte Brontë, published under the pen name ""Currer Bell"", on 16 October 1847, by Smith, Elder & Co. of London. The first American edition was published the following year by Harper & Brothers of New York. Primarily a bildungsroman, Jane Eyre follows the experiences of its eponymous heroine, including her growth to adulthood and her love for Mr. Rochester, the brooding master of Thornfield Hall. The novel revolutionised prose fiction in that the focus on Jane's moral and spiritual development is told through an intimate, first-person narrative, where actions and events are coloured by a psychological intensity. The book contains elements of social criticism, with a strong sense of Christian morality at its core and is considered by many to be ahead of its time because of Jane's individualistic character and how the novel approaches the topics of class, sexuality, religion and feminism.";107;11;12.34;GBP;10
251;The Raven;"“The Raven"" is a narrative poem by American writer Edgar Allan Poe. First published in January 1845, the poem is often noted for its musicality, stylized language, and supernatural atmosphere. It tells of a talking raven's mysterious visit to a distraught lover, tracing the man's slow fall into madness. The lover, often identified as being a student, is lamenting the loss of his love, Lenore. Sitting on a bust of Pallas, the raven seems to further distress the protagonist with its constant repetition of the word ""Nevermore"". The poem makes use of folk, mythological, religious, and classical references.";150;333;13.13;USD;1
252;Eleonora;"""Eleonora"" is a short story by Edgar Allan Poe, first published in 1842 in Philadelphia in the literary annual The Gift. It is often regarded as somewhat autobiographical and has a relatively ""happy"" ending.";150;555;14;USD;5
271;Catweazle;Catweazle is a British fantasy television series, starring Geoffrey Bayldon in the title role, and created by Richard Carpenter for London Weekend Television. The first series, produced and directed by Quentin Lawrence, was screened in the UK on ITV in 1970. The second series, directed by David Reid and David Lane, was shown in 1971. Each series had thirteen episodes, most but not all written by Carpenter, who also published two books based on the scripts.;170;22;15;EUR;3
1 ID title descr author_ID stock price currency_code category_ID
2 201 Wuthering Heights Wuthering Heights, Emily Brontë's only novel, was published in 1847 under the pseudonym "Ellis Bell". It was written between October 1845 and June 1846. Wuthering Heights and Anne Brontë's Agnes Grey were accepted by publisher Thomas Newby before the success of their sister Charlotte's novel Jane Eyre. After Emily's death, Charlotte edited the manuscript of Wuthering Heights and arranged for the edited version to be published as a posthumous second edition in 1850. 101 12 11.11 GBP 9
3 207 Jane Eyre Jane Eyre /ɛər/ (originally published as Jane Eyre: An Autobiography) is a novel by English writer Charlotte Brontë, published under the pen name "Currer Bell", on 16 October 1847, by Smith, Elder & Co. of London. The first American edition was published the following year by Harper & Brothers of New York. Primarily a bildungsroman, Jane Eyre follows the experiences of its eponymous heroine, including her growth to adulthood and her love for Mr. Rochester, the brooding master of Thornfield Hall. The novel revolutionised prose fiction in that the focus on Jane's moral and spiritual development is told through an intimate, first-person narrative, where actions and events are coloured by a psychological intensity. The book contains elements of social criticism, with a strong sense of Christian morality at its core and is considered by many to be ahead of its time because of Jane's individualistic character and how the novel approaches the topics of class, sexuality, religion and feminism. 107 11 12.34 GBP 10
4 251 The Raven “The Raven" is a narrative poem by American writer Edgar Allan Poe. First published in January 1845, the poem is often noted for its musicality, stylized language, and supernatural atmosphere. It tells of a talking raven's mysterious visit to a distraught lover, tracing the man's slow fall into madness. The lover, often identified as being a student, is lamenting the loss of his love, Lenore. Sitting on a bust of Pallas, the raven seems to further distress the protagonist with its constant repetition of the word "Nevermore". The poem makes use of folk, mythological, religious, and classical references. 150 333 13.13 USD 1
5 252 Eleonora "Eleonora" is a short story by Edgar Allan Poe, first published in 1842 in Philadelphia in the literary annual The Gift. It is often regarded as somewhat autobiographical and has a relatively "happy" ending. 150 555 14 USD 5
6 271 Catweazle Catweazle is a British fantasy television series, starring Geoffrey Bayldon in the title role, and created by Richard Carpenter for London Weekend Television. The first series, produced and directed by Quentin Lawrence, was screened in the UK on ITV in 1970. The second series, directed by David Reid and David Lane, was shown in 1971. Each series had thirteen episodes, most but not all written by Carpenter, who also published two books based on the scripts. 170 22 15 EUR 3

View File

@@ -1,4 +0,0 @@
ID;locale;title;descr
201;de;Sturmhöhe;Sturmhöhe (Originaltitel: Wuthering Heights) ist der einzige Roman der englischen Schriftstellerin Emily Brontë (18181848). Der 1847 unter dem Pseudonym Ellis Bell veröffentlichte Roman wurde vom viktorianischen Publikum weitgehend abgelehnt, heute gilt er als ein Klassiker der britischen Romanliteratur des 19. Jahrhunderts.
207;de;Jane Eyre;Jane Eyre. Eine Autobiographie (Originaltitel: Jane Eyre. An Autobiography), erstmals erschienen im Jahr 1847 unter dem Pseudonym Currer Bell, ist der erste veröffentlichte Roman der britischen Autorin Charlotte Brontë und ein Klassiker der viktorianischen Romanliteratur des 19. Jahrhunderts. Der Roman erzählt in Form einer Ich-Erzählung die Lebensgeschichte von Jane Eyre (ausgesprochen /ˌdʒeɪn ˈɛə/), die nach einer schweren Kindheit eine Stelle als Gouvernante annimmt und sich in ihren Arbeitgeber verliebt, jedoch immer wieder um ihre Freiheit und Selbstbestimmung kämpfen muss. Als klein, dünn, blass, stets schlicht dunkel gekleidet und mit strengem Mittelscheitel beschrieben, gilt die Heldin des Romans Jane Eyre nicht zuletzt aufgrund der Kino- und Fernsehversionen der melodramatischen Romanvorlage als die bekannteste englische Gouvernante der Literaturgeschichte
252;de;Eleonora;“Eleonora” ist eine Erzählung von Edgar Allan Poe. Sie wurde 1841 erstveröffentlicht. In ihr geht es um das Paradox der Treue in der Treulosigkeit.
1 ID locale title descr
2 201 de Sturmhöhe Sturmhöhe (Originaltitel: Wuthering Heights) ist der einzige Roman der englischen Schriftstellerin Emily Brontë (1818–1848). Der 1847 unter dem Pseudonym Ellis Bell veröffentlichte Roman wurde vom viktorianischen Publikum weitgehend abgelehnt, heute gilt er als ein Klassiker der britischen Romanliteratur des 19. Jahrhunderts.
3 207 de Jane Eyre Jane Eyre. Eine Autobiographie (Originaltitel: Jane Eyre. An Autobiography), erstmals erschienen im Jahr 1847 unter dem Pseudonym Currer Bell, ist der erste veröffentlichte Roman der britischen Autorin Charlotte Brontë und ein Klassiker der viktorianischen Romanliteratur des 19. Jahrhunderts. Der Roman erzählt in Form einer Ich-Erzählung die Lebensgeschichte von Jane Eyre (ausgesprochen /ˌdʒeɪn ˈɛə/), die nach einer schweren Kindheit eine Stelle als Gouvernante annimmt und sich in ihren Arbeitgeber verliebt, jedoch immer wieder um ihre Freiheit und Selbstbestimmung kämpfen muss. Als klein, dünn, blass, stets schlicht dunkel gekleidet und mit strengem Mittelscheitel beschrieben, gilt die Heldin des Romans Jane Eyre nicht zuletzt aufgrund der Kino- und Fernsehversionen der melodramatischen Romanvorlage als die bekannteste englische Gouvernante der Literaturgeschichte
4 252 de Eleonora “Eleonora” ist eine Erzählung von Edgar Allan Poe. Sie wurde 1841 erstveröffentlicht. In ihr geht es um das Paradox der Treue in der Treulosigkeit.

View File

@@ -1,18 +0,0 @@
namespace sap.capire.bookstore;
// We reuse Products, which are Books in our domain
using { sap.capire.products.Products as Books } from '@sap/capire-products';
extend Books with {
author : Association to Authors;
rating : Decimal(2,1);
}
// We reuse aspect Person to define Authors
using { sap.capire.contacts.Person } from '@sap/capire-contacts';
entity Authors : Person {
key ID : UUID;
books : Association to many Books on books.author = $self;
}
// we use enhanced currencies code lists
using from '@sap/capire-currencies';

View File

@@ -1,48 +0,0 @@
{
"name": "@sap/capire-bookstore",
"version": "1.0.0",
"description": "A variant of the bookshop application, built on top of products-service and common reuse packages.",
"repository": "https://github.com/SAP-samples/cloud-cap-samples.git",
"license": "SAP SAMPLE CODE LICENSE",
"dependencies": {
"@sap/capire-products": "^1.0.0",
"@sap/capire-reviews": "^1.0.0",
"@sap/capire-orders": "^1.0.0",
"@sap/capire-media": "^1.0.0",
"@sap/capire-users": "^1.0.0",
"@sap/capire-contacts": "^1.0.0",
"@sap/capire-currencies": "^1.0.0",
"@sap/cds": "latest",
"express": "*"
},
"bundledDependencies": [
"@sap/capire-products",
"@sap/capire-reviews",
"@sap/capire-orders",
"@sap/capire-media",
"@sap/capire-users",
"@sap/capire-contacts",
"@sap/capire-currencies"
],
"files": [
"app", "srv", "db"
],
"scripts": {
"start": "cds run --in-memory?",
"watch": "cds watch"
},
"cds": {
"requires": {
"db": {
"kind": "sql"
},
"sap.capire.media.MediaServer": {
"kind": "rest"
},
"sap.capire.reviews.ReviewsService": {
"model": "@sap/capire-reviews",
"kind": "odata"
}
}
}
}

View File

@@ -1,12 +0,0 @@
//----------------------
// workarounds -> should be done by @cds-compiler
annotate cds.UUID with @odata.Type: 'Edm.String';
using from '@sap/capire-products';
annotate sap.capire.products.Products with { texts @odata.contained }
annotate sap.capire.products.Categories with { texts @odata.contained }
annotate sap.capire.reviews.ReviewsService with @imported;
annotate sap.capire.reviews.Reviews with @cds.persistence.skip;
annotate sap.capire.reviews.Likes with @cds.persistence.skip;

View File

@@ -1,35 +0,0 @@
namespace sap.capire.bookstore;
// Service for all users to browse books
using { sap.capire.products } from '../db/schema';
service CatalogService @(path:'browse'){
@readonly entity Books as select from products.Products { *,
author.firstname ||' '|| author.lastname as author : String,
category.name as genre,
} excluding { createdBy, modifiedBy };
@readonly entity Genres as projection on products.Categories;
}
// Reuse AdminService from @sap/capire-products...
using { sap.capire.products.AdminService } from '@sap/capire-products';
using { sap.capire.bookstore as my } from '../db/schema';
extend service AdminService with @(impl:'srv/services.js') {
entity Authors as projection on my.Authors;
}
// Adding reviews via @sap/capire-reviews service
using { sap.capire.reviews.ReviewsService as external } from '@sap/capire-reviews';
extend service CatalogService with {
@readonly entity Reviews as projection on external.Reviews;
}
// Adding images via @sap/capire-media service
using from '@sap/capire-media';
// using from '@sap/capire-orders';
// using from '@sap/capire-users';

View File

@@ -1,38 +0,0 @@
const cds = require('@sap/cds')
module.exports['sap.capire.bookstore.CatalogService'] = cds.service.impl (async (srv) => {
const ReviewsService = await cds.connect.to ('sap.capire.reviews.ReviewsService')
const { Reviews } = ReviewsService.entities
const { Books } = srv.entities
// delegate requests to reviews service
srv.on('READ', 'Reviews', async (req) => {
const { SELECT } = cds.ql(req)
const results = await SELECT.from (Reviews)
// TODO: Should actually be using .where of fluent query API
if (req.query.SELECT.where) {
return results.filter (row => row.subject === req.query.SELECT.where[2].val)
}
return results
})
// react on event messages from reviews service
ReviewsService.on ('reviewed', (msg) => {
console.debug ('> received message:', msg.event, msg.data)
const {subject,rating} = msg.data
const tx = cds.transaction(msg)
return tx.run (UPDATE(Books).set({rating}) .where ({ID:subject})) //.then (console.log)
})
})
// FIXME: pls remove this...
process.env.destinations = JSON.stringify([{
name: 'reviewsDest',
url: 'http://localhost:4005/reviews',
username: 'dummy',
password: 'dummy'
}])

View File

@@ -1,7 +0,0 @@
using { sap.capire.products as my } from '../db/schema';
service BooksService {
entity Books as SELECT from my.Products;
}
annotate cds.UUID with @odata.Type: 'Edm.String';

View File

@@ -1,190 +0,0 @@
const cds = require ('@sap/cds')
describe('Localized data on db level', ()=>{
let db, Books
it ('should deploy the db schema to sqlite in-memory', async()=>{
db = await cds.deploy (__dirname+'/books') .to ('sqlite::memory:')
expect (db.model) .toBeDefined()
Books = db.entities('sap.capire.products').Products
expect (Books) .toBeDefined()
})
it ('should list all books with default language', async ()=>{
const books = await SELECT.from (Books, b=>b.title)
expect (books) .toMatchObject([
{ title: 'Wuthering Heights' },
{ title: 'Jane Eyre' },
{ title: 'The Raven' },
{ title: 'Eleonora' },
{ title: 'Catweazle' }
])
})
it ('should read translated texts from Books_texts', async ()=>{
const texts = await SELECT ('locale','title').from (Books+'_texts')
expect (texts) .toMatchObject ([
{ locale: 'de', title: 'Sturmhöhe' },
{ locale: 'de', title: 'Jane Eyre' },
{ locale: 'de', title: 'Eleonora' }
])
})
it ('should read translated texts from Books.texts', async ()=>{
const book = await SELECT.one.from (Books, b=>{
b.ID, b.title, b.texts(t=> {
t.locale, t.title
})
}) .where ({title:'Wuthering Heights'})
expect (book) .toMatchObject ({
title: 'Wuthering Heights', texts:[
{locale:'de',title:'Sturmhöhe'}
]
})
})
it ('should insert books with translated texts', async ()=>{
const n = await INSERT.into (Books) .entries ({ ID:444, title:'A New Book', texts:[
{locale:'de', title:'Ein Neues Buch'},
{locale:'fr', title:'Un Nouveau Livre'},
]})
expect(n).toBe(3)
})
it ('should delete books w/ cascaded delete to texts', async()=>{
const n = await DELETE.from(Books) .where ({ID:444})
expect(n).toBe(3)
})
})
describe('Localized data on service level', ()=>{
let srv, Books
it ('should serve BooksService', async()=>{
srv = await cds.serve('BooksService').from(__dirname+'/books')
expect (srv.model) .toBeDefined()
Books = srv.entities.Books
expect (Books) .toBeDefined()
})
it ('should list all books with default language', async ()=>{
const books = await srv.read (Books, b=>b.title)
expect (books) .toMatchObject([
{ title: 'Wuthering Heights' },
{ title: 'Jane Eyre' },
{ title: 'The Raven' },
{ title: 'Eleonora' },
{ title: 'Catweazle' }
])
})
it ('should read Books with translated texts', async ()=>{
const book = await srv.run (
SELECT.from (Books, b=>{ b.ID, b.title, b.texts(t=> {
t.locale, t.title
})}) .where ({title:'Wuthering Heights'})
)
expect (book) .toMatchObject ([{
title: 'Wuthering Heights', texts:[
{locale:'de',title:'Sturmhöhe'}
]
}])
})
it ('should do the same with convenient method', async ()=>{
const book = await srv.read (Books, b=>{ b.ID, b.title, b.texts(t=> {
t.locale, t.title
})}) .where ({title:'Wuthering Heights'})
expect (book) .toMatchObject ([{
title: 'Wuthering Heights', texts:[
{locale:'de',title:'Sturmhöhe'}
]
}])
})
it ('should read single Book with translated texts', async ()=>{
const book = await srv.run (
SELECT.one.from (Books, b=>{ b.ID, b.title, b.texts(t=> {
t.locale, t.title
})}) .where ({title:'Wuthering Heights'})
)
expect (book) .toMatchObject ({
title: 'Wuthering Heights', texts:[
{locale:'de',title:'Sturmhöhe'}
]
})
})
it ('should insert books with translated texts', async ()=>{
const book = { ID:444, title:'A New Book', texts:[
{locale:'de', title:'Ein Neues Buch'},
{locale:'fr', title:'Un Nouveau Livre'},
]}
const response = await srv.create (Books) .entries (book)
expect(response).toMatchObject(book)
})
it ('should delete books w/ cascaded delete to texts', async()=>{
await srv.delete('Books') .where ({ID:444})
})
})
describe('Localized data on OData level', () => {
const app = require('express')()
const srv = require('supertest')(app)
it ('should serve BooksService', async ()=>{
await cds.serve('BooksService').from(__dirname+'/books') .in (app)
})
it('should list all books with default language', async () => {
const books = await srv.get('/books/Books/201/title')
expect(books.body).toMatchObject({'value': 'Wuthering Heights'})
})
it('should read books with translated texts', async () => {
const books = await srv.get('/books/Books/201/title'). set('Accept-Language', 'de')
expect(books.body).toMatchObject({value: 'Sturmhöhe'})
})
it('should expand translated texts in Book', async () => {
const books = await srv. get('/books/Books/201?$select=title&$expand=texts($select=locale,title)')
expect(books.body).toMatchObject({
title: 'Wuthering Heights',
texts: [
{ locale: 'de', title: 'Sturmhöhe', },
],
})
})
const book = {
title: 'New Book', descr: 'Lorem Ipsum',
texts: [
{ locale: 'de', title: 'Neues Buch', descr: 'Dolor sit amet' },
{ locale: 'fr', title: 'Nouveau Livre', descr: 'consetetur sadipscing elitr' }
],
}
it('should insert books with translated texts', async () => {
const {body} = await srv.post('/books/Books').send(book)
expect(body).toMatchObject(book)
book.ID = body.ID
})
it ('should read the newly created book', async()=>{
const {body} = await srv.get('/books/Books/'+book.ID+'?$expand=texts').send(book)
expect(body).toMatchObject(book)
})
it ('should delete books w/ cascaded delete to texts', async()=>{
await srv.delete('/books/Books/'+book.ID)
.expect(204)
})
})

View File

@@ -1,37 +0,0 @@
using { sap.capire.contacts.PostalAddress } from './schema';
using { sap } from '@sap/cds/common';
namespace sap.capire.contacts;
/**
* The Code Lists below are designed as optional extensions to
* the base schema. Switch them on by adding an Association to
* one of the code list entities in your models or by:
* annotate sap.common.Countries with @cds.persistence.skip:false;
*/
entity Countries as select from sap.common.Countries;
extend sap.common.Countries {
regions : Composition of many Regions on regions._parent = $self.code;
}
entity Regions : sap.common.CodeList {
key code : String(5); // ISO 3166-2 alpha5 codes, e.g. DE-BW
children : Composition of many Regions on children._parent = $self.code;
cities : Composition of many Cities on cities.region = $self;
_parent : String(11);
}
entity Cities : sap.common.CodeList {
key code : String(11);
region : Association to Regions;
districts : Composition of many Districts on districts.city = $self;
}
entity Districts : sap.common.CodeList {
key code : String(11);
city : Association to Cities;
}
annotate PostalAddress with {
district @ref: sap.capire.contacts.Districts;
city @ref: sap.capire.contacts.Cities;
region @ref: sap.capire.contacts.Regions;
country @ref: sap.capire.contacts.Countries;
}

View File

@@ -1,12 +0,0 @@
code;name;descr
AU;Australia;Commonwealth of Australia
CA;Canada;Canada
CN;China;People's Republic of China (PRC)
FR;France;French Republic
DE;Germany;Federal Republic of Germany
IN;India;Republic of India
IL;Israel;State of Israel
MM;Myanmar;Republic of the Union of Myanmar
GB;United Kingdom;United Kingdom of Great Britain and Northern Ireland
US;United States;United States of America (USA)
EU;European Union;European Union
1 code name descr
2 AU Australia Commonwealth of Australia
3 CA Canada Canada
4 CN China People's Republic of China (PRC)
5 FR France French Republic
6 DE Germany Federal Republic of Germany
7 IN India Republic of India
8 IL Israel State of Israel
9 MM Myanmar Republic of the Union of Myanmar
10 GB United Kingdom United Kingdom of Great Britain and Northern Ireland
11 US United States United States of America (USA)
12 EU European Union European Union

View File

@@ -1,12 +0,0 @@
code;locale;name;descr
AU;de;Australien;Commonwealth Australien
CA;de;Kanada;Canada
CN;de;China;Volksrepublik China
FR;de;Frankreich;Republik Frankreich
DE;de;Deutschland;Bundesrepublik Deutschland
IN;de;Indien;Republik Indien
IL;de;Israel;Staat Israel
MM;de;Myanmar;Republik der Union Myanmar
GB;de;Vereinigtes Königreich;Vereinigtes Königreich Großbritannien und Nordirland
US;de;Vereinigte Staaten;Vereinigte Staaten von Amerika
EU;de;Europäische Union;Europäische Union
1 code locale name descr
2 AU de Australien Commonwealth Australien
3 CA de Kanada Canada
4 CN de China Volksrepublik China
5 FR de Frankreich Republik Frankreich
6 DE de Deutschland Bundesrepublik Deutschland
7 IN de Indien Republik Indien
8 IL de Israel Staat Israel
9 MM de Myanmar Republik der Union Myanmar
10 GB de Vereinigtes Königreich Vereinigtes Königreich Großbritannien und Nordirland
11 US de Vereinigte Staaten Vereinigte Staaten von Amerika
12 EU de Europäische Union Europäische Union

View File

@@ -1,58 +0,0 @@
namespace sap.capire.contacts;
//--------------------------------------------------------------------------
// Aspects
aspect Organization {
orgname : String(111);
}
aspect Person {
firstname : String(111);
lastname : String(111);
prefix : String(11);
suffix : String(11);
middle : String(11);
dateOfBirth : Date; placeOfBirth : String;
dateOfDeath : Date; placeOfDeath : String;
}
aspect PostalAddress {
street : String(222) @multiline;
postCode : String(11);
district : String(111);
city : String(111);
region : String(111);
country : String(111);
}
aspect ContactOptions {
email : String @JSON:[{ kind:String, address: EmailAddress }];
phone : String @JSON:[{ kind:String, number: PhoneNumber }];
// phone : array of { kind:String; number: PhoneNumber };
// addresses : Composition of many PostalAddress;
}
type EmailAddress : String;
type PhoneNumber : String;
//--------------------------------------------------------------------------
// Entities
@cds.persistence.skip:'if-unused'
entity Contacts : Person, Organization, ContactOptions {
key ID : UUID;
isOrg : Boolean;
addresses : Composition of many PostalAddresses on addresses.contact = $self;
}
@cds.persistence.skip:'if-unused'
entity PostalAddresses : PostalAddress {
contact : Association to Contacts;
kind : String;
key ID : UUID;
}

View File

@@ -1,2 +0,0 @@
using from './db/code-lists';
using from './db/schema';

View File

@@ -1,10 +0,0 @@
{
"name": "@sap/capire-contacts",
"version": "1.0.0",
"description": "A reuse package providing common domain models and services for contacts-related data.",
"repository": "https://github.com/SAP-samples/cloud-cap-samples.git",
"license": "SAP SAMPLE CODE LICENSE",
"dependencies": {
"@sap/cds": "latest"
}
}

View File

@@ -1,67 +0,0 @@
# Common Contacts Sample
This sample provides a reuse package with common domain models and services for contacts-related data.
## Usage
#### Import to your project
npm install @sap/capire-contacts
> e.g. see: [bookstore](../bookstore/package.json)
#### Reusing aspects
Define own entities derived from the pre-defined aspects as in [_bookstore_](../bookstore/db/schema.cds):
```swift
using { sap.capire.contacts.Person } from '@sap/capire-contacts';
entity Authors : contacts.Person { ... }
```
> **Note:** All entities in this package are annotated with _`@cds.persistence.skip`:'if-unused'_, so they will be ignored if not referred to from other entities in your models.
#### Reusing entities
Reuse the entities as in this example from [_users-service_](../users-service/srv/services.cds):
```swift
using { sap.capire.contacts.Contacts } from '@sap/capire-contacts';
service UsersService @(requires:'authenticated-user') {
entity MyProfile as select from Contacts where ID=$user;
...
}
```
#### Reusing code lists
Reuse the code lists as in [_./tests/index.cds_](./tests/index.cds):
```swift
service Sue { ...
// expose Countries to activate provided code lists
@readonly entity Countries as projection on sap.capire.contacts.Countries;
}
```
#### Reuse code list service
```js
const { intercept } = require ('@sap/capire-contacts/srv/code-lists')
```
## Content
## Concepts
* [Reuse of packages](https://cap.cloud.sap/docs/get-started/projects#reuse)
* Code Lists, `@sap/cds/common` and `@cds.persistence.skip`: 'if-unused'
* Using `aspects` vs `entities`

View File

@@ -1,70 +0,0 @@
const cds = require ('@sap/cds')
const READ='READ', WRITE = ['CREATE','UPDATE']
const intercept = exports.intercept = cds.service.impl (async (srv) => {
for (let each in srv.entities) {
// intercept JSON-encoded elements
const jsons = await jsonsIn (srv.entities[each].elements)
if (jsons) {
srv.before (WRITE, each, ({data:row})=>{
for (let e of jsons) if (row[e]) row[e] = JSON.stringify (row[e])
})
srv.after (READ, each, (row)=>{
for (let e of jsons) if (row[e]) row[e] = JSON.parse (row[e])
})
}
// intercept references
const refs = await refsIn (srv.entities[each].elements, srv.model)
if (refs) srv.after (READ, each, (rows, req)=>{
for (let row of rows) {
for (let {element,codelist} of refs) {
const entry = codelist [row[element]]
if (entry) {
const localized = entry.texts [req.user.locale || intercept.locale]
row[element] = localized ? localized.name : entry.name
}
}
}
})
}
})
function jsonsIn (elements) {
const jsons=[]; for (let e in elements) {
if (elements[e]['@JSON']) jsons.push(e)
}
return jsons.length && jsons
}
async function refsIn (elements, model) {
const refs=[]; for (let e in elements) {
const $ref = elements[e]['@ref']
if ($ref) {
const d = model.definitions [$ref['=']]
refs.push({
element:e,
codelist: CodeLists[d.name] || (CodeLists[d.name] = await load(d))
})
}
}
return refs.length && refs
}
const load = exports.load = async (codelist) => {
const all = {}
const [entries,texts] = await Promise.all ([
SELECT.from (codelist),
SELECT.from (codelist.elements.texts.target)
])
for (let {code,name,descr} of entries) all[code] = {name,descr}
for (let {code,locale,name,descr} of texts) (all[code].texts || (all[code].texts={})) [locale] = {name,descr}
return all
}
const CodeLists = {}

View File

@@ -1,68 +0,0 @@
const {load,intercept} = require ('../srv/code-lists')
const cds = require ('@sap/cds')
// patch-enhance cds.ql
const select = SELECT.from('.').__proto__.__proto__, query = select.__proto__
query.then = function (r,e) { return db.run(this) .then (r,e || ((e)=>{throw e})) }
let db, Countries, Australia = {
name: 'Australia', descr: 'Commonwealth of Australia', texts: {
de: { name: 'Australien', descr: 'Commonwealth Australien' }
}
}
describe ('code list tests', ()=>{
it ('should deploy the db schema to sqlite in-memory', async()=>{
db = await cds.deploy (__dirname) .to ('sqlite::memory:', {silent:true,primary:true})
Countries = db.model.entities ['sap.common.Countries']
expect (Countries) .toBeDefined()
})
it ('should read Countries', async()=>{
const countries = await SELECT ('code','name') .from (Countries)
expect (countries) .toContainEqual ({ code: 'AU', name: 'Australia' })
})
it ('should read Countries_texts', async()=>{
const countries = await SELECT ('locale','code','name') .from ('sap.common.Countries_texts')
expect (countries) .toContainEqual ({ locale: 'de', code: 'AU', name: 'Australien' })
})
it ('should read code lists with translated texts', async()=>{
const {AU} = await load (Countries)
expect (AU) .toEqual (Australia)
})
cds.env.singletenant = true
it ('should serve services with localized data', async()=>{
const { Sue:sue } = await cds.serve (__dirname)
const { Foos } = sue.entities
await sue.create (Foos) .entries ({country:'Avalon'})
await sue.create (Foos) .entries ({country:'AU'})
expect (await sue.read('Foos')) .toEqual ([ { ID: 1, country: 'Avalon' }, { ID: 2, country: 'AU' } ])
})
it ('should resolve countries', async()=>{
const sue = await cds.connect.to ('Sue')
await intercept (sue)
expect (await sue.read('Foos')) .toEqual ([ { ID: 1, country: 'Avalon' }, { ID: 2, country: 'Australia' } ])
intercept.locale = 'de'
expect (await sue.read('Foos')) .toEqual ([ { ID: 1, country: 'Avalon' }, { ID: 2, country: 'Australien' } ])
console.log (await sue.read('Foos'))
})
it ('should read countries with expand to translated texts', async()=>{
const countries = await cds.read (Countries, c=>{
c.name, c.texts (t => {
t.locale, t.name
})
})
console.log (countries)
})
it ('should disconnect from db', ()=> db.disconnect())
//> FIXME: that should not be required!
})

View File

@@ -1,11 +0,0 @@
using { sap } from '..';
entity Foo {
key ID : Integer;
country : String @ref: sap.capire.contacts.Countries;
}
service Sue {
entity Foos as projection on Foo;
// expose Countries to activate provided code lists
@readonly entity Countries as projection on sap.capire.contacts.Countries;
}

View File

@@ -1,12 +0,0 @@
code;symbol;name;descr;numcode;minor;exponent
EUR;€;Euro;European Euro;978;Cent;2
USD;$;US Dollar;United States Dollar;840;Cent;2
CAD;$;Canadian Dollar;Canadian Dollar;124;Cent;2
AUD;$;Australian Dollar;Canadian Dollar;036;Cent;2
GBP;£;British Pound;Great Britain Pound;826;Penny;2
ILS;₪;Shekel;Israeli New Shekel;376;Agorat;2
INR;₹;Rupee;Indian Rupee;356;Paise;2
QAR;﷼;Riyal;Katar Riyal;356;Dirham;2
SAR;﷼;Riyal;Saudi Riyal;682;Halala;2
JPY;¥;Yen;Japanese Yen;392;Sen;2
CNY;¥;Yuan;Chinese Yuan Renminbi;156;Jiao;1
1 code symbol name descr numcode minor exponent
2 EUR Euro European Euro 978 Cent 2
3 USD $ US Dollar United States Dollar 840 Cent 2
4 CAD $ Canadian Dollar Canadian Dollar 124 Cent 2
5 AUD $ Australian Dollar Canadian Dollar 036 Cent 2
6 GBP £ British Pound Great Britain Pound 826 Penny 2
7 ILS Shekel Israeli New Shekel 376 Agorat 2
8 INR Rupee Indian Rupee 356 Paise 2
9 QAR Riyal Katar Riyal 356 Dirham 2
10 SAR Riyal Saudi Riyal 682 Halala 2
11 JPY ¥ Yen Japanese Yen 392 Sen 2
12 CNY ¥ Yuan Chinese Yuan Renminbi 156 Jiao 1

View File

@@ -1,13 +0,0 @@
code;locale;name;descr
EUR;de;Euro;European Euro
USD;de;US-Dollar;United States Dollar
CAD;de;Kanadischer Dollar;Kanadischer Dollar
AUD;de;Australischer Dollar;Australischer Dollar
GBP;de;Pfund;Britische Pfund
ILS;de;Schekel;Israelische Schekel
EUR;fr;euro;de la Zone euro
USD;fr;dollar;dollar des États-Unis
CAD;fr;dollar canadien;dollar canadien
AUD;fr;dollar australien;dollar australien
GBP;fr;livre sterling;pound sterling
ILS;fr;Shekel;shekel israelien
1 code locale name descr
2 EUR de Euro European Euro
3 USD de US-Dollar United States Dollar
4 CAD de Kanadischer Dollar Kanadischer Dollar
5 AUD de Australischer Dollar Australischer Dollar
6 GBP de Pfund Britische Pfund
7 ILS de Schekel Israelische Schekel
8 EUR fr euro de la Zone euro
9 USD fr dollar dollar des États-Unis
10 CAD fr dollar canadien dollar canadien
11 AUD fr dollar australien dollar australien
12 GBP fr livre sterling pound sterling
13 ILS fr Shekel shekel israelien

View File

@@ -1,17 +0,0 @@
namespace sap.capire.currencies;
using { sap.common.Currencies } from '@sap/cds/common';
extend Currencies with {
// Currencies.code = ISO 4217 alphabetic three-letter code
// with the first two letters being equal to ISO 3166 alphabetic country codes
numcode : Integer;
exponent : Integer; //> e.g. 2 --> 1 Dollar = 10^2 Cent
minor : String; //> e.g. 'Cent'
// country : String; //> country or region
}
// see also
// [1] https://www.iso.org/iso-4217-currency-codes.html
// [2] https://www.currency-iso.org/en/home/tables/table-a1.html
// [3] https://www.ibm.com/support/knowledgecenter/en/SSZLC2_7.0.0/com.ibm.commerce.payments.developer.doc/refs/rpylerl2mst97.htm

View File

@@ -1,10 +0,0 @@
{
"name": "@sap/capire-currencies",
"version": "1.0.0",
"description": "A reuse package providing common domain models and services for currencies-related data.",
"repository": "https://github.com/SAP-samples/cloud-cap-samples.git",
"license": "SAP SAMPLE CODE LICENSE",
"dependencies": {
"@sap/cds": "latest"
}
}

View File

@@ -1,13 +0,0 @@
namespace sap.capire.media;
entity Media {
key id:Integer;
@Core.MediaType: mediaType
content : LargeBinary ;
@Core.IsMediaType: true
mediaType : String;
fileName : String;
applicationName:String;
}

View File

@@ -1,2 +0,0 @@
using from './db/data-model';
using from './srv/media-service';

View File

@@ -1,24 +0,0 @@
{
"name": "@sap/capire-media",
"version": "1.0.0",
"description": "A generic platform service to manage and serve media content on behalf of other services and apps.",
"repository": "https://github.com/SAP-samples/cloud-cap-samples.git",
"license": "SAP SAMPLE CODE LICENSE",
"dependencies": {
"@sap/cds": "latest",
"express": "*",
"lokijs": "^1.5.6"
},
"files": [
"db",
"srv",
"index.cds"
],
"cds": {
"requires": {
"db": {
"kind": "sql"
}
}
}
}

View File

@@ -1,8 +0,0 @@
using { sap.capire.media as db } from '../db/data-model';
namespace sap.capire.media;
service MediaServer {
entity Media as projection on db.Media ;
}

View File

@@ -1,68 +0,0 @@
const loki = require('lokijs')
const db = new loki('DB')
const mediaDB = db.addCollection('Media')
const { Readable, PassThrough } = require('stream')
module.exports = srv => {
srv.before('CREATE', 'Media', req => {
const obj = mediaDB.insert({ media: '' })
req.data.id = obj.$loki
})
srv.on('UPDATE', 'Media', (req, next) => {
const url = req._.req.path
if (url.includes('content')) {
const id = req.data.id
const obj = mediaDB.get(id)
if (!obj) {
req.reject(404, 'No record found for the ID')
return
}
const stream = new PassThrough()
const chunks = []
stream.on('data', chunk => {
chunks.push(chunk)
})
stream.on('end', () => {
obj.media = Buffer.concat(chunks).toString('base64')
mediaDB.update(obj)
})
req.data.content.pipe(stream)
} else return next()
})
srv.on('READ', 'Media', (req, next) => {
const url = req._.req.path
if (url.includes('content')) {
const id = req.data.id
const mediaObj = mediaDB.get(id)
if (!mediaObj) {
req.reject(404, 'Media not found for the ID')
return
}
const decodedMedia = new Buffer(
mediaObj.media.split(';base64,').pop(),
'base64'
)
return _formatResult(decodedMedia)
} else return next() //> delegate to next/default handlers
})
srv.on('DELETE', 'Media', (req, next) => {
const id = req.data.id
mediaDB
.chain()
.find({ $loki: id })
.remove()
return next() //> delegate to next/default handlers
})
function _formatResult (decodedMedia) {
const readable = new Readable()
const result = new Array()
readable.push(decodedMedia)
readable.push(null)
result.push({ value: readable })
return result
}
}

View File

@@ -0,0 +1,24 @@
{
"extends": "eslint:recommended",
"env": {
"node": true,
"es6": true,
"jest": true
},
"parserOptions": {
"ecmaVersion": 2017
},
"globals": {
"SELECT": true,
"INSERT": true,
"UPDATE": true,
"DELETE": true,
"CREATE": true,
"DROP": true,
"cds": true
},
"rules": {
"no-console": "off",
"require-atomic-updates": "off"
}
}

23
packages/officesupplies/.gitignore vendored Normal file
View File

@@ -0,0 +1,23 @@
# CAP officesupplies
_out
*.db
connection.properties
default-*.json
gen/
node_modules/
package-lock.json
target/
# Web IDE, App Studio
.che/
.gen/
# MTA
*_mta_build_tmp
*.mtar
mta_archives/
# Other
.DS_Store
*.orig
*.log

View File

@@ -0,0 +1,4 @@
// used in launch.json to refer to an installed cds via an absolute path
const cds = require('@sap/cds');
cds.exec();

View File

@@ -0,0 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "cds run",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/.vscode/cds",
"args": [ "run", "--with-mocks", "--in-memory?" ],
"skipFiles": [ "<node_internals>/**" ],
"internalConsoleOptions": "openOnSessionStart",
"console": "internalConsole",
"autoAttachChildProcesses": true
}
]
}

View File

@@ -0,0 +1,7 @@
{
"files.exclude": {
"**/.gitignore": true,
"**/.git": true,
"**/.vscode": true
}
}

View File

@@ -0,0 +1,23 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "cds watch",
"command": ["cds", "watch"],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"type": "shell",
"label": "cds run",
"command": ["cds", "run", "--with-mocks", "--in-memory?"],
"problemMatcher": []
}
]
}

View File

@@ -0,0 +1,25 @@
# Getting Started
Welcome to your new project.
It contains these folders and files, following our recommended project layout:
File / Folder | Purpose
---------|----------
`app/` | content for UI frontends go here
`db/` | your domain models and data go here
`srv/` | your service models and code go here
`package.json` | project metadata and configuration
`readme.md` | this getting started guide
## Next Steps...
- Open a new terminal and run `cds watch`
- ( in VSCode simply choose _**Terminal** > Run Task > cds watch_ )
- Start adding content, e.g. a [db/schema.cds](db/schema.cds), ...
## Learn more...
Learn more at https://cap.cloud.sap/docs/get-started/

View File

@@ -0,0 +1,4 @@
@sap:registry=https://npm.sap.com
@ui5:registry=https://registry.npmjs.org
save = true
save-exact = true

View File

@@ -0,0 +1,21 @@
# products
This is a my new Fiori elements app
## Starting the generated app
- This app has been generated using the SAP UX - App Generator, as part of the SAP UX Tools Suite. In order to launch the generated app, simply run the following from the generated app root folder:
```
npm start
```
- Is it also possible to run the application using mock data that reflects the OData Service URL supplied during application generation. In order to run the application with Mock Data, run the following from the generated app root folder:
```
npm run start-mock
```
### Pre-requisites:
1. Active NodeJS LTS (Long Term Support) version and associated supported NPM version. (See https://nodejs.org)

View File

@@ -0,0 +1,33 @@
{
"name": "products",
"version": "0.0.1",
"private": true,
"sapux": true,
"description": "This is a my new Fiori elements app",
"keywords": [
"ui5",
"openui5",
"sapui5"
],
"main": "webapp/index.html",
"scripts": {
"start": "npm run start-app-router",
"start-app-router": "npm run build && run-script-os",
"start-app-router:default": "destinations='[{\"name\":\"odata\",\"url\":\"http://localhost:4004\",\"strictSSL\":false}]' node node_modules/@sap/approuter/approuter.js",
"start-app-router:windows": "set destinations=[{\"name\":\"odata\",\"url\":\"http://localhost:4004\",\"strictSSL\":false}] && node node_modules/@sap/approuter/approuter.js",
"build": "rimraf dist && ui5 build -a --include-task=generateManifestBundle generateCachebusterInfo"
},
"remarkConfig": {
"plugins": [
"remark-preset-lint-consistent"
]
},
"dependencies": {
"@sap/approuter": "6.5.1",
"@ui5/cli": "1.8.0"
},
"devDependencies": {
"run-script-os": "1.0.7",
"rimraf": "3.0.0"
}
}

View File

@@ -0,0 +1,4 @@
specVersion: '1.0'
metadata:
name: products
type: application

View File

@@ -0,0 +1,10 @@
/* global hasher */
sap.ui.define(['sap/fe/AppComponent'], function(AppComponent) {
'use strict';
return AppComponent.extend('sap.uxfe.demo.products.Component', {
metadata: {
manifest: 'json'
}
});
});

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee">
<display-name>OData v4</display-name>
<!-- ============================================================== -->
<!-- UI5 resource servlet used to handle application resources -->
<!-- ============================================================== -->
<servlet>
<display-name>ResourceServlet</display-name>
<servlet-name>ResourceServlet</servlet-name>
<servlet-class>com.sap.ui5.resource.ResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ResourceServlet</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ResourceServlet</servlet-name>
<url-pattern>/test-resources/*</url-pattern>
</servlet-mapping>
<!-- enable CORS -->
<context-param>
<param-name>com.sap.ui5.resource.ACCEPTED_ORIGINS</param-name>
<param-value>*</param-value>
</context-param>
<!-- BEGIN: DEV MODE -->
<!-- DEV MODE switched off by default and can be switched on during development -->
<!-- but has to be switched off for productive use on a Java server! -->
<context-param>
<param-name>com.sap.ui5.resource.DEV_MODE</param-name>
<param-value>true</param-value>
</context-param>
<!-- END: DEV MODE -->
<!-- ============================================================== -->
<!-- Cache Control Filter to prevent caching of any resource -->
<!-- ============================================================== -->
<filter>
<display-name>CacheControlFilter</display-name>
<filter-name>CacheControlFilter</filter-name>
<filter-class>com.sap.ui5.resource.CacheControlFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.css</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.json</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.xml</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.gif</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.png</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.jpg</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.properties</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.tmpl</url-pattern>
</filter-mapping>
<!-- ============================================================== -->
<!-- UI5 proxy servlet -->
<!-- ============================================================== -->
<servlet>
<servlet-name>SimpleProxyServlet</servlet-name>
<servlet-class>com.sap.ui5.proxy.SimpleProxyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SimpleProxyServlet</servlet-name>
<url-pattern>/proxy/*</url-pattern>
</servlet-mapping>
<!-- ============================================================== -->
<!-- Welcome file list -->
<!-- ============================================================== -->
<welcome-file-list>
<welcome-file>test.html</welcome-file>
</welcome-file-list>
</web-app>

View File

@@ -0,0 +1,9 @@
# This is the resource bundle for products
#Texts for manifest.json
#XTIT: Application name
appTitle=Products
#YDES: Application description
appDescription=This is a my new Fiori elements app

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{appTitle}}</title>
<script>
window['sap-ushell-config'] = {
defaultRenderer: 'fiori2',
applications: {
"fe-lrop-v4": {
title: 'Products',
description: 'This is a my new Fiori elements app',
additionalInformation: 'SAPUI5.Component=sap.uxfe.demo.products',
applicationType: 'URL',
url: './',
navigationMode: 'embedded'
}
}
};
</script>
<script src="https://sapui5.hana.ondemand.com/1.71.0/test-resources/sap/ushell/bootstrap/sandbox.js"></script>
<script
src="https://sapui5.hana.ondemand.com/1.71.0/resources/sap-ui-core.js"
data-sap-ui-libs="sap.m, sap.ushell, sap.collaboration, sap.ui.layout"
data-sap-ui-compatVersion="edge"
data-sap-ui-theme="sap_fiori_3"
data-sap-ui-frameOptions="allow"
></script>
<script>
sap.ui.getCore().attachInit(() => sap.ushell.Container.createRenderer().placeAt('content'));
</script>
</head>
<body class="sapUiBody" id="content"></body>
</html>

View File

@@ -0,0 +1,233 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Capabilities.V1.xml">
<edmx:Include Alias="Capabilities" Namespace="Org.OData.Capabilities.V1"/>
</edmx:Reference>
<edmx:Reference Uri="https://wiki.scn.sap.com/wiki/download/attachments/448470974/Common.xml?api=v2">
<edmx:Include Alias="Common" Namespace="com.sap.vocabularies.Common.v1"/>
</edmx:Reference>
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml">
<edmx:Include Alias="Core" Namespace="Org.OData.Core.V1"/>
</edmx:Reference>
<edmx:Reference Uri="https://wiki.scn.sap.com/wiki/download/attachments/448470968/UI.xml?api=v2">
<edmx:Include Alias="UI" Namespace="com.sap.vocabularies.UI.v1"/>
</edmx:Reference>
<edmx:DataServices>
<Schema Namespace="CatalogService" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<EntityContainer Name="EntityContainer">
<EntitySet Name="Currencies" EntityType="CatalogService.Currencies">
<NavigationPropertyBinding Path="texts" Target="Currencies_texts"/>
<NavigationPropertyBinding Path="localized" Target="Currencies_texts"/>
</EntitySet>
<EntitySet Name="Currencies_texts" EntityType="CatalogService.Currencies_texts"/>
<EntitySet Name="Products" EntityType="CatalogService.Products">
<NavigationPropertyBinding Path="currency" Target="Currencies"/>
<NavigationPropertyBinding Path="supplier" Target="Suppliers"/>
<NavigationPropertyBinding Path="texts" Target="Products_texts"/>
<NavigationPropertyBinding Path="localized" Target="Products_texts"/>
</EntitySet>
<EntitySet Name="Products_texts" EntityType="CatalogService.Products_texts"/>
<EntitySet Name="Suppliers" EntityType="CatalogService.Suppliers">
<NavigationPropertyBinding Path="products" Target="Products"/>
</EntitySet>
</EntityContainer>
<EntityType Name="Currencies">
<Key>
<PropertyRef Name="code"/>
</Key>
<Property Name="name" Type="Edm.String" MaxLength="255"/>
<Property Name="descr" Type="Edm.String" MaxLength="1000"/>
<Property Name="code" Type="Edm.String" MaxLength="3" Nullable="false"/>
<Property Name="symbol" Type="Edm.String" MaxLength="2"/>
<NavigationProperty Name="texts" Type="Collection(CatalogService.Currencies_texts)">
<OnDelete Action="Cascade"/>
</NavigationProperty>
<NavigationProperty Name="localized" Type="CatalogService.Currencies_texts">
<ReferentialConstraint Property="code" ReferencedProperty="code"/>
</NavigationProperty>
</EntityType>
<EntityType Name="Currencies_texts">
<Key>
<PropertyRef Name="locale"/>
<PropertyRef Name="code"/>
</Key>
<Property Name="locale" Type="Edm.String" MaxLength="5" Nullable="false"/>
<Property Name="name" Type="Edm.String" MaxLength="255"/>
<Property Name="descr" Type="Edm.String" MaxLength="1000"/>
<Property Name="code" Type="Edm.String" MaxLength="3" Nullable="false"/>
</EntityType>
<EntityType Name="Products">
<Key>
<PropertyRef Name="ID"/>
</Key>
<Property Name="ID" Type="Edm.Guid" Nullable="false"/>
<Property Name="identifier" Type="Edm.String"/>
<Property Name="title" Type="Edm.String"/>
<Property Name="description" Type="Edm.String"/>
<Property Name="availability" Type="Edm.Int32"/>
<Property Name="storageCapacity" Type="Edm.Int32"/>
<Property Name="criticality" Type="Edm.Int32"/>
<Property Name="price" Type="Edm.Decimal" Scale="2" Precision="9"/>
<NavigationProperty Name="currency" Type="CatalogService.Currencies">
<ReferentialConstraint Property="currency_code" ReferencedProperty="code"/>
</NavigationProperty>
<NavigationProperty Name="supplier" Type="CatalogService.Suppliers" Partner="products">
<ReferentialConstraint Property="supplier_ID" ReferencedProperty="ID"/>
</NavigationProperty>
<Property Name="image_url" Type="Edm.String"/>
<NavigationProperty Name="texts" Type="Collection(CatalogService.Products_texts)">
<OnDelete Action="Cascade"/>
</NavigationProperty>
<NavigationProperty Name="localized" Type="CatalogService.Products_texts">
<ReferentialConstraint Property="ID" ReferencedProperty="ID"/>
</NavigationProperty>
<Property Name="currency_code" Type="Edm.String" MaxLength="3"/>
<Property Name="supplier_ID" Type="Edm.Guid"/>
</EntityType>
<EntityType Name="Products_texts">
<Key>
<PropertyRef Name="locale"/>
<PropertyRef Name="ID"/>
</Key>
<Property Name="locale" Type="Edm.String" MaxLength="5" Nullable="false"/>
<Property Name="ID" Type="Edm.Guid" Nullable="false"/>
<Property Name="title" Type="Edm.String"/>
<Property Name="description" Type="Edm.String"/>
</EntityType>
<EntityType Name="Suppliers">
<Key>
<PropertyRef Name="ID"/>
</Key>
<Property Name="ID" Type="Edm.Guid" Nullable="false"/>
<Property Name="identifier" Type="Edm.String"/>
<Property Name="name" Type="Edm.String"/>
<Property Name="phone" Type="Edm.String"/>
<Property Name="building" Type="Edm.String"/>
<Property Name="street" Type="Edm.String"/>
<Property Name="postCode" Type="Edm.String"/>
<Property Name="city" Type="Edm.String"/>
<Property Name="country" Type="Edm.String"/>
<NavigationProperty Name="products" Type="Collection(CatalogService.Products)" Partner="supplier"/>
</EntityType>
<Annotations Target="CatalogService.Currencies">
<Annotation Term="UI.Identification">
<Collection>
<Path>name</Path>
</Collection>
</Annotation>
</Annotations>
<Annotations Target="CatalogService.Currencies/name">
<Annotation Term="Common.Label" String="Name"/>
</Annotations>
<Annotations Target="CatalogService.Currencies/descr">
<Annotation Term="Common.Label" String="Description"/>
</Annotations>
<Annotations Target="CatalogService.Currencies/code">
<Annotation Term="Common.Label" String="Currency Code"/>
</Annotations>
<Annotations Target="CatalogService.Currencies/symbol">
<Annotation Term="Common.Label" String="Currency Symbol"/>
</Annotations>
<Annotations Target="CatalogService.Currencies_texts/name">
<Annotation Term="Common.Label" String="Name"/>
</Annotations>
<Annotations Target="CatalogService.Currencies_texts/descr">
<Annotation Term="Common.Label" String="Description"/>
</Annotations>
<Annotations Target="CatalogService.Currencies_texts/code">
<Annotation Term="Common.Label" String="Currency Code"/>
</Annotations>
<Annotations Target="CatalogService.EntityContainer/Products">
<Annotation Term="Capabilities.DeleteRestrictions">
<Record Type="Capabilities.DeleteRestrictionsType">
<PropertyValue Property="Deletable" Bool="false"/>
</Record>
</Annotation>
<Annotation Term="Capabilities.InsertRestrictions">
<Record Type="Capabilities.InsertRestrictionsType">
<PropertyValue Property="Insertable" Bool="false"/>
</Record>
</Annotation>
<Annotation Term="Capabilities.UpdateRestrictions">
<Record Type="Capabilities.UpdateRestrictionsType">
<PropertyValue Property="Updatable" Bool="false"/>
</Record>
</Annotation>
</Annotations>
<Annotations Target="CatalogService.Products/ID">
<Annotation Term="Common.Label" String="UUID"/>
</Annotations>
<Annotations Target="CatalogService.Products/identifier">
<Annotation Term="Common.Label" String="ID"/>
</Annotations>
<Annotations Target="CatalogService.Products/title">
<Annotation Term="Common.Label" String="Name"/>
</Annotations>
<Annotations Target="CatalogService.Products/currency">
<Annotation Term="Common.Label" String="Currency"/>
<Annotation Term="Common.ValueList">
<Record Type="Common.ValueListType">
<PropertyValue Property="Label" String="Currency"/>
<PropertyValue Property="CollectionPath" String="Currencies"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="currency_code"/>
<PropertyValue Property="ValueListProperty" String="code"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="name"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="Core.Description" String="A currency code as specified in ISO 4217"/>
</Annotations>
<Annotations Target="CatalogService.Products/currency_code">
<Annotation Term="Common.Label" String="Currency"/>
<Annotation Term="Common.ValueList">
<Record Type="Common.ValueListType">
<PropertyValue Property="Label" String="Currency"/>
<PropertyValue Property="CollectionPath" String="Currencies"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="currency_code"/>
<PropertyValue Property="ValueListProperty" String="code"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="name"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="Core.Description" String="A currency code as specified in ISO 4217"/>
</Annotations>
<Annotations Target="CatalogService.Products_texts/ID">
<Annotation Term="Common.Label" String="UUID"/>
</Annotations>
<Annotations Target="CatalogService.Products_texts/title">
<Annotation Term="Common.Label" String="Name"/>
</Annotations>
<Annotations Target="CatalogService.EntityContainer/Suppliers">
<Annotation Term="Capabilities.DeleteRestrictions">
<Record Type="Capabilities.DeleteRestrictionsType">
<PropertyValue Property="Deletable" Bool="false"/>
</Record>
</Annotation>
<Annotation Term="Capabilities.InsertRestrictions">
<Record Type="Capabilities.InsertRestrictionsType">
<PropertyValue Property="Insertable" Bool="false"/>
</Record>
</Annotation>
<Annotation Term="Capabilities.UpdateRestrictions">
<Record Type="Capabilities.UpdateRestrictionsType">
<PropertyValue Property="Updatable" Bool="false"/>
</Record>
</Annotation>
</Annotations>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

View File

@@ -0,0 +1,133 @@
{
"_version": "1.15.0",
"sap.app": {
"id": "sap.uxfe.demo.products",
"type": "application",
"i18n": "i18n/i18n.properties",
"applicationVersion": {
"version": "1.0"
},
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"ach": "CA-UI5-FE",
"dataSources": {
"mainService": {
"uri": "/catalog/",
"type": "OData",
"settings": {
"odataVersion": "4.0"
}
}
},
"offline": false,
"resources": "resources.json",
"sourceTemplate": {
"id": "ui5template.fiorielements.v4.lrop",
"version": "1.0.0"
}
},
"sap.ui": {
"technology": "UI5",
"icons": {
"icon": "",
"favIcon": "",
"phone": "",
"phone@2": "",
"tablet": "",
"tablet@2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
}
},
"sap.ui5": {
"resources": {
"js": [],
"css": []
},
"dependencies": {
"minUI5Version": "1.71.0",
"libs": {
"sap.fe": {}
}
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"uri": "i18n/i18n.properties"
},
"": {
"dataSource": "mainService",
"settings": {
"synchronizationMode": "None",
"operationMode": "Server",
"autoExpandSelect": true,
"earlyRequests": true
}
}
},
"routing": {
"routes": [
{
"pattern": "",
"name": "ProductsList",
"target": "ProductsList"
},
{
"pattern": "Products({key})",
"name": "ProductsObjectPage",
"target": "ProductsObjectPage"
}
],
"targets": {
"ProductsList": {
"type": "Component",
"id": "ProductsList",
"name": "sap.fe.templates.ListReport",
"options": {
"settings": {
"entitySet": "Products",
"variantManagement": "Page",
"navigation": {
"Products": {
"detail": {
"route": "ProductsObjectPage"
}
}
}
}
}
},
"ProductsObjectPage": {
"type": "Component",
"id": "ProductsObjectPage",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings": {
"entitySet": "Products"
}
}
}
}
},
"contentDensities": {
"compact": true,
"cozy": true
}
},
"sap.platform.abap": {
"_version": "1.1.0",
"uri": ""
},
"sap.platform.hcp": {
"_version": "1.1.0",
"uri": ""
},
"sap.fiori": {
"_version": "1.1.0",
"registrationIds": [],
"archeType": "transactional"
}
}

View File

@@ -0,0 +1,16 @@
{
"welcomeFile": "/index.html",
"authenticationMethod": "none",
"routes": [
{
"source": "^/catalog/(.*)$",
"target": "/catalog/$1",
"destination": "odata",
"csrfProtection": false
},
{
"source": "^(.*)",
"localDir": "webapp"
}
]
}

View File

@@ -0,0 +1,4 @@
@sap:registry=https://npm.sap.com
@ui5:registry=https://registry.npmjs.org
save = true
save-exact = true

View File

@@ -0,0 +1,21 @@
# suppliers
This is a my new Fiori elements app
## Starting the generated app
- This app has been generated using the SAP UX - App Generator, as part of the SAP UX Tools Suite. In order to launch the generated app, simply run the following from the generated app root folder:
```
npm start
```
- Is it also possible to run the application using mock data that reflects the OData Service URL supplied during application generation. In order to run the application with Mock Data, run the following from the generated app root folder:
```
npm run start-mock
```
### Pre-requisites:
1. Active NodeJS LTS (Long Term Support) version and associated supported NPM version. (See https://nodejs.org)

View File

@@ -0,0 +1,33 @@
{
"name": "suppliers",
"version": "0.0.1",
"private": true,
"sapux": true,
"description": "This is a my new Fiori elements app",
"keywords": [
"ui5",
"openui5",
"sapui5"
],
"main": "webapp/index.html",
"scripts": {
"start": "npm run start-app-router",
"start-app-router": "npm run build && run-script-os",
"start-app-router:default": "destinations='[{\"name\":\"odata\",\"url\":\"http://localhost:4004\",\"strictSSL\":false}]' node node_modules/@sap/approuter/approuter.js",
"start-app-router:windows": "set destinations=[{\"name\":\"odata\",\"url\":\"http://localhost:4004\",\"strictSSL\":false}] && node node_modules/@sap/approuter/approuter.js",
"build": "rimraf dist && ui5 build -a --include-task=generateManifestBundle generateCachebusterInfo"
},
"remarkConfig": {
"plugins": [
"remark-preset-lint-consistent"
]
},
"dependencies": {
"@sap/approuter": "6.5.1",
"@ui5/cli": "1.8.0"
},
"devDependencies": {
"run-script-os": "1.0.7",
"rimraf": "3.0.0"
}
}

View File

@@ -0,0 +1,4 @@
specVersion: '1.0'
metadata:
name: suppliers
type: application

View File

@@ -0,0 +1,10 @@
/* global hasher */
sap.ui.define(['sap/fe/AppComponent'], function(AppComponent) {
'use strict';
return AppComponent.extend('supplier.suppliers.Component', {
metadata: {
manifest: 'json'
}
});
});

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee">
<display-name>OData v4</display-name>
<!-- ============================================================== -->
<!-- UI5 resource servlet used to handle application resources -->
<!-- ============================================================== -->
<servlet>
<display-name>ResourceServlet</display-name>
<servlet-name>ResourceServlet</servlet-name>
<servlet-class>com.sap.ui5.resource.ResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ResourceServlet</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ResourceServlet</servlet-name>
<url-pattern>/test-resources/*</url-pattern>
</servlet-mapping>
<!-- enable CORS -->
<context-param>
<param-name>com.sap.ui5.resource.ACCEPTED_ORIGINS</param-name>
<param-value>*</param-value>
</context-param>
<!-- BEGIN: DEV MODE -->
<!-- DEV MODE switched off by default and can be switched on during development -->
<!-- but has to be switched off for productive use on a Java server! -->
<context-param>
<param-name>com.sap.ui5.resource.DEV_MODE</param-name>
<param-value>true</param-value>
</context-param>
<!-- END: DEV MODE -->
<!-- ============================================================== -->
<!-- Cache Control Filter to prevent caching of any resource -->
<!-- ============================================================== -->
<filter>
<display-name>CacheControlFilter</display-name>
<filter-name>CacheControlFilter</filter-name>
<filter-class>com.sap.ui5.resource.CacheControlFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.css</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.json</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.xml</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.gif</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.png</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.jpg</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.properties</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheControlFilter</filter-name>
<url-pattern>*.tmpl</url-pattern>
</filter-mapping>
<!-- ============================================================== -->
<!-- UI5 proxy servlet -->
<!-- ============================================================== -->
<servlet>
<servlet-name>SimpleProxyServlet</servlet-name>
<servlet-class>com.sap.ui5.proxy.SimpleProxyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SimpleProxyServlet</servlet-name>
<url-pattern>/proxy/*</url-pattern>
</servlet-mapping>
<!-- ============================================================== -->
<!-- Welcome file list -->
<!-- ============================================================== -->
<welcome-file-list>
<welcome-file>test.html</welcome-file>
</welcome-file-list>
</web-app>

View File

@@ -0,0 +1,9 @@
# This is the resource bundle for suppliers
#Texts for manifest.json
#XTIT: Application name
appTitle=suppliers
#YDES: Application description
appDescription=This is a my new Fiori elements app

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{appTitle}}</title>
<script>
window['sap-ushell-config'] = {
defaultRenderer: 'fiori2',
applications: {
"fe-lrop-v4": {
title: 'suppliers',
description: 'This is a my new Fiori elements app',
additionalInformation: 'SAPUI5.Component=supplier.suppliers',
applicationType: 'URL',
url: './',
navigationMode: 'embedded'
}
}
};
</script>
<script src="https://sapui5.hana.ondemand.com/1.71.0/test-resources/sap/ushell/bootstrap/sandbox.js"></script>
<script
src="https://sapui5.hana.ondemand.com/1.71.0/resources/sap-ui-core.js"
data-sap-ui-libs="sap.m, sap.ushell, sap.collaboration, sap.ui.layout"
data-sap-ui-compatVersion="edge"
data-sap-ui-theme="sap_fiori_3"
data-sap-ui-frameOptions="allow"
></script>
<script>
sap.ui.getCore().attachInit(() => sap.ushell.Container.createRenderer().placeAt('content'));
</script>
</head>
<body class="sapUiBody" id="content"></body>
</html>

View File

@@ -0,0 +1,346 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:Reference Uri="https://wiki.scn.sap.com/wiki/download/attachments/448470974/Common.xml?api=v2">
<edmx:Include Alias="Common" Namespace="com.sap.vocabularies.Common.v1"/>
</edmx:Reference>
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml">
<edmx:Include Alias="Core" Namespace="Org.OData.Core.V1"/>
</edmx:Reference>
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Measures.V1.xml">
<edmx:Include Alias="Measures" Namespace="Org.OData.Measures.V1"/>
</edmx:Reference>
<edmx:Reference Uri="https://wiki.scn.sap.com/wiki/download/attachments/448470968/UI.xml?api=v2">
<edmx:Include Alias="UI" Namespace="com.sap.vocabularies.UI.v1"/>
</edmx:Reference>
<edmx:DataServices>
<Schema Namespace="CatalogService" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<EntityContainer Name="EntityContainer">
<EntitySet Name="Currencies" EntityType="CatalogService.Currencies">
<NavigationPropertyBinding Path="texts" Target="Currencies_texts"/>
<NavigationPropertyBinding Path="localized" Target="Currencies_texts"/>
</EntitySet>
<EntitySet Name="Currencies_texts" EntityType="CatalogService.Currencies_texts"/>
<EntitySet Name="Products" EntityType="CatalogService.Products">
<NavigationPropertyBinding Path="currency" Target="Currencies"/>
<NavigationPropertyBinding Path="supplier" Target="Suppliers"/>
<NavigationPropertyBinding Path="texts" Target="Products_texts"/>
<NavigationPropertyBinding Path="localized" Target="Products_texts"/>
</EntitySet>
<EntitySet Name="Products_texts" EntityType="CatalogService.Products_texts"/>
<EntitySet Name="Suppliers" EntityType="CatalogService.Suppliers">
<NavigationPropertyBinding Path="products" Target="Products"/>
</EntitySet>
</EntityContainer>
<EntityType Name="Currencies">
<Key>
<PropertyRef Name="code"/>
</Key>
<Property Name="name" Type="Edm.String" MaxLength="255"/>
<Property Name="descr" Type="Edm.String" MaxLength="1000"/>
<Property Name="code" Type="Edm.String" MaxLength="3" Nullable="false"/>
<Property Name="symbol" Type="Edm.String" MaxLength="2"/>
<NavigationProperty Name="texts" Type="Collection(CatalogService.Currencies_texts)">
<OnDelete Action="Cascade"/>
</NavigationProperty>
<NavigationProperty Name="localized" Type="CatalogService.Currencies_texts">
<ReferentialConstraint Property="code" ReferencedProperty="code"/>
</NavigationProperty>
</EntityType>
<EntityType Name="Currencies_texts">
<Key>
<PropertyRef Name="locale"/>
<PropertyRef Name="code"/>
</Key>
<Property Name="locale" Type="Edm.String" MaxLength="5" Nullable="false"/>
<Property Name="name" Type="Edm.String" MaxLength="255"/>
<Property Name="descr" Type="Edm.String" MaxLength="1000"/>
<Property Name="code" Type="Edm.String" MaxLength="3" Nullable="false"/>
</EntityType>
<EntityType Name="Products">
<Key>
<PropertyRef Name="ID"/>
</Key>
<Property Name="ID" Type="Edm.Guid" Nullable="false"/>
<Property Name="identifier" Type="Edm.String"/>
<Property Name="title" Type="Edm.String"/>
<Property Name="description" Type="Edm.String"/>
<Property Name="availability" Type="Edm.Int32"/>
<Property Name="storageCapacity" Type="Edm.Int32"/>
<Property Name="criticality" Type="Edm.Int32"/>
<Property Name="price" Type="Edm.Decimal" Scale="2" Precision="9"/>
<NavigationProperty Name="currency" Type="CatalogService.Currencies">
<ReferentialConstraint Property="currency_code" ReferencedProperty="code"/>
</NavigationProperty>
<NavigationProperty Name="supplier" Type="CatalogService.Suppliers" Partner="products">
<ReferentialConstraint Property="supplier_ID" ReferencedProperty="ID"/>
</NavigationProperty>
<Property Name="image_url" Type="Edm.String"/>
<NavigationProperty Name="texts" Type="Collection(CatalogService.Products_texts)">
<OnDelete Action="Cascade"/>
</NavigationProperty>
<NavigationProperty Name="localized" Type="CatalogService.Products_texts">
<ReferentialConstraint Property="ID" ReferencedProperty="ID"/>
</NavigationProperty>
<Property Name="currency_code" Type="Edm.String" MaxLength="3"/>
<Property Name="supplier_ID" Type="Edm.Guid"/>
</EntityType>
<EntityType Name="Products_texts">
<Key>
<PropertyRef Name="locale"/>
<PropertyRef Name="ID"/>
</Key>
<Property Name="locale" Type="Edm.String" MaxLength="5" Nullable="false"/>
<Property Name="ID" Type="Edm.Guid" Nullable="false"/>
<Property Name="title" Type="Edm.String"/>
<Property Name="description" Type="Edm.String"/>
</EntityType>
<EntityType Name="Suppliers">
<Key>
<PropertyRef Name="ID"/>
</Key>
<Property Name="ID" Type="Edm.Guid" Nullable="false"/>
<Property Name="identifier" Type="Edm.String"/>
<Property Name="name" Type="Edm.String"/>
<Property Name="phone" Type="Edm.String"/>
<Property Name="building" Type="Edm.String"/>
<Property Name="street" Type="Edm.String"/>
<Property Name="postCode" Type="Edm.String"/>
<Property Name="city" Type="Edm.String"/>
<Property Name="country" Type="Edm.String"/>
<NavigationProperty Name="products" Type="Collection(CatalogService.Products)" Partner="supplier"/>
</EntityType>
<Annotations Target="CatalogService.Currencies">
<Annotation Term="UI.Identification">
<Collection>
<Path>name</Path>
</Collection>
</Annotation>
</Annotations>
<Annotations Target="CatalogService.Currencies/name">
<Annotation Term="Common.Label" String="Name"/>
</Annotations>
<Annotations Target="CatalogService.Currencies/descr">
<Annotation Term="Common.Label" String="Description"/>
</Annotations>
<Annotations Target="CatalogService.Currencies/code">
<Annotation Term="Common.Label" String="Currency Code"/>
</Annotations>
<Annotations Target="CatalogService.Currencies/symbol">
<Annotation Term="Common.Label" String="Currency Symbol"/>
</Annotations>
<Annotations Target="CatalogService.Currencies_texts/name">
<Annotation Term="Common.Label" String="Name"/>
</Annotations>
<Annotations Target="CatalogService.Currencies_texts/descr">
<Annotation Term="Common.Label" String="Description"/>
</Annotations>
<Annotations Target="CatalogService.Currencies_texts/code">
<Annotation Term="Common.Label" String="Currency Code"/>
</Annotations>
<Annotations Target="CatalogService.Products">
<Annotation Term="UI.DataPoint" Qualifier="Price">
<Record Type="UI.DataPointType">
<PropertyValue Property="Title" String="Price"/>
<PropertyValue Property="Value" Path="price"/>
</Record>
</Annotation>
<Annotation Term="UI.Facets">
<Collection>
<Record Type="UI.CollectionFacet">
<PropertyValue Property="Label" String="Product Information"/>
<PropertyValue Property="Facets">
<Collection>
<Record Type="UI.ReferenceFacet">
<PropertyValue Property="Target" AnnotationPath="@UI.FieldGroup#Description"/>
<PropertyValue Property="Label" String="Description"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Collection>
</Annotation>
<Annotation Term="UI.FieldGroup" Qualifier="Description">
<Record Type="UI.FieldGroupType">
<PropertyValue Property="Data">
<Collection>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="description"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="UI.FieldGroup" Qualifier="ProductDetail">
<Record Type="UI.FieldGroupType">
<PropertyValue Property="Data">
<Collection>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="identifier"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="availability"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="UI.FieldGroup" Qualifier="SupplierDetail">
<Record Type="UI.FieldGroupType">
<PropertyValue Property="Data">
<Collection>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="supplier/identifier"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="supplier/postCode"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="supplier/phone"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="UI.HeaderFacets">
<Collection>
<Record Type="UI.ReferenceFacet">
<PropertyValue Property="Target" AnnotationPath="@UI.FieldGroup#ProductDetail"/>
<PropertyValue Property="Label" String="Details"/>
</Record>
<Record Type="UI.ReferenceFacet">
<PropertyValue Property="Target" AnnotationPath="@UI.FieldGroup#SupplierDetail"/>
<PropertyValue Property="Label" String="Supplier"/>
</Record>
<Record Type="UI.ReferenceFacet">
<PropertyValue Property="Target" AnnotationPath="@UI.DataPoint#Price"/>
</Record>
</Collection>
</Annotation>
<Annotation Term="UI.HeaderInfo">
<Record Type="UI.HeaderInfoType">
<PropertyValue Property="Title">
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="title"/>
</Record>
</PropertyValue>
<PropertyValue Property="TypeName" String="Product"/>
<PropertyValue Property="TypeNamePlural" String="Products"/>
</Record>
</Annotation>
<Annotation Term="UI.LineItem">
<Collection>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="image_url"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="identifier"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="title"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="availability"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="price"/>
</Record>
</Collection>
</Annotation>
<Annotation Term="UI.SelectionFields">
<Collection>
<PropertyPath>identifier</PropertyPath>
<PropertyPath>title</PropertyPath>
<PropertyPath>availability</PropertyPath>
<PropertyPath>price</PropertyPath>
</Collection>
</Annotation>
</Annotations>
<Annotations Target="CatalogService.Products/ID">
<Annotation Term="Common.Label" String="ProductID"/>
</Annotations>
<Annotations Target="CatalogService.Products/identifier">
<Annotation Term="Common.Label" String="ID"/>
</Annotations>
<Annotations Target="CatalogService.Products/title">
<Annotation Term="Common.Label" String="Name"/>
</Annotations>
<Annotations Target="CatalogService.Products/description">
<Annotation Term="Common.Label" String="Description"/>
</Annotations>
<Annotations Target="CatalogService.Products/availability">
<Annotation Term="Common.Label" String="In Stock"/>
</Annotations>
<Annotations Target="CatalogService.Products/price">
<Annotation Term="Common.Label" String="Price"/>
<Annotation Term="Measures.ISOCurrency" Path="currency_code"/>
</Annotations>
<Annotations Target="CatalogService.Products/currency">
<Annotation Term="Common.Label" String="Currency"/>
<Annotation Term="Common.ValueList">
<Record Type="Common.ValueListType">
<PropertyValue Property="Label" String="Currency"/>
<PropertyValue Property="CollectionPath" String="Currencies"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="currency_code"/>
<PropertyValue Property="ValueListProperty" String="code"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="name"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="Core.Description" String="A currency code as specified in ISO 4217"/>
</Annotations>
<Annotations Target="CatalogService.Products/image_url">
<Annotation Term="Common.Label" String="Image"/>
<Annotation Term="UI.IsImageURL" Bool="true"/>
</Annotations>
<Annotations Target="CatalogService.Products/currency_code">
<Annotation Term="Common.Label" String="Currency"/>
<Annotation Term="Common.ValueList">
<Record Type="Common.ValueListType">
<PropertyValue Property="Label" String="Currency"/>
<PropertyValue Property="CollectionPath" String="Currencies"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="currency_code"/>
<PropertyValue Property="ValueListProperty" String="code"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="name"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="Core.Description" String="A currency code as specified in ISO 4217"/>
</Annotations>
<Annotations Target="CatalogService.Products_texts/ID">
<Annotation Term="Common.Label" String="UUID"/>
</Annotations>
<Annotations Target="CatalogService.Products_texts/title">
<Annotation Term="Common.Label" String="Name"/>
</Annotations>
<Annotations Target="CatalogService.Suppliers/identifier">
<Annotation Term="Common.Label" String="Name"/>
<Annotation Term="Common.Text" Path="name">
<Annotation Term="UI.TextArrangement" EnumMember="UI.TextArrangementType/TextFirst"/>
</Annotation>
</Annotations>
<Annotations Target="CatalogService.Suppliers/phone">
<Annotation Term="Common.Label" String="Phone"/>
</Annotations>
<Annotations Target="CatalogService.Suppliers/postCode">
<Annotation Term="Common.Label" String="City"/>
<Annotation Term="Common.Text" Path="city">
<Annotation Term="UI.TextArrangement" EnumMember="UI.TextArrangementType/TextFirst"/>
</Annotation>
</Annotations>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

View File

@@ -0,0 +1,155 @@
{
"_version": "1.15.0",
"sap.app": {
"id": "supplier.suppliers",
"type": "application",
"i18n": "i18n/i18n.properties",
"applicationVersion": {
"version": "1.0"
},
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"ach": "CA-UI5-FE",
"dataSources": {
"mainService": {
"uri": "/catalog/",
"type": "OData",
"settings": {
"odataVersion": "4.0"
}
}
},
"offline": false,
"resources": "resources.json",
"sourceTemplate": {
"id": "ui5template.fiorielements.v4.lrop",
"version": "1.0.0"
}
},
"sap.ui": {
"technology": "UI5",
"icons": {
"icon": "",
"favIcon": "",
"phone": "",
"phone@2": "",
"tablet": "",
"tablet@2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
}
},
"sap.ui5": {
"resources": {
"js": [],
"css": []
},
"dependencies": {
"minUI5Version": "1.71.0",
"libs": {
"sap.fe": {}
}
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"uri": "i18n/i18n.properties"
},
"": {
"dataSource": "mainService",
"settings": {
"synchronizationMode": "None",
"operationMode": "Server",
"autoExpandSelect": true,
"earlyRequests": true
}
}
},
"routing": {
"routes": [
{
"pattern": "",
"name": "SuppliersList",
"target": "SuppliersList"
},
{
"pattern": "Suppliers({key})",
"name": "SuppliersObjectPage",
"target": "SuppliersObjectPage"
},
{
"pattern": "Suppliers({key})/texts({key2})",
"name": "Currencies_textsObjectPage",
"target": "Currencies_textsObjectPage"
}
],
"targets": {
"SuppliersList": {
"type": "Component",
"id": "SuppliersList",
"name": "sap.fe.templates.ListReport",
"options": {
"settings": {
"entitySet": "Suppliers",
"variantManagement": "Page",
"navigation": {
"Suppliers": {
"detail": {
"route": "SuppliersObjectPage"
}
}
}
}
}
},
"SuppliersObjectPage": {
"type": "Component",
"id": "SuppliersObjectPage",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings": {
"entitySet": "Suppliers",
"navigation": {
"texts": {
"detail": {
"route": "Currencies_textsObjectPage"
}
}
}
}
}
},
"Currencies_textsObjectPage": {
"type": "Component",
"id": "Currencies_textsObjectPage",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings": {
"entitySet": "Currencies_texts"
}
}
}
}
},
"contentDensities": {
"compact": true,
"cozy": true
}
},
"sap.platform.abap": {
"_version": "1.1.0",
"uri": ""
},
"sap.platform.hcp": {
"_version": "1.1.0",
"uri": ""
},
"sap.fiori": {
"_version": "1.1.0",
"registrationIds": [],
"archeType": "transactional"
}
}

View File

@@ -0,0 +1,16 @@
{
"welcomeFile": "/index.html",
"authenticationMethod": "none",
"routes": [
{
"source": "^/catalog/(.*)$",
"target": "/catalog/$1",
"destination": "odata",
"csrfProtection": false
},
{
"source": "^(.*)",
"localDir": "webapp"
}
]
}

View File

@@ -0,0 +1,7 @@
ID,IDENTIFIER,TITLE,DESCRIPTION,AVAILABILITY,STORAGE_CAPACITY,CRITICALITY,PRICE,CURRENCY_CODE,SUPPLIER_ID,IMAGE_URL
844ede5c-071e-34ed-907f-f99cb3a4693d,MC-CM-1003,Tea- / Coffee-Mug,Robust high-quality ceramic mug for every-day use in two unobstrusive colours.,153,200,0,2.65,USD,8b001df1-dab2-39a2-8b1a-89b6b445e237,https://github.wdf.sap.corp/raw/FE-SAMPLES/fe-samples-tutorial-playground01/master/images/mug.png
64d40922-ea0d-30f9-9b83-eb4448ee4c2e,MC-CH-1000,Coat Hangers,"Set of high-quality hangers with coated surface, trouser bar - anti slip. Super slim design - space saving - The hooks can be rotated through 360 degree rotation, practical for various room situations. Material: ABS (plastic); Colour: turquoise.",10,200,3,2.6,USD,12726eec-165c-3713-a674-3d2fc4f5127f,https://github.wdf.sap.corp/raw/FE-SAMPLES/fe-samples-tutorial-playground01/master/images/hanger1.png
a6756d40-792e-34c9-8b2e-df3acb0c54b4,MC-CH-1001,Coat Hangers,"Set of high-quality hangers with coated surface, trouser bar - anti slip. Super slim design - space saving - The hooks can be rotated through 360 degree rotation, practical for various room situations. Material: ABS (plastic); Colour: assorted (2 of each pink, grey, blue green, black).",34,200,2,21.73,USD,12726eec-165c-3713-a674-3d2fc4f5127f,https://github.wdf.sap.corp/raw/FE-SAMPLES/fe-samples-tutorial-playground01/master/images/hanger2.png
37f028f0-1dd5-30ae-9cdd-a7f543e4d61d,MC-CH-1002,Wooden Coat Hangers - Pack of 5,"Pack of 5 quality wooden hangers with trouser bar. Slim design for space saving - The hooks can be rotated through 360 degree rotation, practical for various room situations. Material: ABS (plastic); Colour: assorted (2 of each pink, grey, blue green, black).",5,200,2,6.4,USD,8b001df1-dab2-39a2-8b1a-89b6b445e237,https://github.wdf.sap.corp/raw/FE-SAMPLES/fe-samples-tutorial-playground01/master/images/hanger3.png
a376e380-00e8-3d90-ba9f-c332c2df0f28,MC-CH-1003,Designer Coat Hooks - Pack of 3,Pack of 3 designer coat hook. Heavy-duty stainless steel hooks in a stylish shape.,6,200,1,6.49,USD,8b001df1-dab2-39a2-8b1a-89b6b445e237,https://github.wdf.sap.corp/raw/FE-SAMPLES/fe-samples-tutorial-playground01/master/images/hanger4.png
fc16c43d-bb4e-30db-8b7e-98b3fdc7f0b9,MC-CH-1004,Vacuum Wall Hook - Pack of 6,"Big suction cup with diameter of 70mm, can load more than 10kg; bright contemporary colour; Principle of work: Atmospheric pressure, safely and easy to install and tear off, no need to drill a hole or add glue, without any damage to the surface; can be used on a variety of surfaces, including paint, glasses, wood, ceramic tile, gypsum, and any other smooth surface.",17,200,0,5.76,USD,12726eec-165c-3713-a674-3d2fc4f5127f,https://github.wdf.sap.corp/raw/FE-SAMPLES/fe-samples-tutorial-playground01/master/images/hanger4.png
1 ID IDENTIFIER TITLE DESCRIPTION AVAILABILITY STORAGE_CAPACITY CRITICALITY PRICE CURRENCY_CODE SUPPLIER_ID IMAGE_URL
2 844ede5c-071e-34ed-907f-f99cb3a4693d MC-CM-1003 Tea- / Coffee-Mug Robust high-quality ceramic mug for every-day use in two unobstrusive colours. 153 200 0 2.65 USD 8b001df1-dab2-39a2-8b1a-89b6b445e237 https://github.wdf.sap.corp/raw/FE-SAMPLES/fe-samples-tutorial-playground01/master/images/mug.png
3 64d40922-ea0d-30f9-9b83-eb4448ee4c2e MC-CH-1000 Coat Hangers Set of high-quality hangers with coated surface, trouser bar - anti slip. Super slim design - space saving - The hooks can be rotated through 360 degree rotation, practical for various room situations. Material: ABS (plastic); Colour: turquoise. 10 200 3 2.6 USD 12726eec-165c-3713-a674-3d2fc4f5127f https://github.wdf.sap.corp/raw/FE-SAMPLES/fe-samples-tutorial-playground01/master/images/hanger1.png
4 a6756d40-792e-34c9-8b2e-df3acb0c54b4 MC-CH-1001 Coat Hangers Set of high-quality hangers with coated surface, trouser bar - anti slip. Super slim design - space saving - The hooks can be rotated through 360 degree rotation, practical for various room situations. Material: ABS (plastic); Colour: assorted (2 of each pink, grey, blue green, black). 34 200 2 21.73 USD 12726eec-165c-3713-a674-3d2fc4f5127f https://github.wdf.sap.corp/raw/FE-SAMPLES/fe-samples-tutorial-playground01/master/images/hanger2.png
5 37f028f0-1dd5-30ae-9cdd-a7f543e4d61d MC-CH-1002 Wooden Coat Hangers - Pack of 5 Pack of 5 quality wooden hangers with trouser bar. Slim design for space saving - The hooks can be rotated through 360 degree rotation, practical for various room situations. Material: ABS (plastic); Colour: assorted (2 of each pink, grey, blue green, black). 5 200 2 6.4 USD 8b001df1-dab2-39a2-8b1a-89b6b445e237 https://github.wdf.sap.corp/raw/FE-SAMPLES/fe-samples-tutorial-playground01/master/images/hanger3.png
6 a376e380-00e8-3d90-ba9f-c332c2df0f28 MC-CH-1003 Designer Coat Hooks - Pack of 3 Pack of 3 designer coat hook. Heavy-duty stainless steel hooks in a stylish shape. 6 200 1 6.49 USD 8b001df1-dab2-39a2-8b1a-89b6b445e237 https://github.wdf.sap.corp/raw/FE-SAMPLES/fe-samples-tutorial-playground01/master/images/hanger4.png
7 fc16c43d-bb4e-30db-8b7e-98b3fdc7f0b9 MC-CH-1004 Vacuum Wall Hook - Pack of 6 Big suction cup with diameter of 70mm, can load more than 10kg; bright contemporary colour; Principle of work: Atmospheric pressure, safely and easy to install and tear off, no need to drill a hole or add glue, without any damage to the surface; can be used on a variety of surfaces, including paint, glasses, wood, ceramic tile, gypsum, and any other smooth surface. 17 200 0 5.76 USD 12726eec-165c-3713-a674-3d2fc4f5127f https://github.wdf.sap.corp/raw/FE-SAMPLES/fe-samples-tutorial-playground01/master/images/hanger4.png

View File

@@ -0,0 +1,16 @@
ID,IDENTIFIER,NAME,COUNTRY,POSTCODE,CITY,STREET,BUILDING,PHONE
12726eec-165c-3713-a674-3d2fc4f5127f,OFFIPOR,OffiPOR,PR,Guaynabo,PR 00968,City View Plaza,301,+1 787-38515864
9655e5b6-bd8c-31ee-b94a-0651449721a0,POLIRADO,POLirado,PL,Warszawa,02-675,Ul. Woloska,5,+48 883 77522087
f1fd8dd5-3156-3469-b4f1-a03ff5041080,REGULCUST,Regular Custom Ltd,GB,Knutsford,WA16 6DW,King Street,25,+44 1565 47759991
bb2fa1e5-5c3a-3d26-b5c1-ed53f3e08622,OFFICEGURU,Office-Guru AG,DE,Siegen,57078,Birlenbacher Str.,19-21,+49 271 7722547
b91f077f-2086-3517-8244-d3b50835651b,MEINRESSORT,Mein Ressort GmbH,CH,Regensdorf,8105,Althardstrasse,80,+41 44 84008483
8b001df1-dab2-39a2-8b1a-89b6b445e237,OFFICELINE,Office Line Prag,CZ,Praha,140 00,Vyskocilova,1481/4,+420 776 9487923
3c7e6cbb-ea0f-35d2-a2ce-c85057a57916,DEPOT4ALL,Depot-4All,DE,Freiberg a. N.,71691,Grundelbachstrasse,10,+49 7141 2463585
41b46958-5ad7-30b6-9884-b547c1e26b7e,ITELOFFICE,ITeL-Office,DE,Dresden,01187,Chemnitzer Strasse,48,+49 351 31915489
7c5a5e3a-6dfa-35d3-8bf4-0cadbddb761a,FAMOUSUS,FamousUS,US,Houston,TX 77098,2601 Westheimer Road,Suite C250,+1 713-12001085
36de419f-0a4c-3a5a-b285-188979ce13ec,CHINACHAIN,ChinaChain,CN,Guangzhou,510613,No. 233 Tien He Road North,6402-6403,+86 20 86454650
41b922ad-35d9-352d-80c7-ee63ba1c007c,FAMOUSUS1,FamousUS (LV),US,Las Vegas,NV 89118,W Sunset Rd,3620,+1 702-486454400
b4b3188c-fa27-3467-a38a-f36ede8acc18,FAMOUSUS2,FamousUS (SF),US,South San Francisco,CA 94080,Forbes Blvd,401,+1 650-486454500
b5f1b294-a102-38e1-88c5-9b4d9ff0dd33,FAMOUSUS3,FamousUS (NY),US,New York,NY 10128,3rd Ave,1588,+1 212-486454600
391da904-9acd-334b-885e-4b4da38f3c6e,FAMOUSUS4,FamousUS (ORL),US,Orlando,FL 32806,W Sturtevant St,47,+1 407-486454700
1f6aed3b-bac0-39e5-ba5b-c091b0d18f40,FAMOUSUS5,FamousUS (NSH),US,Nashville,TN 37211,Space Park S Dr,486-810,+1 615-486454800
1 ID IDENTIFIER NAME COUNTRY POSTCODE CITY STREET BUILDING PHONE
2 12726eec-165c-3713-a674-3d2fc4f5127f OFFIPOR OffiPOR PR Guaynabo PR 00968 City View Plaza 301 +1 787-38515864
3 9655e5b6-bd8c-31ee-b94a-0651449721a0 POLIRADO POLirado PL Warszawa 02-675 Ul. Woloska 5 +48 883 77522087
4 f1fd8dd5-3156-3469-b4f1-a03ff5041080 REGULCUST Regular Custom Ltd GB Knutsford WA16 6DW King Street 25 +44 1565 47759991
5 bb2fa1e5-5c3a-3d26-b5c1-ed53f3e08622 OFFICEGURU Office-Guru AG DE Siegen 57078 Birlenbacher Str. 19-21 +49 271 7722547
6 b91f077f-2086-3517-8244-d3b50835651b MEINRESSORT Mein Ressort GmbH CH Regensdorf 8105 Althardstrasse 80 +41 44 84008483
7 8b001df1-dab2-39a2-8b1a-89b6b445e237 OFFICELINE Office Line Prag CZ Praha 140 00 Vyskocilova 1481/4 +420 776 9487923
8 3c7e6cbb-ea0f-35d2-a2ce-c85057a57916 DEPOT4ALL Depot-4All DE Freiberg a. N. 71691 Grundelbachstrasse 10 +49 7141 2463585
9 41b46958-5ad7-30b6-9884-b547c1e26b7e ITELOFFICE ITeL-Office DE Dresden 01187 Chemnitzer Strasse 48 +49 351 31915489
10 7c5a5e3a-6dfa-35d3-8bf4-0cadbddb761a FAMOUSUS FamousUS US Houston TX 77098 2601 Westheimer Road Suite C250 +1 713-12001085
11 36de419f-0a4c-3a5a-b285-188979ce13ec CHINACHAIN ChinaChain CN Guangzhou 510613 No. 233 Tien He Road North 6402-6403 +86 20 86454650
12 41b922ad-35d9-352d-80c7-ee63ba1c007c FAMOUSUS1 FamousUS (LV) US Las Vegas NV 89118 W Sunset Rd 3620 +1 702-486454400
13 b4b3188c-fa27-3467-a38a-f36ede8acc18 FAMOUSUS2 FamousUS (SF) US South San Francisco CA 94080 Forbes Blvd 401 +1 650-486454500
14 b5f1b294-a102-38e1-88c5-9b4d9ff0dd33 FAMOUSUS3 FamousUS (NY) US New York NY 10128 3rd Ave 1588 +1 212-486454600
15 391da904-9acd-334b-885e-4b4da38f3c6e FAMOUSUS4 FamousUS (ORL) US Orlando FL 32806 W Sturtevant St 47 +1 407-486454700
16 1f6aed3b-bac0-39e5-ba5b-c091b0d18f40 FAMOUSUS5 FamousUS (NSH) US Nashville TN 37211 Space Park S Dr 486-810 +1 615-486454800

View File

@@ -0,0 +1,5 @@
"SYMBOL";"DESCR";"NAME";"CODE"
"";"Euro";"Euro";"EUR"
"£";"British Pound";"British Pound";"GBP"
"";"Indian Rupee";"Indian Rupee";"INR"
"$";"US Dollar";"US Dollar";"USD"
1 SYMBOL DESCR NAME CODE
2 Euro Euro EUR
3 £ British Pound British Pound GBP
4 Indian Rupee Indian Rupee INR
5 $ US Dollar US Dollar USD

Some files were not shown because too many files have changed in this diff Show More