-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathfiori.cds
152 lines (127 loc) · 4.56 KB
/
fiori.cds
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
using { IncidentsService, acme.incmgt.Incidents, cuid } from '../srv/incidents-service';
annotate cuid:ID with @title: 'ID';
@odata.draft.enabled
annotate IncidentsService.Incidents with @(UI : {
// For Lists of Incidents
SelectionFields : [ urgency, status, service.type ],
LineItem : [
{ Value: title },
{ Value: urgency, Criticality : #Critical, CriticalityRepresentation : #WithoutIcon, },
{ Value: status },
{ Value: service.type },
],
// Information for the header area of Details Pages
HeaderInfo : {
TypeName : 'Incident',
TypeNamePlural : 'Incidents',
TypeImageUrl : 'sap-icon://alert',
Title : { Value: title },
},
// Facets for additional object header information (shown in the object page header)
HeaderFacets : [{
$Type : 'UI.ReferenceFacet',
Target : '@UI.FieldGroup#HeaderGeneralInformation'
}],
// Facets for Details Page of Incidents
Facets : [
{ Label: 'Overview', ID:'OverviewFacet', $Type: 'UI.CollectionFacet', Facets : [
{ Label: 'General Information', $Type: 'UI.ReferenceFacet', Target: '@UI.FieldGroup#GeneralInformation' },
{ Label: 'Details', $Type: 'UI.ReferenceFacet', Target: '@UI.FieldGroup#IncidentDetails' },
]},
{ Label: 'Conversation', $Type: 'UI.ReferenceFacet', Target: 'conversation/@UI.LineItem' }
],
FieldGroup #HeaderGeneralInformation : {
Data : [
{ Value: urgency },
{ Value: status },
{ Value: service.type },
{ Label: 'Worker', $Type : 'UI.DataFieldForAnnotation', Target : 'service/worker/@Communication.Contact' }
]
},
FieldGroup #IncidentDetails : {
Data : [
{ Value: ID },
{ Value: title },
]
},
FieldGroup #GeneralInformation: {
Data : [
{ Value: urgency, },
{ Value: service.type },
{ Value: status, },
],
},
});
annotate IncidentsService.Conversation with @(UI : {
LineItem : [
{ Value: timestamp },
{ Value: author },
{ Value: message }
],
HeaderInfo : {
TypeName : 'Message',
TypeNamePlural : 'Messages',
Title : { Value: message },
Description : { Value: timestamp },
},
Facets : [
{ Label: 'Details', $Type: 'UI.ReferenceFacet', Target: '@UI.FieldGroup#MessageDetails' },
],
FieldGroup #MessageDetails : {
Data: [
{ Value: message }
]
}
});
annotate IncidentsService.ServiceWorkers with @(Communication.Contact : {
fn : name,
kind : #individual,
role : role,
});
annotate IncidentsService.Appointments with @(UI : {
LineItem : [
{ Value: start_date },
{ Value: end_date },
{ Value: worker.name, Label : 'Assigned' }
]
});
// Reusable aspect for enums-based Value Helps
aspect EnumsCodeList @cds.autoexpose @cds.odata.valuelist {
key value: String @Common: { Text: label, TextArrangement: #TextOnly };
label : localized String;
descr : localized String;
}
// Value Help for Incidents.urgency
entity acme.incmgt.Incidents_urgency : EnumsCodeList {}; // REVISIT: Should be Incidents.urgency but this creates confusion with Incidents:urgency
extend entity Incidents with {
urgency_: Association to acme.incmgt.Incidents_urgency on urgency_.value = urgency; // REVISIT: we should get rid of unstable element order messages
extend urgency with @Common : { // REVISIT: we should also support keyword annotate here
Text: urgency_.label, TextArrangement : #TextOnly,
ValueListWithFixedValues,
ValueList: {
CollectionPath:'Incidents_urgency',
Parameters:[
{ $Type: 'Common.ValueListParameterInOut', LocalDataProperty: urgency, ValueListProperty: 'value' },
],
},
};
}
// Value Help for Incidents.status
entity acme.incmgt.Incidents_status : EnumsCodeList {}; // REVISIT: Should be Incidents.status but this creates confusion with Incidents:status
extend entity Incidents with {
status_: Association to acme.incmgt.Incidents_status on status_.value = status; // REVISIT: we should get rid of unstable element order messages
extend status with @Common : { // REVISIT: we should also support keyword annotate here
Text: status_.label, TextArrangement : #TextOnly,
ValueListWithFixedValues,
ValueList: {
CollectionPath:'Incidents_status', // REVISIT: Should be Incidents.Status but this doesn't work
Parameters:[
{ $Type: 'Common.ValueListParameterInOut', LocalDataProperty: status, ValueListProperty: 'value' },
],
},
};
}
// REVISIT: this is needed to make the 'conversation/@UI.LineItem' path work
extend service IncidentsService with {
entity Conversation as projection on Incidents.conversation;
}