-
Notifications
You must be signed in to change notification settings - Fork 156
/
Copy pathfield-control.cds
78 lines (68 loc) · 2.68 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
74
75
76
77
78
using TravelService from '../../srv/travel-service';
//
// annotations that control the behavior of fields and actions
//
annotate TravelService.Travel with @(Common.SideEffects: {
SourceProperties: [BookingFee],
TargetProperties: ['TotalPrice']
}){
BookingFee @Common.FieldControl : TravelStatus.fieldControl;
BeginDate @Common.FieldControl : TravelStatus.fieldControl;
EndDate @Common.FieldControl : TravelStatus.fieldControl;
Agency @Common.FieldControl : TravelStatus.fieldControl;
Customer @Common.FieldControl : TravelStatus.fieldControl;
} actions {
rejectTravel @(
Core.OperationAvailable : { $edmJson: { $Ne: [{ $Path: 'in/TravelStatus_code'}, 'X']}},
Common.SideEffects.TargetProperties : ['in/TravelStatus_code'],
);
acceptTravel @(
Core.OperationAvailable : { $edmJson: { $Ne: [{ $Path: 'in/TravelStatus_code'}, 'A']}},
Common.SideEffects.TargetProperties : ['in/TravelStatus_code'],
);
deductDiscount @(
Core.OperationAvailable : { $edmJson: { $Eq: [{ $Path: 'in/TravelStatus_code'}, 'O']}}
);
}
annotate TravelService.Travel @(
Common.SideEffects#ReactonItemCreationOrDeletion : {
SourceEntities : [
Bookings
],
TargetProperties : [
'TotalPrice'
]
}
);
annotate TravelService.Booking with @UI.CreateHidden : Travel.TravelStatus.createDeleteHidden;
annotate TravelService.Booking with @UI.DeleteHidden : Travel.TravelStatus.createDeleteHidden;
annotate TravelService.Booking {
BookingDate @Core.Computed;
ConnectionID @Common.FieldControl : Travel.TravelStatus.fieldControl;
FlightDate @Common.FieldControl : Travel.TravelStatus.fieldControl;
FlightPrice @Common.FieldControl : Travel.TravelStatus.fieldControl;
BookingStatus @Common.FieldControl : Travel.TravelStatus.fieldControl;
Carrier @Common.FieldControl : Travel.TravelStatus.fieldControl;
Customer @Common.FieldControl : Travel.TravelStatus.fieldControl;
};
annotate TravelService.Booking with @(
Capabilities.NavigationRestrictions : {
RestrictedProperties : [
{
NavigationProperty : BookSupplements,
InsertRestrictions : {
Insertable : Travel.TravelStatus.insertDeleteRestriction
},
DeleteRestrictions : {
Deletable : Travel.TravelStatus.insertDeleteRestriction
}
}
]
}
);
annotate TravelService.BookingSupplement {
Price @Common.FieldControl : Travel.TravelStatus.fieldControl;
Supplement @Common.FieldControl : Travel.TravelStatus.fieldControl;
Booking @Common.FieldControl : Travel.TravelStatus.fieldControl;
Travel @Common.FieldControl : Travel.TravelStatus.fieldControl;
};