pdm annotations

This commit is contained in:
Wolfgang Koch
2021-02-12 11:52:36 +01:00
parent caab8ed120
commit cd3f139544
2 changed files with 70 additions and 57 deletions

View File

@@ -1,37 +1,51 @@
// Proxy for importing schema from bookshop sample // Proxy for importing schema from bookshop sample
using { sap.capire.bookshop } from './schema'; using {sap.capire.bookshop} from './schema';
// annotations for Data Privacy // annotations for Data Privacy
annotate bookshop.Customers with @PersonalData.DataSubjectRole: 'Customer'; annotate bookshop.Customers with @PersonalData : {
annotate bookshop.Customers with @PersonalData.EntitySemantics: 'DataSubject' DataSubjectRole : 'Customer',
{ EntitySemantics : 'DataSubject'
ID @PersonalData.FieldSemantics: 'DataSubjectID'; }
{
ID @PersonalData.FieldSemantics : 'DataSubjectID';
emailAddress @PersonalData.IsPotentiallyPersonal; emailAddress @PersonalData.IsPotentiallyPersonal;
firstName @PersonalData.IsPotentiallyPersonal; firstName @PersonalData.IsPotentiallyPersonal;
lastName @PersonalData.IsPotentiallyPersonal; lastName @PersonalData.IsPotentiallyPersonal;
creditCardNo @PersonalData.IsPotentiallySensitive; creditCardNo @PersonalData.IsPotentiallySensitive;
dateOfBirth @PersonalData.IsPotentiallyPersonal; dateOfBirth @PersonalData.IsPotentiallyPersonal;
} }
annotate bookshop.CustomerPostalAddress with @PersonalData.DataSubjectRole: 'Customer'; annotate bookshop.CustomerPostalAddress with @PersonalData : {
annotate bookshop.CustomerPostalAddress with @PersonalData.EntitySemantics: 'DataSubjectDetails' DataSubjectRole : 'Customer',
{ EntitySemantics : 'DataSubjectDetails'
Customer @PersonalData.FieldSemantics: 'DataSubjectID'; }
{
Customer @PersonalData.FieldSemantics : 'DataSubjectID';
street @PersonalData.IsPotentiallyPersonal; street @PersonalData.IsPotentiallyPersonal;
town @PersonalData.IsPotentiallyPersonal; town @PersonalData.IsPotentiallyPersonal;
country @PersonalData.IsPotentiallyPersonal; country @PersonalData.IsPotentiallyPersonal;
} }
// annotations for Personal Data Manager - Search Fields // annotations for Personal Data Manager - Search Fields
annotate bookshop.Customers with @(Communication.Contact : { annotate bookshop.Customers with @(Communication.Contact : {
n : { n : {
surname: lastName, surname : lastName,
given: firstName given : firstName
}, },
bday: dateOfBirth bday : dateOfBirth
}); });
// annotations for Audit Log // annotations for Audit Log
annotate bookshop.Customers with @AuditLog.Operation: {Read: true, Insert: true, Update: true, Delete: true}; annotate bookshop.Customers with @AuditLog.Operation : {
Read : true,
Insert : true,
Update : true,
Delete : true
};
annotate bookshop.CustomerPostalAddress with @AuditLog.Operation: {Read: true, Insert: true, Update: true, Delete: true}; annotate bookshop.CustomerPostalAddress with @AuditLog.Operation : {
Read : true,
Insert : true,
Update : true,
Delete : true
};

View File

@@ -1,36 +1,35 @@
//using from '@capire/orders'; //using from '@capire/orders';
using { sap.capire.bookshop as db } from '../db/data-privacy'; using {sap.capire.bookshop as db} from '../db/data-privacy';
using { sap.capire.bookshop.Books } from '@capire/bookshop'; using {sap.capire.bookshop.Books} from '@capire/bookshop';
using { sap.capire.bookshop.Orders } from '@capire/orders'; using {sap.capire.bookshop.Orders} from '@capire/orders';
using { sap.capire.bookshop.OrderItems } from '@capire/orders'; using {sap.capire.bookshop.OrderItems} from '@capire/orders';
//@requires: 'system-user' // @requires:'system-user' - todo - security check
service PDMService { service PDMService{
entity Customers as projection on db.Customers; entity Customers as projection on db.Customers;
entity CustomerPostalAddress as projection on db.CustomerPostalAddress; entity CustomerPostalAddress as projection on db.CustomerPostalAddress;
// create view on Orders and Items as flat projection // create view on Orders and Items as flat projection
entity OrderItemView as entity OrderItemView as
SELECT from Orders select from Orders {
{ ID, ID,
key Items.ID as Item_ID, key Items.ID as Item_ID,
OrderNo, OrderNo,
Customer.ID as Customer_ID, Customer.ID as Customer_ID,
Customer.email as Customer_Email, Customer.email as Customer_Email,
Items.book.ID as Item_Book_ID, Items.book.ID as Item_Book_ID,
Items.amount as Item_Amount, Items.amount as Item_Amount,
Items.netAmount as Item_NetAmount}; Items.netAmount as Item_NetAmount
};
// annotate new view // annotate new view
annotate PDMService.OrderItemView with @(PersonalData.EntitySemantics: 'ContractRelated') annotate PDMService.OrderItemView with @(PersonalData.EntitySemantics : 'Other') {
{ Item_ID @PersonalData.FieldSemantics : 'ContractRelatedID';
Item_ID @PersonalData.FieldSemantics: 'LegalGroundID'; Customer_ID @PersonalData.FieldSemantics : 'DataSubjectID';
Customer_ID @PersonalData.FieldSemantics: 'DataSubjectID';
Customer_Email @PersonalData.IsPotentiallyPersonal; Customer_Email @PersonalData.IsPotentiallyPersonal;
}; };
// Data Privacy annotations on 'Customers' and 'CustomerPostalAddress' are derived from original entity definitions // Data Privacy annotations on 'Customers' and 'CustomerPostalAddress' are derived from original entity definitions
}; };