Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .cdsrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"features": {
"compile_for_flows": true
"[flow]": {
"folders": {
"flow": "xmpls/flow/"
}
}
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ Alternatively start the application on the command line by executing:
mvn spring-boot:run -Dspring-boot.run.profiles=default,hybrid
```

## Additional Examples

For more (extensive) examples, have a look at the [readme file in the xmpls folder](./xmpls/readme.md).

## License

Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, version 2.0 except as noted otherwise in the [LICENSE](LICENSE) file.
4 changes: 4 additions & 0 deletions _i18n/i18n_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Agency=Agency
AgencyName=Agency Name
AvgPrice=Average Price
BeginDate=Starting Date
BlockTravel=Block Travel
Booking=Booking
BookingDate=Booking Date
BookingDetails=Booking Details
Expand Down Expand Up @@ -36,6 +37,8 @@ Prices=Prices
ProductID=Product
ProductPrice=Product Price
RejectTravel=Reject Travel
ReopenTravel=Reopen Travel
ReviewTravel=Review Travel
Status=Status
Street=Street
Title=Title
Expand All @@ -45,4 +48,5 @@ Travel=Travel
TravelAgency=Travel Agency
Travels=Travels
TravelStatus=Travel Status
UnblockTravel=Unblock Travel
WebAddress=Web Address
10 changes: 10 additions & 0 deletions app/labels.cds
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ annotate schema.Passengers with @title: '{i18n>Passenger}' {
}


using { TravelService } from '../srv/travel-service';

annotate TravelService.Travels with actions {
rejectTravel @title: '{i18n>RejectTravel}';
acceptTravel @title: '{i18n>AcceptTravel}';
reopenTravel @title: '{i18n>ReopenTravel}';
deductDiscount @title: '{i18n>DeductDiscount}';
};


using sap.capire.flights.data;

annotate data.Airlines with @title: '{i18n>Airline}' {
Expand Down
5 changes: 0 additions & 5 deletions app/travels/field-control.cds
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@ annotate TravelService.Travels with @(Common : {
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 {
rejectTravel @from: [#Open, #Accepted];
acceptTravel @from: [#Open, #Canceled];
deductDiscount @(
from: #Open,
Common.SideEffects.TargetProperties : ['in/TotalPrice', 'in/BookingFee'],
);
draftEdit @from: [#Open, #Accepted]
}

annotate TravelService.Travels @Common.SideEffects#ReactonItemCreationOrDeletion : {
Expand Down
14 changes: 5 additions & 9 deletions app/travels/layouts.cds
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ using { TravelService } from '../../srv/travel-service';
annotate TravelService.Travels with @UI : {

Identification : [
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.acceptTravel', Label : '{i18n>AcceptTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.rejectTravel', Label : '{i18n>RejectTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.deductDiscount', Label : '{i18n>DeductDiscount}' }
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.deductDiscount', Label : '{i18n>DeductDiscount}' },
],

HeaderInfo : {
Expand All @@ -35,8 +33,6 @@ annotate TravelService.Travels with @UI : {

LineItem : [

{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.acceptTravel', Label : '{i18n>AcceptTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.rejectTravel', Label : '{i18n>RejectTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.deductDiscount', Label : '{i18n>DeductDiscount}' },

{ Value : ID, @UI.Importance : #High },
Expand All @@ -50,8 +46,8 @@ annotate TravelService.Travels with @UI : {
{ Value : (Status.code),
Criticality : (
Status.code == #Accepted ? 3 :
Status.code == #Open ? 2 :
Status.code == #Canceled ? 1 : 0
Status.code == #Open OR Status.code == #InReview ? 2 :
Status.code == #Canceled OR Status.code == #Blocked ? 1 : 0
),
@UI.Importance : #High,
@HTML5.CssDefaults: {width:'10em'}
Expand All @@ -74,8 +70,8 @@ annotate TravelService.Travels with @UI : {
{ Value : (Status.code),
Criticality : (
Status.code == #Accepted ? 3 :
Status.code == #Open ? 2 :
Status.code == #Canceled ? 1 : 0
Status.code == #Open OR Status.code == #InReview ? 2 :
Status.code == #Canceled OR Status.code == #Blocked ? 1 : 0
),
},
{ Value : BeginDate },
Expand Down
2 changes: 2 additions & 0 deletions db/data/sap.capire.travels-TravelStatus.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
code;name
O;Open
R;InReview
B;Blocked
A;Accepted
X;Canceled
Loading