-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathannotations.cds
More file actions
194 lines (184 loc) · 6.41 KB
/
Copy pathannotations.cds
File metadata and controls
194 lines (184 loc) · 6.41 KB
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
using IncidentService as service from '../srv/incidentservice';
using from '../srv/common';
annotate service.Incidents with @(UI : {
//basic list report annotations
//the presentation variant defines a per default ascending sorting for the LR table
//https://github.com/SAP/odata-vocabularies/blob/master/vocabularies/Common.md#SortOrderType
// PresentationVariant : {
// SortOrder : [{
// $Type : 'Common.SortOrderType',
// Property : priority_code
// }],
// Visualizations : ['@UI.LineItem']
// },
//the lineItem annotation defines the table columns for UI display of the annotated entity
//https://github.com/SAP/odata-vocabularies/blob/master/vocabularies/UI.md#LineItem
//Table columns are defined by building blocks of type DataFieldAbstract
//https://github.com/SAP/odata-vocabularies/blob/master/vocabularies/UI.md#DataFieldAbstract
LineItem : [
{
$Type : 'UI.DataField',
Value : identifier
},
{
$Type : 'UI.DataField',
Value : priority_code,
Criticality : priority.criticality,
CriticalityRepresentation : #WithoutIcon
},
{
$Type : 'UI.DataField',
Value : incidentStatus_code
},
{
$Type : 'UI.DataField',
Value : category_code
},
//insert your line item enhancement here
{
$Type : 'UI.DataField',
Value : title
}
],
//the managed associations incidentStatus, category and priority provide a denormalized _code property to the root entity SafetIncidents
//Documentation managed associations: https://cap.cloud.sap/docs/guides/domain-models#use-managed-associations
//usage of aspect sap.common.codelist for the associated entities automatically provides value help support for the selection fields
//the entity definitions can be found in file db/schema.cds
//Documentation codelists: https://cap.cloud.sap/docs/cds/common#aspect-sapcommoncodelist
SelectionFields : [
incidentStatus_code,
priority_code,
//insert your selection fields enhancement here
category_code
],
// Information for the header area of an entity representation
HeaderInfo : {
TypeName : '{i18n>Incident}',
TypeNamePlural : '{i18n>Incidents}',
TypeImageUrl : 'sap-icon://alert',
Title : {Value : title},
Description : {Value : ID}
},
//Facets for additional object header information (shown in the object page header)
HeaderFacets : [{
$Type : 'UI.ReferenceFacet',
Target : '@UI.FieldGroup#HeaderGeneralInformation'
}],
//Group of fields with an optional label
//https://github.com/SAP/odata-vocabularies/blob/master/vocabularies/UI.md#FieldGroupType
FieldGroup #HeaderGeneralInformation : {
$Type : 'UI.FieldGroupType',
Data : [
{
Value : priority_code
},
{
Value : incidentStatus_code
},
{
Value : category_code
},
{
$Type : 'UI.DataFieldForAnnotation',
Target : 'assignedIndividual/@Communication.Contact',
Label : '{i18n>AssignedContact}'
}
]
},
FieldGroup #IncidentDetails : {
$Type : 'UI.FieldGroupType',
Data : [
{
$Type : 'UI.DataField',
Value : identifier
},
{
$Type : 'UI.DataField',
Value : title
},
//insert your field group enhancement here
{
$Type : 'UI.DataField',
Value : description
}
]
},
//insert your new field group here
FieldGroup #GeneralInformation : {
$Type : 'UI.FieldGroupType',
Data : [
{
$Type : 'UI.DataField',
Value : priority_code,
},
{
$Type : 'UI.DataField',
Value : category_code,
},
{
$Type : 'UI.DataField',
Value : incidentStatus_code,
},
],
},
//object page content area is organized by facets referring to e.g. fieldgroup and lineItem annotations
//https://github.com/SAP/odata-vocabularies/blob/master/vocabularies/UI.md#Facet
Facets : [
{
$Type : 'UI.CollectionFacet',
Label : '{i18n>IncidentOverview}',
ID : 'IncidentOverviewFacet',
Facets : [
{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>IncidentDetails}',
ID : 'IncidentDetailsFacet',
Target : '@UI.FieldGroup#IncidentDetails'
},
//insert your reference facet enhancement here
{
$Type : 'UI.ReferenceFacet',
Target : '@UI.FieldGroup#GeneralInformation',
Label : '{i18n>GeneralInformation}',
ID : 'GeneralInformationFacet',
},
]
},
//this facet shows a table on the object page by referring to a lineItem annotation via association incidentFlow
//the referred LineItem annotation definition for entity IncidentFlow is defined below
{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>IncidentProcessFlow}',
ID : 'ProcessFlowFacet',
Target : 'incidentFlow/@UI.LineItem',
![@UI.Hidden] : isDraft
}
]
});
annotate service.IncidentFlow with @(UI : {
LineItem : [
//insert your column enhancement here
{
$Type : 'UI.DataField',
Value : stepStatus,
Criticality : criticality,
},
{
$Type : 'UI.DataField',
Value : processStep
},
{
$Type : 'UI.DataField',
Value : stepStartDate
},
{
$Type : 'UI.DataField',
Value : stepEndDate
},
{
$Type : 'UI.DataField',
Value : incident.assignedIndividual.fullName,
Label : '{i18n>CreatedBy}'
}
]
});