-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfield-control.cds
More file actions
58 lines (50 loc) · 2.21 KB
/
Copy pathfield-control.cds
File metadata and controls
58 lines (50 loc) · 2.21 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
using { TravelService } from '../../srv/travel-service';
//
// annotations that control the behavior of fields and actions
//
annotate TravelService.Travels with @(Common : {
SideEffects: {
SourceProperties: [BookingFee],
TargetProperties: ['TotalPrice']
},
}){
BookingFee @readonly: (Status.code = #Accepted) @mandatory: (Status.code != #Accepted);
BeginDate @readonly: (Status.code = #Accepted) @mandatory: (Status.code != #Accepted);
EndDate @readonly: (Status.code = #Accepted) @mandatory: (Status.code != #Accepted);
Agency @readonly: (Status.code = #Accepted) @mandatory: (Status.code != #Accepted);
Customer @readonly: (Status.code = #Accepted);// @mandatory: (Status.code != #Accepted);
} actions {
deductDiscount @(
Common.SideEffects.TargetProperties : ['in/TotalPrice', 'in/BookingFee'],
);
}
annotate TravelService.Travels @Common.SideEffects#ReactonItemCreationOrDeletion : {
SourceEntities : [ Bookings ],
TargetProperties : [ 'TotalPrice' ]
};
annotate TravelService.Bookings with @Common.SideEffects#UpdateFlight : {
SourceProperties : [ (Flight.ID), (Flight.date) ],
TargetEntities : ['Flight']
};
annotate TravelService.Bookings with @UI.CreateHidden : (Travel.Status.code != #Open);
annotate TravelService.Bookings with @UI.DeleteHidden : (Travel.Status.code != #Open);
annotate TravelService.Bookings {
BookingDate @readonly;
Flight @readonly: (Travel.Status.code = #Accepted) @mandatory: (Travel.Status.code != #Accepted);
FlightPrice @readonly: (Travel.Status.code = #Accepted) @mandatory: (Travel.Status.code != #Accepted);
};
annotate TravelService.Bookings with @Capabilities.NavigationRestrictions.RestrictedProperties : [
{
NavigationProperty : Supplements,
InsertRestrictions : {
Insertable : (Travel.Status.code = #Open)
},
DeleteRestrictions : {
Deletable : (Travel.Status.code = #Open)
}
}
];
annotate TravelService.Bookings.Supplements with @UI.CreateHidden : (up_.Travel.Status.code != #Open) {
Price @readonly: (up_.Travel.Status.code = #Accepted) @mandatory: (up_.Travel.Status.code != #Accepted);
booked @readonly: (up_.Travel.Status.code = #Accepted) @mandatory: (up_.Travel.Status.code != #Accepted);
};