This repository has been archived by the owner on Nov 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
service-models_without_ERP-integration.backup
203 lines (175 loc) · 7.17 KB
/
service-models_without_ERP-integration.backup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
using {sap.samples.authorreadings as armodels} from '../db/entity-models';
using sap from '@sap/cds/common';
// ----------------------------------------------------------------------------
// Service for "author reading managers"
service AuthorReadingManager @(
path : 'authorreadingmanager',
impl : './service-implementation.js'
) {
// ----------------------------------------------------------------------------
// Entity inclusions
// Currencies
entity Currencies as projection on sap.common.Currencies;
// Author readings (combined with remote project using mixin)
@odata.draft.enabled
entity AuthorReadings as select from armodels.AuthorReadings
/* Relevant for ERP integration
mixin {
toProject: Association to RemoteProject.ProjectCollection on toProject.ProjectID = $projection.projectID
}
into */ {
*,
virtual null as statusCriticality : Integer @title : '{i18n>statusCriticality}',
virtual null as createProjectEnabled : Boolean @title : '{i18n>createProjectEnabled}' @odata.Type : 'Edm.Boolean',
/* Relevant for ERP integration
toProject,
*/
}
actions {
@(
Common.SideEffects : {TargetEntities : ['_authorreading']},
cds.odata.bindingparameter.name : '_authorreading'
)
action block() returns AuthorReadings;
@(
Common.SideEffects : {TargetEntities : ['_authorreading']},
cds.odata.bindingparameter.name : '_authorreading'
)
action publish() returns AuthorReadings;
/* Relevant for ERP integration
@(
Common.SideEffects : {TargetEntities: ['_authorreading','_authorreading/toProject']},
cds.odata.bindingparameter.name : '_authorreading'
)
action createProject() returns AuthorReadings;
*/
};
// Participants
entity Participants as projection on armodels.Participants {
*,
virtual null as statusCriticality : Integer @title : '{i18n>statusCriticality}',
} actions {
@(
Common.SideEffects : {TargetEntities : [
'_participant',
'_participant/parent'
]},
cds.odata.bindingparameter.name : '_participant'
)
action cancelParticipation() returns Participants;
@(
Common.SideEffects : {TargetEntities : [
'_participant',
'_participant/parent'
]},
cds.odata.bindingparameter.name : '_participant'
)
action confirmParticipation() returns Participants;
};
// ----------------------------------------------------------------------------
// Function to get user information (example for entity-independend function)
type userRoles {
identified : Boolean;
authenticated : Boolean;
};
type user {
user : String;
locale : String;
roles : userRoles
};
function userInfo() returns user;
};
// -------------------------------------------------------------------------------
// Extend service AuthorReadingManager by ByD projects (principal propagation)
/* Relevant for ERP integration
using { byd_khproject as RemoteProject } from './external/byd_khproject';
extend service AuthorReadingManager with {
entity Projects as projection on RemoteProject.ProjectCollection {
key ObjectID as ID,
ProjectID as projectID,
ResponsibleCostCentreID as costCenter,
ProjectTypeCode as typeCode,
ProjectTypeCodeText as typeCodeText,
ProjectLifeCycleStatusCode as statusCode,
ProjectLifeCycleStatusCodeText as statusCodeText,
BlockingStatusCode as blockingStatusCode,
PlannedStartDateTime as startDateTime,
PlannedEndDateTime as endDateTime,
ProjectSummaryTask as summaryTask : redirected to ProjectSummaryTasks,
Task as task : redirected to ProjectTasks
}
entity ProjectSummaryTasks as projection on RemoteProject.ProjectSummaryTaskCollection {
key ObjectID as ID,
ParentObjectID as parentID,
ID as taskID,
ProjectName as projectName,
ResponsibleEmployeeID as responsibleEmployee,
ResponsibleEmployeeFormattedName as responsibleEmployeeName
}
entity ProjectTasks as projection on RemoteProject.TaskCollection {
key ObjectID as ID,
ParentObjectID as parentID,
TaskID as taskID,
TaskName as taskName,
PlannedDuration as duration,
ResponsibleEmployeeID as responsibleEmployee,
ResponsibleEmployeeFormattedName as responsibleEmployeeName
}
};
*/
// -------------------------------------------------------------------------------
// Extend service AuthorReadingManager by ByD projects (technical users)
/* Relevant for ERP integration
using { byd_khproject_tech_user as RemoteProjectTechUser } from './external/byd_khproject_tech_user';
extend service AuthorReadingManager with {
entity ProjectsTechUser as projection on RemoteProjectTechUser.ProjectCollection {
key ObjectID as ID,
ProjectID as projectID,
ResponsibleCostCentreID as costCenter,
ProjectTypeCode as typeCode,
ProjectTypeCodeText as typeCodeText,
ProjectLifeCycleStatusCode as statusCode,
ProjectLifeCycleStatusCodeText as statusCodeText,
BlockingStatusCode as blockingStatusCode,
PlannedStartDateTime as startDateTime,
PlannedEndDateTime as endDateTime
}
};
*/
// -------------------------------------------------------------------------------
// Annotations for data privacy
annotate AuthorReadingManager.AuthorReadings with @PersonalData : {
DataSubjectRole : 'AuthorReadings',
EntitySemantics : 'DataSubject'
}
{
ID @PersonalData.FieldSemantics : 'DataSubjectID';
identifier @PersonalData.FieldSemantics : 'DataSubjectID';
description @PersonalData.FieldSemantics : 'DataSubjectID';
participantsFeeAmount @PersonalData.IsPotentiallySensitive;
}
annotate AuthorReadingManager.Participants with @PersonalData : {
DataSubjectRole : 'AuthorReadings',
EntitySemantics : 'DataSubjectDetails'
}
{
ID @PersonalData.FieldSemantics : 'DataSubjectID';
identifier @PersonalData.FieldSemantics : 'DataSubjectID';
parent @PersonalData.FieldSemantics : 'DataSubjectID';
name @PersonalData.IsPotentiallyPersonal;
email @PersonalData.IsPotentiallySensitive;
mobileNumber @PersonalData.IsPotentiallySensitive;
}
// Annotations for audit logging
annotate AuthorReadingManager.AuthorReadings with @AuditLog.Operation : {
Read : true,
Insert : true,
Update : true,
Delete : true
};
annotate AuthorReadingManager.Participants with @AuditLog.Operation : {
Read : true,
Insert : true,
Update : true,
Delete : true
};