Skip to content

Commit

Permalink
Remove "to_" prefix from associations
Browse files Browse the repository at this point in the history
  • Loading branch information
MattSchur committed Jun 16, 2023
1 parent da30d64 commit 9a0959c
Show file tree
Hide file tree
Showing 16 changed files with 162 additions and 162 deletions.
16 changes: 8 additions & 8 deletions app/labels.cds
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ annotate schema.Travel with @title: '{i18n>Travel}' {
BookingFee @title: '{i18n>BookingFee}' @Measures.ISOCurrency: CurrencyCode_code;
TotalPrice @title: '{i18n>TotalPrice}' @Measures.ISOCurrency: CurrencyCode_code;
TravelStatus @title: '{i18n>TravelStatus}' @Common.Text: TravelStatus.name @Common.TextArrangement: #TextOnly;
to_Customer @title: '{i18n>CustomerID}' @Common.Text: to_Customer.LastName;
to_Agency @title: '{i18n>AgencyID}' @Common.Text: to_Agency.Name;
Customer @title: '{i18n>CustomerID}' @Common.Text: Customer.LastName;
Agency @title: '{i18n>AgencyID}' @Common.Text: Agency.Name;
}

annotate schema.TravelStatus with {
Expand All @@ -23,16 +23,16 @@ annotate schema.TravelStatus with {

annotate schema.Booking with @title: '{i18n>Booking}' {
BookingUUID @UI.Hidden;
to_Travel @UI.Hidden;
Travel @UI.Hidden;
BookingID @title: '{i18n>BookingID}';
BookingDate @title: '{i18n>BookingDate}';
ConnectionID @title: '{i18n>ConnectionID}';
CurrencyCode @title: '{i18n>CurrencyCode}';
FlightDate @title: '{i18n>FlightDate}';
FlightPrice @title: '{i18n>FlightPrice}' @Measures.ISOCurrency: CurrencyCode_code;
BookingStatus @title: '{i18n>BookingStatus}' @Common.Text: BookingStatus.name @Common.TextArrangement: #TextOnly;
to_Carrier @title: '{i18n>AirlineID}' @Common.Text: to_Carrier.Name;
to_Customer @title: '{i18n>CustomerID}' @Common.Text: to_Customer.LastName;
Carrier @title: '{i18n>AirlineID}' @Common.Text: Carrier.Name;
Customer @title: '{i18n>CustomerID}' @Common.Text: Customer.LastName;
}

annotate schema.BookingStatus with {
Expand All @@ -41,9 +41,9 @@ annotate schema.BookingStatus with {

annotate schema.BookingSupplement with @title: '{i18n>BookingSupplement}' {
BookSupplUUID @UI.Hidden;
to_Booking @UI.Hidden;
to_Travel @UI.Hidden;
to_Supplement @title: '{i18n>SupplementID}' @Common.Text: to_Supplement.Description;
Booking @UI.Hidden;
Travel @UI.Hidden;
Supplement @title: '{i18n>SupplementID}' @Common.Text: Supplement.Description;
Price @title: '{i18n>Price}' @Measures.ISOCurrency: CurrencyCode_code;
BookingSupplementID @title: '{i18n>BookingSupplementID}';
CurrencyCode @title: '{i18n>CurrencyCode}';
Expand Down
20 changes: 10 additions & 10 deletions app/travel_analytics/annotations.cds
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,12 @@ annotate service.Bookings with @UI : {
}]
}],
FieldGroup #TravelInformation : { Data : [
{ Value : to_Travel.TravelID,
{ Value : Travel.TravelID,
Label : '{i18n>TravelID}' },
{ Value : to_Travel.Description },
{ Value : to_Travel.to_Agency.Name, },
{ Value : to_Travel.CustomerName, },
{ Value : to_Travel.TravelStatus.code,
{ Value : Travel.Description },
{ Value : Travel.Agency.Name, },
{ Value : Travel.CustomerName, },
{ Value : Travel.TravelStatus.code,
Label : '{i18n>Status}' }, // why does the label not come from below?
]},
FieldGroup #BookingInformation : { Data : [
Expand All @@ -368,15 +368,15 @@ annotate service.Bookings with @UI : {
]},
FieldGroup #FlightInformation : { Data : [
{ Value : airline, },
{ Value : to_Carrier.AirlinePicURL, },
{ Value : Carrier.AirlinePicURL, },
{ Value : ConnectionID },
// Java doesn't work with these association paths
// { Value : to_Flight.PlaneType },
// { Value : to_Flight.to_Connection.DepartureAirport.AirportID,
// { Value : Flight.PlaneType },
// { Value : Flight.to_Connection.DepartureAirport.AirportID,
// Label: '{i18n>DepartureAirport}' },
// { Value : to_Flight.to_Connection.DestinationAirport.AirportID,
// { Value : Flight.to_Connection.DestinationAirport.AirportID,
// Label: '{i18n>ArrivalAirport}' },
// { Value : to_Flight.to_Connection.Distance, },
// { Value : Flight.to_Connection.Distance, },

// Workaround:
{ Value : PlaneType },
Expand Down
36 changes: 18 additions & 18 deletions app/travel_processor/field-control.cds
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ annotate TravelService.Travel with @(Common.SideEffects: {
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;
Agency @Common.FieldControl : TravelStatus.fieldControl;
Customer @Common.FieldControl : TravelStatus.fieldControl;

} actions {
rejectTravel @(
Expand All @@ -31,37 +31,37 @@ annotate TravelService.Travel with @(Common.SideEffects: {
annotate TravelService.Travel @(
Common.SideEffects#ReactonItemCreationOrDeletion : {
SourceEntities : [
to_Booking
Bookings
],
TargetProperties : [
'TotalPrice'
]
}
);

annotate TravelService.Booking with @UI.CreateHidden : to_Travel.TravelStatus.createDeleteHidden;
annotate TravelService.Booking with @UI.DeleteHidden : to_Travel.TravelStatus.createDeleteHidden;
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 : 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;
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 : to_BookSupplement,
NavigationProperty : BookSupplements,
InsertRestrictions : {
Insertable : to_Travel.TravelStatus.insertDeleteRestriction
Insertable : Travel.TravelStatus.insertDeleteRestriction
},
DeleteRestrictions : {
Deletable : to_Travel.TravelStatus.insertDeleteRestriction
Deletable : Travel.TravelStatus.insertDeleteRestriction
}
}
]
Expand All @@ -70,9 +70,9 @@ annotate TravelService.Booking with @(


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;
Price @Common.FieldControl : Travel.TravelStatus.fieldControl;
Supplement @Common.FieldControl : Travel.TravelStatus.fieldControl;
Booking @Common.FieldControl : Travel.TravelStatus.fieldControl;
Travel @Common.FieldControl : Travel.TravelStatus.fieldControl;

};
30 changes: 15 additions & 15 deletions app/travel_processor/layouts.cds
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ annotate TravelService.Travel with @UI : {
}]
},
SelectionFields : [
to_Agency_AgencyID,
to_Customer_CustomerID,
Agency_AgencyID,
Customer_CustomerID,
TravelStatus_code
],
LineItem : [
Expand All @@ -46,11 +46,11 @@ annotate TravelService.Travel with @UI : {
@UI.Importance : #High
},
{
Value : to_Agency_AgencyID,
Value : Agency_AgencyID,
@HTML5.CssDefaults: {width:'16em'}
},
{
Value : to_Customer_CustomerID,
Value : Customer_CustomerID,
@UI.Importance : #High,
@HTML5.CssDefaults: {width:'14em'}
},
Expand Down Expand Up @@ -93,13 +93,13 @@ annotate TravelService.Travel with @UI : {
}, { // booking list
$Type : 'UI.ReferenceFacet',
ID : 'BookingList',
Target : 'to_Booking/@UI.PresentationVariant',
Target : 'Bookings/@UI.PresentationVariant',
Label : '{i18n>Bookings}'
}],
FieldGroup#TravelData : { Data : [
{ Value : TravelID },
{ Value : to_Agency_AgencyID },
{ Value : to_Customer_CustomerID },
{ Value : Agency_AgencyID },
{ Value : Customer_CustomerID },
{ Value : Description },
{
$Type : 'UI.DataField',
Expand Down Expand Up @@ -127,7 +127,7 @@ annotate TravelService.Booking with @UI : {
HeaderInfo : {
TypeName : '{i18n>Bookings}',
TypeNamePlural : '{i18n>Bookings}',
Title : { Value : to_Customer.LastName },
Title : { Value : Customer.LastName },
Description : { Value : BookingID }
},
PresentationVariant : {
Expand All @@ -140,11 +140,11 @@ annotate TravelService.Booking with @UI : {
},
SelectionFields : [],
LineItem : [
{ Value : to_Carrier.AirlinePicURL, Label : ' '},
{ Value : Carrier.AirlinePicURL, Label : ' '},
{ Value : BookingID },
{ Value : BookingDate },
{ Value : to_Customer_CustomerID },
{ Value : to_Carrier_AirlineID },
{ Value : Customer_CustomerID },
{ Value : Carrier_AirlineID },
{ Value : ConnectionID, Label : '{i18n>FlightNumber}' },
{ Value : FlightDate },
{ Value : FlightPrice },
Expand All @@ -171,21 +171,21 @@ annotate TravelService.Booking with @UI : {
}, { // supplements list
$Type : 'UI.ReferenceFacet',
ID : 'SupplementsList',
Target : 'to_BookSupplement/@UI.PresentationVariant',
Target : 'BookSupplements/@UI.PresentationVariant',
Label : '{i18n>BookingSupplements}'
}],
FieldGroup #GeneralInformation : { Data : [
{ Value : BookingID },
{ Value : BookingDate, },
{ Value : to_Customer_CustomerID },
{ Value : Customer_CustomerID },
{ Value : BookingDate, },
{ Value : BookingStatus_code,
Criticality : { $edmJson: { $If: [{$Eq: [{ $Path: 'BookingStatus_code'}, 'N']}, 2,
{ $If: [{$Eq: [{ $Path: 'BookingStatus_code'}, 'B']}, 3, 0] }] } }
}
]},
FieldGroup #Flight : { Data : [
{ Value : to_Carrier_AirlineID },
{ Value : Carrier_AirlineID },
{ Value : ConnectionID },
{ Value : FlightDate },
{ Value : FlightPrice }
Expand Down Expand Up @@ -213,7 +213,7 @@ annotate TravelService.BookingSupplement with @UI : {
},
LineItem : [
{ Value : BookingSupplementID },
{ Value : to_Supplement_SupplementID, Label : '{i18n>ProductID}' },
{ Value : Supplement_SupplementID, Label : '{i18n>ProductID}' },
{ Value : Price, Label : '{i18n>ProductPrice}' }
],
};
6 changes: 3 additions & 3 deletions app/travel_processor/webapp/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"target": "TravelObjectPage"
},
{
"pattern": "Travel({key})/to_Booking({key2}):?query:",
"pattern": "Travel({key})/Bookings({key2}):?query:",
"name": "BookingObjectPage",
"target": "BookingObjectPage"
}
Expand Down Expand Up @@ -148,14 +148,14 @@
"settings": {
"entitySet": "Travel",
"navigation": {
"to_Booking": {
"Bookings": {
"detail": {
"route": "BookingObjectPage"
}
}
},
"controlConfiguration": {
"to_Booking/@com.sap.vocabularies.UI.v1.LineItem": {
"Bookings/@com.sap.vocabularies.UI.v1.LineItem": {
"tableSettings": {
"type": "ResponsiveTable",
"personalization": {
Expand Down
22 changes: 11 additions & 11 deletions app/travel_processor/webapp/test/integration/OpaJourney.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ sap.ui.define(["sap/ui/test/opaQunit"], function (opaTest) {
// Value help Agency ID
When.onTheDetailPage
.onForm({ section: "Travel", fieldGroup: "TravelData" })
.iOpenValueHelp({ property: "to_Agency_AgencyID" });
.iOpenValueHelp({ property: "Agency_AgencyID" });
When.onTheDetailPage.onValueHelpDialog().iSelectRows({ 0: "070006" });

// Value help Customer ID
When.onTheDetailPage
.onForm({ section: "Travel", fieldGroup: "TravelData" })
.iOpenValueHelp({ property: "to_Customer_CustomerID" });
.iOpenValueHelp({ property: "Customer_CustomerID" });
When.onTheDetailPage.onValueHelpDialog().iSelectRows({ 0: "000001" });

// Starting date
Expand Down Expand Up @@ -199,7 +199,7 @@ sap.ui.define(["sap/ui/test/opaQunit"], function (opaTest) {
When.onTheDetailPage.iGoToSection("Booking");
// Check buttons for bookings
Then.onTheDetailPage
.onTable({ property: "to_Booking" })
.onTable({ property: "Bookings" })
.iCheckDelete({ visible: false, enabled: false })
.and.iCheckCreate({ visible: false, enabled: false });

Expand All @@ -221,7 +221,7 @@ sap.ui.define(["sap/ui/test/opaQunit"], function (opaTest) {

When.onTheDetailPage.iGoToSection("General Information");
When.onTheDetailPage
.onTable({ property: "to_Booking" })
.onTable({ property: "Bookings" })
.iPressRow({ BookingID: "1" });

Then.onTheDetailItemPage.iSeeThisPage();
Expand All @@ -245,10 +245,10 @@ sap.ui.define(["sap/ui/test/opaQunit"], function (opaTest) {
// Check buttons for booking supplements
When.onTheDetailItemPage.iGoToSection("Booking Supplement");
When.onTheDetailItemPage
.onTable({ property: "to_BookSupplement" })
.onTable({ property: "BookSupplements" })
.iSelectRows({ BookingSupplementID: "1" });
Then.onTheDetailItemPage
.onTable({ property: "to_BookSupplement" })
.onTable({ property: "BookSupplements" })
.iCheckDelete({ visible: true, enabled: false })
.and.iCheckCreate({ visible: true, enabled: false });

Expand Down Expand Up @@ -276,10 +276,10 @@ sap.ui.define(["sap/ui/test/opaQunit"], function (opaTest) {
When.onTheDetailPage.iGoToSection("Booking");
// Check buttons
When.onTheDetailPage
.onTable({ property: "to_Booking" })
.onTable({ property: "Bookings" })
.iSelectRows({ BookingID: "2" });
Then.onTheDetailPage
.onTable({ property: "to_Booking" })
.onTable({ property: "Bookings" })
.iCheckDelete({ visible: true, enabled: true })
.and.iCheckCreate({ visible: true, enabled: true });

Expand All @@ -301,7 +301,7 @@ sap.ui.define(["sap/ui/test/opaQunit"], function (opaTest) {

When.onTheDetailPage.iGoToSection("General Information");
When.onTheDetailPage
.onTable({ property: "to_Booking" })
.onTable({ property: "Bookings" })
.iPressRow({ BookingID: "2" });

Then.onTheDetailItemPage.iSeeThisPage();
Expand All @@ -324,10 +324,10 @@ sap.ui.define(["sap/ui/test/opaQunit"], function (opaTest) {
// Check buttons for booking supplements
When.onTheDetailItemPage.iGoToSection("Booking Supplements");
When.onTheDetailItemPage
.onTable({ property: "to_BookSupplement" })
.onTable({ property: "BookSupplements" })
.iSelectRows({ BookingSupplementID: "1" });
Then.onTheDetailItemPage
.onTable({ property: "to_BookSupplement" })
.onTable({ property: "BookSupplements" })
.iCheckDelete({ visible: true, enabled: true })
.and.iCheckCreate({ visible: true, enabled: true });

Expand Down
Loading

0 comments on commit 9a0959c

Please sign in to comment.