forked from c-kobo/ui5con2023
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfield-control.cds
75 lines (61 loc) · 2.77 KB
/
field-control.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
using TravelService from '../srv/travel-service';
//
// annotations that control the behavior of fields and actions
//
// Workarounds for overly strict OData libs and clients
annotate cds.UUID with @Core.Computed @odata.Type : 'Edm.String';
annotate TravelService.Travel {
BookingFee @Common.FieldControl : TravelStatus.fieldControl;
BeginDate @Common.FieldControl : TravelStatus.fieldControl;
EndDate @Common.FieldControl : TravelStatus.fieldControl;
to_Agency @Common.FieldControl : TravelStatus.fieldControl;
to_Customer @Common.FieldControl : TravelStatus.fieldControl;
} actions {
rejectTravel @(
Core.OperationAvailable : { $edmJson: { $Ne: [{ $Path: 'in/TravelStatus_code'}, 'X']}},
Common : {SideEffects : {
$Type : 'Common.SideEffectsType',
TargetProperties : ['in/TravelStatus_code'],
TargetEntities : ['/TravelService.EntityContainer/Travel']
}}
);
acceptTravel @(
Core.OperationAvailable : { $edmJson: { $Ne: [{ $Path: 'in/TravelStatus_code'}, 'A']}},
Common : {SideEffects : {
$Type : 'Common.SideEffectsType',
TargetProperties : ['in/TravelStatus_code'],
TargetEntities : ['/TravelService.EntityContainer/Travel']
}}
);
}
annotate TravelService.Travel with @Common : {SideEffects #GoGreen : {
$Type : 'Common.SideEffectsType',
SourceProperties : [GoGreen],
TargetProperties : ['TotalPrice', 'GreenFee', 'TreesPlanted']
},
SideEffects #BookingFee: {
SourceProperties: [BookingFee],
TargetProperties: ['TotalPrice']
},
SideEffects #Bookings: {
$Type : 'Common.SideEffectsType',
SourceEntities : [to_Booking],
TargetProperties : ['TotalPrice']
}};
annotate TravelService.Booking with @UI.CreateHidden : to_Travel.TravelStatus.createDeleteHidden;
annotate TravelService.Booking {
BookingDate @Core.Computed;
ConnectionID @Common.FieldControl : to_Travel.TravelStatus.fieldControl;
FlightDate @Common.FieldControl : to_Travel.TravelStatus.fieldControl;
FlightPrice @Common.FieldControl : to_Travel.TravelStatus.fieldControl;
BookingStatus @Common.FieldControl : to_Travel.TravelStatus.fieldControl;
to_Carrier @Common.FieldControl : to_Travel.TravelStatus.fieldControl;
to_Customer @Common.FieldControl : to_Travel.TravelStatus.fieldControl;
};
annotate TravelService.BookingSupplement {
Price @Common.FieldControl : to_Travel.TravelStatus.fieldControl;
to_Supplement @Common.FieldControl : to_Travel.TravelStatus.fieldControl;
to_Booking @Common.FieldControl : to_Travel.TravelStatus.fieldControl;
to_Travel @Common.FieldControl : to_Travel.TravelStatus.fieldControl;
};
annotate Currency with @Common.UnitSpecificScale : 'Decimals';