<!DOCTYPE html>
<html style="height: 100%;">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Demo</title>
    <script
      id="sap-ui-bootstrap"
      src="https://openui5nightly.hana.ondemand.com/resources/sap-ui-core.js"
      data-sap-ui-async="true"
      data-sap-ui-theme="sap_fiori_3"
      data-sap-ui-compatVersion="edge"
      data-sap-ui-excludejquerycompat="true"
      data-sap-ui-resourceRoots='{"demo": "./"}'
      data-sap-ui-oninit="module:demo/index"
      data-sap-ui-modules="demo/localService/mockserver,demo/localService/simulatePreloaded,sap/ui/thirdparty/datajs,sap/ui/thirdparty/sinon"
      data-sap-ui-xx-componentPreload="off"
      data-sap-ui-xx-waitfortheme="init"
    ></script>
  </head>
  <body id="content" class="sapUiBody">
    <div style="height: 100%;"
      data-sap-ui-component
      data-id="rootComponentContainer"
      data-name="demo"
      data-height="100%"
      data-settings='{ "id": "rootComponent" }'
    ></div>
  </body>
</html>
sap.ui.define([
	"sap/ui/core/UIComponent",
	"sap/ui/Device",
], function(UIComponent, Device) {
	"use strict";

	return UIComponent.extend("demo.Component", {
		metadata: {
			manifest: "json",
      interfaces: [
        "sap.ui.core.IAsyncContentCreation"
      ]
		},

		init: function() {
			UIComponent.prototype.init.apply(this, arguments);
			this.getModel("device").setData(Device);
			this.setDensity().getRouter().initialize();
    },

    setDensity: function({
      styleClass = Device.system.desktop ? "sapUiSizeCompact" : "sapUiSizeCozy",
      targetElement = document.body,
    } = {}) {
      targetElement.classList.add(styleClass);
      return this;
    },

	});
});
{
  "_version": "1.33.0",
  "start_url": "index.html",
  "sap.app": {
    "id": "demo",
    "type": "application",
    "title": "Demo",
    "description": "Sample Code",
    "applicationVersion": {
      "version": "1.0.0"
    },
    "dataSources": {
      "RMTSAMPLEFLIGHT": {
        "uri": "/sampleService/",
        "type": "OData",
        "settings": {
          "odataVersion": "2.0"
        }
      }
    }
  },
  "sap.ui5": {
    "extends": {
      "extensions": {
        "sap.ui.controllerExtensions": {
          "demo.controller.Master": {
            "controllerNames": [
              "demo.controller.extension.Base"
            ]
          },
          "demo.controller.Detail": {
            "controllerNames": [
              "demo.controller.extension.Base",
              "demo.controller.extension.AddFlightDialog"
            ]
          }
        }
      }
    },
    "handleValidation": true,
    "dependencies": {
      "minUI5Version": "1.66.6",
      "libs": {
        "sap.ui.core": {},
        "sap.m": {},
        "sap.f": {},
        "sap.uxap": {},
        "sap.ui.unified": {},
        "sap.ui.layout": {}
      }
    },
    "resources": {
      "js": [

      ],
      "css": [

      ]
    },
    "contentDensities": {
      "compact": true,
      "cozy": true
    },
    "models": {
      "odata": {
        "dataSource": "RMTSAMPLEFLIGHT",
        "settings": {
          "defaultBindingMode": "TwoWay",
          "preliminaryContext": true,
          "useBatch": true,
          "skipMetadataAnnotationParsing": true
        },
        "preload": true
      },
      "device": {
        "type": "sap.ui.model.json.JSONModel"
      }
    },
    "rootView": {
      "viewName": "demo.view.App",
      "id": "rootView",
      "type": "XML",
      "async": true,
      "height": "100%"
    },
    "routing": {
      "routes": {
        "master": {
          "pattern": "",
          "target": "master",
          "layout": "OneColumn"
        }, 
        "masterDetail": {
          "pattern": "items/{itemId}",
          "target": [
            "master",
            "detail"
          ],
          "layout": "TwoColumnsMidExpanded"
        }
      },
      "targets": {
        "master": {
          "id": "masterView",
          "viewName": "Master",
          "controlAggregation": "beginColumnPages"
        },
        "detail": {
          "id": "detailView",
          "viewName": "Detail",
          "controlAggregation": "midColumnPages"
        }
      },
      "config": {
        "routerClass": "sap.f.routing.Router",
        "async": true,
        "viewType": "XML",
        "viewPath": "demo.view",
        "controlId": "fcl"
      }
    }
  },
  "sap.ui": {
    "technology": "UI5",
    "deviceTypes": {
      "desktop": true,
      "tablet": true,
      "phone": true
    }
  }
}
<mvc:View xmlns:mvc="sap.ui.core.mvc"
  xmlns:f="sap.f"
  xmlns="sap.m"
  displayBlock="true"
  height="100%"
>
  <App autoFocus="false">
    <f:FlexibleColumnLayout id="fcl">
      <f:beginColumnPages>
        <!-- will be added by router -->
      </f:beginColumnPages>
      <f:midColumnPages>
        <!-- will be added by router -->
      </f:midColumnPages>
      <f:endColumnPages>
        <!-- will be added by router -->
      </f:endColumnPages>
    </f:FlexibleColumnLayout>
  </App>
</mvc:View>
<mvc:View controllerName="demo.controller.Master"
  xmlns:mvc="sap.ui.core.mvc"
  xmlns="sap.m"
  xmlns:f="sap.f"
  xmlns:core="sap.ui.core"
  core:require="{ ODataStringType: 'sap/ui/model/odata/type/String' }"
>
  <f:DynamicPage id="dynamicPage"
    toggleHeaderOnTitleClick="false"
    fitContent="true"
    class="sapUiResponsiveContentPadding"
  >
    <f:title>
      <f:DynamicPageTitle id="dynamicPageTitle">
        <f:heading>
          <Title id="title" text="Carrier Flights"/>
        </f:heading>
      </f:DynamicPageTitle>
    </f:title>
    <f:content>
      <List id="list"
        class="sapFDynamicPageAlignContent"
        width="auto"
        mode="SingleSelectMaster"
        itemPress=".navTo('masterDetail', ${$parameters>/listItem})"
        items="{
          path: 'odata>/CarrierCollection',
          templateShareable: false
        }"
      >
        <ObjectListItem
          title="{
            path: 'odata>CARRNAME',
            type: 'ODataStringType'
          }"
          number="{
            path: 'odata>CURRCODE',
            type: 'ODataStringType'
          }"
          type="Navigation"
        />
      </List>
    </f:content>
  </f:DynamicPage>
</mvc:View>
<mvc:View controllerName="demo.controller.Detail"
  xmlns:mvc="sap.ui.core.mvc"
  xmlns="sap.m"
  xmlns:uxap="sap.uxap"
  xmlns:form="sap.ui.layout.form"
  xmlns:core="sap.ui.core"
  core:require="{
    ODataStringType: 'sap/ui/model/odata/type/String',
    ODataDateTimeType: 'sap/ui/model/odata/type/DateTime',
    ODataTimeType: 'sap/ui/model/odata/type/Time',
    CurrencyType: 'sap/ui/model/type/Currency'
  }"
>
  <uxap:ObjectPageLayout id="objectPageLayout"
    showAnchorBar="false"
    useIconTabBar="true"
    isChildPage="true"
  >
    <uxap:headerTitle>
      <uxap:ObjectPageHeader id="objectPageHeader"
        objectImageURI="sap-icon://flight"
        objectTitle="Carrier {odata>CARRNAME}"
        isObjectIconAlwaysVisible="true"
      >
        <uxap:ObjectPageHeaderActionButton id="toolbarBtn"
          text="Add"
          hideText="false"
          press=".onAddBtnPress"
        />
      </uxap:ObjectPageHeader>
    </uxap:headerTitle>
    <uxap:ObjectPageSection titleUppercase="false" showTitle="false">
      <uxap:ObjectPageSubSection title="Flights">
        <Table id="table" 
          class="sapUxAPObjectPageSubSectionAlignContent"
          width="auto"
          contextualWidth="Auto"
          popinLayout="GridSmall"
          sticky="ColumnHeaders"
          items="{
            path: 'odata>carrierFlights',
            templateShareable: false
          }"
        >
          <columns>
            <Column id="flightNumberColumn">
              <Label id="flightNumberLabel"
                text="Flight Number"
                labelFor="flightNumberColumn"
                wrapping="true"
              />
            </Column>
            <Column id="flightDateColumn"
              demandPopin="true"
              minScreenWidth="Tablet"
              popinDisplay="Inline"
              hAlign="Right"
            >
              <Label id="flightDateLabel"
                text="Flight Date"
                labelFor="flightDateColumn"
                wrapping="true"
              />
            </Column>
            <Column id="departureTimeColumn"
              demandPopin="true"
              minScreenWidth="Tablet"
              popinDisplay="Inline"
              hAlign="Right"
            >
              <Label id="departureTimeLabel"
                text="Departure Time"
                labelFor="departureTimeColumn"
                wrapping="true"
              />
            </Column>
            <Column id="ticketPriceColumn"
              demandPopin="true"
              minScreenWidth="300px"
              popinDisplay="Inline"
              hAlign="Right"
            >
              <Label id="ticketPriceLabel"
                text="Ticket Price"
                labelFor="ticketPriceColumn"
                wrapping="true"
              />
            </Column>
          </columns>
          <ColumnListItem>
            <Text text="{
              path: 'odata>connid',
              type: 'ODataStringType'
            }" />
            <Text text="{
              path: 'odata>fldate',
              type: 'ODataDateTimeType',
              formatOptions: {
                relative: true
              },
              constraints: {
                isDateOnly: true,
                displayFormat: 'Date'
              }
            }"/>
            <Text text="{
              path: 'odata>flightDetails/departureTime',
              type: 'ODataTimeType',
              formatOptions: {
                style: 'medium'
              }
            }"/>
            <Text text="{
              parts: [
                'odata>PRICE',
                'odata>CURRENCY'
              ],
              type: 'CurrencyType',
              formatOptions: {
                showMeasure: true
              }
            }"/>
          </ColumnListItem>
        </Table>
      </uxap:ObjectPageSubSection>
    </uxap:ObjectPageSection>
    <uxap:dependents>
      <core:Fragment
        fragmentName="demo.view.fragment.AddFlightDialog"
        type="XML"
      />
    </uxap:dependents>
  </uxap:ObjectPageLayout>
</mvc:View>
<Dialog id="dialog"
  xmlns="sap.m"
  xmlns:form="sap.ui.layout.form"
  xmlns:core="sap.ui.core"
  core:require="{
    'ODataStringType': 'sap/ui/model/odata/type/String',
    'ODataDateTimeType': 'sap/ui/model/odata/type/DateTime',
    'ODataTimeType': 'sap/ui/model/odata/type/Time',
    'CurrencyType': 'sap/ui/model/type/Currency'
  }"
  title="New Flight"
  draggable="true"
  stretch="{= !!${device>/system/phone}}"
  beforeOpen=".onBeforeDialogOpen"
  afterClose=".onAfterDialogClose"
>
  <form:SimpleForm id="form"
    editable="true"
    validateFieldGroup=".onValidateFieldGroup"
    fieldGroupIds="inputs"
  >
    <Label text="Flight Number"/>
    <Input
      fieldGroupIds="inputs"
      required="true"
      value="{
        path: 'odata>connid',
        type: 'ODataStringType',
        constraints: {
          isDigitSequence: true,
          maxLength: 4,
          nullable: false
        }
      }"
    ></Input>
    <Label text="Flight Date"></Label>
    <DatePicker
      fieldGroupIds="inputs"
      required="true"
      value="{
        path: 'odata>fldate',
        type: 'ODataDateTimeType',
        constraints: {
          isDateOnly: true,
          displayFormat: 'Date',
          nullable: false
        }
      }"
    ></DatePicker>
    <Label text="Departure Time"></Label>
    <TimePicker 
      fieldGroupIds="inputs"
      required="true"
      value="{
        path: 'odata>flightDetails/departureTime',
        type: 'ODataTimeType',
        formatOptions: {
          strictParsing: true
        },
        constraints: {
          nullable: false
        }
      }"
    /> <!-- Added time won't be displayed in the table since MockServer currently does not support updating complex types! See https://github.com/SAP/openui5/issues/471#issuecomment-282988369
    -->
    <Label text="Ticket Price"></Label>
    <Input
      fieldGroupIds="inputs"
      required="true"
      value="{
        parts: [
          'odata>PRICE',
          'odata>CURRENCY'
        ],
        type: 'CurrencyType',
        formatOptions: {
          showMeasure: true,
          currencyCode: true,
          currencyContext: 'accounting',
          emptyString: 0
        },
        constraints: {
          minimum: 1
        }
      }"
      placeholder="E.g.: 2222 &#8364;"
    />
  </form:SimpleForm>
  <beginButton>
    <Button id="addButton"
      text="Add"
      type="Emphasized"
      press=".onDialogAddPress"
    />
  </beginButton>
  <endButton>
    <Button id="cancelButton"
      text="Cancel"
      press=".onDialogCancelPress"
    />
  </endButton>
</Dialog>
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:gp="http://www.sap.com/Protocols/SAPData/GenericPlayer" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData" xmlns:ux="http://www.sap.com/Protocols/OData4SAP/UX" Version="1.0">
    <edmx:DataServices m:DataServiceVersion="2.0">
        <Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="RMTSAMPLEFLIGHT" xml:lang="de" sap:schema-version="1">
            <EntityType Name="Subscription" sap:semantics="subscriptions" sap:content-version="1">
                <Key>
                    <PropertyRef Name="ID" />
                </Key>
                <Property Name="ID" Type="Edm.String" Nullable="false" MaxLength="32" sap:label="Ab.-ID" sap:creatable="false" sap:updatable="false" sap:filterable="false" />
                <Property Name="user" Type="Edm.String" MaxLength="12" m:FC_TargetPath="SyndicationAuthorName" m:FC_KeepInContent="false" sap:label="Benutzername" sap:creatable="false" sap:filterable="false" />
                <Property Name="updated" Type="Edm.DateTime" Precision="0" m:FC_TargetPath="SyndicationUpdated" m:FC_KeepInContent="false" sap:label="Zeitstempel" sap:creatable="false" sap:filterable="false" />
                <Property Name="title" Type="Edm.String" MaxLength="255" m:FC_TargetPath="SyndicationTitle" m:FC_KeepInContent="false" sap:label="Titel" sap:filterable="false" />
                <Property Name="deliveryAddress" Type="Edm.String" sap:label="Lieferadresse" sap:filterable="false" />
                <Property Name="persistNotifications" Type="Edm.Boolean" sap:label="Benachr. persist." sap:filterable="false" />
                <Property Name="collection" Type="Edm.String" MaxLength="40" sap:label="Sammlung" sap:filterable="false" />
                <Property Name="filter" Type="Edm.String" sap:label="Filter" sap:filterable="false" />
                <Property Name="select" Type="Edm.String" MaxLength="255" sap:label="Markieren" sap:filterable="false" />
                <Property Name="changeType" Type="Edm.String" MaxLength="30" sap:label="Änderungsart" />
            </EntityType>
            <EntityType Name="Notification" sap:semantics="notifications" sap:content-version="1">
                <Key>
                    <PropertyRef Name="ID" />
                </Key>
                <Property Name="ID" Type="Edm.String" Nullable="false" MaxLength="32" sap:label="Benachr-ID" />
                <Property Name="collection" Type="Edm.String" MaxLength="40" sap:label="Sammlung" />
                <Property Name="title" Type="Edm.String" m:FC_TargetPath="SyndicationTitle" m:FC_KeepInContent="false" sap:label="Benachr.text" />
                <Property Name="updated" Type="Edm.DateTime" Precision="0" m:FC_TargetPath="SyndicationUpdated" m:FC_KeepInContent="false" sap:label="Zeitstempel" />
                <Property Name="changeType" Type="Edm.String" MaxLength="30" sap:label="Änderungsart" />
                <Property Name="entriesOfInterest" Type="Edm.Int32" sap:label="Anzahl Einträge" />
                <Property Name="recipient" Type="Edm.String" MaxLength="112" sap:label="Empfänger" sap:creatable="false" sap:updatable="false" />
            </EntityType>
            <EntityType Name="Flight" sap:content-version="1">
                <Key>
                    <PropertyRef Name="carrid" />
                    <PropertyRef Name="connid" />
                    <PropertyRef Name="fldate" />
                </Key>
                <Property Name="flightDetails" Type="RMTSAMPLEFLIGHT.FlightDetails" Nullable="false" />
                <Property Name="carrid" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Fluggesellschaft" />
                <Property Name="connid" Type="Edm.String" Nullable="false" MaxLength="4" sap:label="Flugnummer" />
                <Property Name="fldate" Type="Edm.DateTime" Nullable="false" Precision="0" sap:label="Flugdatum" />
                <Property Name="PRICE" Type="Edm.Decimal" Precision="15" Scale="2" sap:unit="CURRENCY" sap:label="Flugpreis" />
                <Property Name="CURRENCY" Type="Edm.String" MaxLength="5" sap:label="Währ. d. Flugg." sap:sortable="false" sap:semantics="currency-code" />
                <Property Name="PLANETYPE" Type="Edm.String" MaxLength="10" />
                <Property Name="SEATSMAX" Type="Edm.Int32" sap:label="Max. Belegung Eco." />
                <Property Name="SEATSOCC" Type="Edm.Int32" sap:label="Belegung Eco." />
                <Property Name="PAYMENTSUM" Type="Edm.Decimal" Precision="17" Scale="2" sap:label="Akt. Summe" />
                <Property Name="SEATSMAX_B" Type="Edm.Int32" sap:label="Max. Belegung Bus." />
                <Property Name="SEATSOCC_B" Type="Edm.Int32" sap:label="Belegung Bus." />
                <Property Name="SEATSMAX_F" Type="Edm.Int32" sap:label="Max. Belegung 1st." />
                <Property Name="SEATSOCC_F" Type="Edm.Int32" sap:label="Belegung 1st." />
                <NavigationProperty Name="flightbooking" Relationship="RMTSAMPLEFLIGHT.BookingFlight" FromRole="FromRole_BookingFlight" ToRole="ToRole_BookingFlight" />
                <NavigationProperty Name="flightBookings" Relationship="RMTSAMPLEFLIGHT.FlightBookings" FromRole="FromRole_FlightBookings" ToRole="ToRole_FlightBookings" />
                <NavigationProperty Name="FlightCarrier" Relationship="RMTSAMPLEFLIGHT.CarrierToFlight" FromRole="ToRole_CarrierToFlight" ToRole="FromRole_CarrierToFlight" />
                <NavigationProperty Name="FlightCarrier_FW" Relationship="RMTSAMPLEFLIGHT.CarrierToFlight" FromRole="ToRole_CarrierToFlight" ToRole="FromRole_CarrierToFlight" />
            </EntityType>
            <EntityType Name="Flight_DQ" sap:content-version="1">
                <Key>
                    <PropertyRef Name="carrid" />
                    <PropertyRef Name="connid" />
                    <PropertyRef Name="fldate" />
                </Key>
                <Property Name="carrid" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Fluggesellschaft" />
                <Property Name="connid" Type="Edm.String" Nullable="false" MaxLength="4" sap:label="Flugnummer" />
                <Property Name="fldate" Type="Edm.DateTime" Nullable="false" Precision="0" sap:label="Flugdatum" />
                <Property Name="PRICE" Type="Edm.Decimal" Precision="15" Scale="2" sap:unit="CURRENCY" sap:label="Flugpreis" />
                <Property Name="CURRENCY" Type="Edm.String" MaxLength="5" sap:label="Währ. d. Flugg." sap:sortable="false" sap:semantics="currency-code" />
                <Property Name="PLANETYPE" Type="Edm.String" MaxLength="10" />
                <Property Name="SEATSMAX" Type="Edm.Int32" sap:label="Max. Belegung Eco." />
                <Property Name="SEATSOCC" Type="Edm.Int32" sap:label="Belegung Eco." />
                <Property Name="PAYMENTSUM" Type="Edm.Decimal" Precision="17" Scale="2" sap:label="Akt. Summe" />
                <Property Name="SEATSMAX_B" Type="Edm.Int32" sap:label="Max. Belegung Bus." />
                <Property Name="SEATSOCC_B" Type="Edm.Int32" sap:label="Belegung Bus." />
                <Property Name="SEATSMAX_F" Type="Edm.Int32" sap:label="Max. Belegung 1st." />
                <Property Name="SEATSOCC_F" Type="Edm.Int32" sap:label="Belegung 1st." />
            </EntityType>
            <EntityType Name="Booking" sap:semantics="FLIGHT_BOOKING" sap:content-version="1">
                <Key>
                    <PropertyRef Name="carrid" />
                    <PropertyRef Name="connid" />
                    <PropertyRef Name="fldate" />
                    <PropertyRef Name="bookid" />
                </Key>
                <Property Name="carrid" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Fluggesellschaft" />
                <Property Name="connid" Type="Edm.String" Nullable="false" MaxLength="4" sap:label="Flugnummer" />
                <Property Name="fldate" Type="Edm.DateTime" Nullable="false" Precision="0" sap:label="Flugdatum" />
                <Property Name="bookid" Type="Edm.String" Nullable="false" MaxLength="8" sap:label="Buchungsnummer" />
                <Property Name="CUSTOMID" Type="Edm.String" MaxLength="8" sap:label="Kundennummer" />
                <Property Name="CUSTTYPE" Type="Edm.String" MaxLength="1" sap:label="G/P-Kunde" />
                <Property Name="SMOKER" Type="Edm.String" MaxLength="1" sap:label="Raucher" sap:value-list="standard" />
                <Property Name="WUNIT" Type="Edm.String" MaxLength="3" sap:label="Maßeinheit" sap:semantics="unit-of-measure" />
                <Property Name="LUGGWEIGHT" Type="Edm.String" MaxLength="9" sap:unit="WUNIT" sap:label="Gepäckgew." sap:value-list="fixed-values" />
                <Property Name="INVOICE" Type="Edm.String" MaxLength="1" sap:label="Rechnungsst." />
                <Property Name="CLASS" Type="Edm.String" MaxLength="1" sap:label="Klasse" />
                <Property Name="FORCURAM" Type="Edm.Decimal" Precision="15" Scale="14" sap:unit="FORCURKEY" sap:label="Betrag" />
                <Property Name="FORCURKEY" Type="Edm.String" MaxLength="5" sap:label="Zahl.Währung" sap:semantics="currency-code" />
                <Property Name="LOCCURAM" Type="Edm.Decimal" Precision="15" Scale="14" sap:unit="LOCCURKEY" sap:label="Betrag" />
                <Property Name="LOCCURKEY" Type="Edm.String" MaxLength="5" sap:label="Währ. d. Flugg." sap:semantics="currency-code" />
                <Property Name="ORDER_DATE" Type="Edm.DateTime" Precision="0" ConcurrencyMode="Fixed" sap:label="Buchungsdatum" sap:updatable="false" />
                <Property Name="COUNTER" Type="Edm.String" MaxLength="8" sap:label="Verkaufsstelle" sap:updatable="false" />
                <Property Name="AGENCYNUM" Type="Edm.String" MaxLength="8" sap:label="Reisebüronr." sap:updatable="false" />
                <Property Name="CANCELLED" Type="Edm.String" MaxLength="1" sap:label="Stornokennzeichen" sap:updatable="false" />
                <Property Name="RESERVED" Type="Edm.String" MaxLength="1" sap:label="reserviert" sap:updatable="false" />
                <Property Name="PASSNAME" Type="Edm.String" MaxLength="25" sap:label="Passagiername" />
                <Property Name="PASSFORM" Type="Edm.String" MaxLength="15" sap:label="Anrede" />
                <Property Name="PASSBIRTH" Type="Edm.DateTime" Precision="0" sap:label="Pass. Gebdatum" />
                <NavigationProperty Name="bookedFlight" Relationship="RMTSAMPLEFLIGHT.BookingFlight" FromRole="ToRole_BookingFlight" ToRole="FromRole_BookingFlight" gp:display-order="0111" />
                <NavigationProperty Name="bookedCarrier" Relationship="RMTSAMPLEFLIGHT.BookingCarrier" FromRole="ToRole_BookingCarrier" ToRole="FromRole_BookingCarrier" />
            </EntityType>
            <EntityType Name="Carrier" m:HasStream="true" sap:content-version="1">
                <Key>
                    <PropertyRef Name="carrid" />
                </Key>
                <Property Name="carrid" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Fluggesellschaft" />
                <Property Name="CARRNAME" Type="Edm.String" MaxLength="20" sap:label="Fluggesellschaft" />
                <Property Name="CURRCODE" Type="Edm.String" MaxLength="5" sap:label="Währ. d. Flugg." sap:semantics="currency-code" />
                <Property Name="URL" Type="Edm.String" MaxLength="255" sap:label="URL" sap:semantics="url" />
                <Property Name="mimeType" Type="Edm.String" MaxLength="128" sap:label="Mimetype" sap:filterable="false" />
                <NavigationProperty Name="carrierFlights" Relationship="RMTSAMPLEFLIGHT.CarrierToFlight" FromRole="FromRole_CarrierToFlight" ToRole="ToRole_CarrierToFlight" />
                <NavigationProperty Name="carrierFlights_FW" Relationship="RMTSAMPLEFLIGHT.CarrierToFlight" FromRole="FromRole_CarrierToFlight" ToRole="ToRole_CarrierToFlight" />
            </EntityType>
            <EntityType Name="Travelagency" ux:thing-name="travel agency" sap:content-version="1">
                <Key>
                    <PropertyRef Name="agencynum" />
                </Key>
                <Property Name="agencynum" Type="Edm.String" Nullable="false" MaxLength="8" sap:label="Reisebüronr." />
                <Property Name="NAME" Type="Edm.String" MaxLength="25" sap:label="Name des Reisebüros" />
                <Property Name="STREET" Type="Edm.String" MaxLength="30" sap:label="Strasse" />
                <Property Name="POSTBOX" Type="Edm.String" MaxLength="10" sap:label="Postfach" />
                <Property Name="POSTCODE" Type="Edm.String" MaxLength="10" sap:label="Postleitzahl" />
                <Property Name="CITY" Type="Edm.String" MaxLength="25" sap:label="Stadt" />
                <Property Name="COUNTRY" Type="Edm.String" MaxLength="3" sap:label="Land" />
                <Property Name="REGION" Type="Edm.String" MaxLength="3" sap:label="Region" />
                <Property Name="TELEPHONE" Type="Edm.String" MaxLength="30" sap:label="Telefon" />
                <Property Name="URL" Type="Edm.String" MaxLength="255" sap:label="URL des Reisebüros" />
                <Property Name="LANGU" Type="Edm.String" MaxLength="2" sap:label="Sprache" />
                <Property Name="CURRENCY" Type="Edm.String" MaxLength="5" sap:label="Reisebürowährung" sap:semantics="currency-code" />
                <Property Name="mimeType" Type="Edm.String" MaxLength="128" sap:label="Mimetype" />
            </EntityType>
            <EntityType Name="Travelagency_DQ" ux:thing-name="travel agency" sap:content-version="1">
                <Key>
                    <PropertyRef Name="agencynum" />
                </Key>
                <Property Name="agencynum" Type="Edm.String" Nullable="false" MaxLength="8" sap:label="Reisebüronr." />
                <Property Name="NAME" Type="Edm.String" MaxLength="25" sap:label="Name des Reisebüros" />
                <Property Name="STREET" Type="Edm.String" MaxLength="30" sap:label="Strasse" />
                <Property Name="POSTBOX" Type="Edm.String" MaxLength="10" sap:label="Postfach" />
                <Property Name="POSTCODE" Type="Edm.String" MaxLength="10" sap:label="Postleitzahl" />
                <Property Name="CITY" Type="Edm.String" MaxLength="25" sap:label="Stadt" />
                <Property Name="COUNTRY" Type="Edm.String" MaxLength="3" sap:label="Land" />
                <Property Name="REGION" Type="Edm.String" MaxLength="3" sap:label="Region" />
                <Property Name="TELEPHONE" Type="Edm.String" MaxLength="30" sap:label="Telefon" />
                <Property Name="URL" Type="Edm.String" MaxLength="255" sap:label="URL des Reisebüros" />
                <Property Name="LANGU" Type="Edm.String" MaxLength="2" sap:label="Sprache" />
                <Property Name="CURRENCY" Type="Edm.String" MaxLength="5" sap:label="Reisebürowährung" sap:semantics="currency-code" />
                <Property Name="mimeType" Type="Edm.String" MaxLength="128" sap:label="Mimetype" />
            </EntityType>
            <EntityType Name="VL_BOOK_SMOKER" sap:value-list="true" sap:content-version="1">
                <Key>
                    <PropertyRef Name="ID" />
                </Key>
                <Property Name="ID" Type="Edm.String" Nullable="false" sap:value-list="standard" />
                <Property Name="NAME" Type="Edm.String" />
            </EntityType>
            <EntityType Name="VL_VL_BOOK_SMOKER_ID" sap:value-list="true" sap:content-version="1">
                <Key>
                    <PropertyRef Name="ID" />
                </Key>
                <Property Name="ID" Type="Edm.String" Nullable="false" />
                <Property Name="NAME" Type="Edm.String" />
            </EntityType>
            <EntityType Name="VL_MY_CURR" sap:value-list="true" sap:content-version="1">
                <Key>
                    <PropertyRef Name="CURR_ID" />
                </Key>
                <Property Name="CURR_ID" Type="Edm.String" Nullable="false" />
                <Property Name="CURR_NAME" Type="Edm.String" />
                <NavigationProperty Name="NavProp1" Relationship="RMTSAMPLEFLIGHT.AssocForCURR" FromRole="FromRole_AssocForCURR" ToRole="ToRole_AssocForCURR" />
            </EntityType>
            <EntityType Name="VL_BOOK_ADDRESS_COUNTRY_DEEP" sap:value-list="true" sap:content-version="1">
                <Key>
                    <PropertyRef Name="CountryID" />
                </Key>
                <Property Name="CountryID" Type="Edm.String" Nullable="false" />
                <Property Name="Country" Type="Edm.String" />
            </EntityType>
            <EntityType Name="VL_CT_FLIGHT_DETAILS_AIRPORT_TO" sap:value-list="true" sap:content-version="1">
                <Key>
                    <PropertyRef Name="AirportID" />
                </Key>
                <Property Name="AirportID" Type="Edm.String" Nullable="false" />
                <Property Name="AirportName" Type="Edm.String" />
            </EntityType>
            <EntityType Name="VL_ACTION_PARAMETER_AIRLINE_ID" sap:value-list="true" sap:content-version="1">
                <Key>
                    <PropertyRef Name="AirlineID" />
                </Key>
                <Property Name="AirlineID" Type="Edm.String" Nullable="false" />
                <Property Name="Airline Name" Type="Edm.String" />
            </EntityType>
            <ComplexType Name="FlightDetails" gp:display-order="0010">
                <Property Name="countryFrom" Type="Edm.String" MaxLength="3" sap:label="Land" />
                <Property Name="cityFrom" Type="Edm.String" MaxLength="20" sap:label="Abflugstadt" />
                <Property Name="airportFrom" Type="Edm.String" MaxLength="3" sap:label="Startflugh." />
                <Property Name="countryTo" Type="Edm.String" MaxLength="3" sap:label="Land" />
                <Property Name="cityTo" Type="Edm.String" MaxLength="20" sap:label="Ankunftstadt" />
                <Property Name="airportTo" Type="Edm.String" MaxLength="3" sap:label="Zielflugh." />
                <Property Name="flightTime" Type="Edm.Int32" sap:label="Flugdauer" />
                <Property Name="departureTime" Type="Edm.Time" Precision="0" sap:label="Abflug" />
                <Property Name="arrivalTime" Type="Edm.Time" Precision="0" sap:label="Ankunftszeit" />
                <Property Name="distance" Type="Edm.Decimal" Precision="9" Scale="4" sap:unit="distanceUnit" sap:label="Entfernung" />
                <Property Name="distanceUnit" Type="Edm.String" MaxLength="3" sap:label="Entfernung in" sap:semantics="unit-of-measure" />
                <Property Name="flightType" Type="Edm.String" MaxLength="1" sap:label="Charter" />
                <Property Name="period" Type="Edm.Byte" sap:label="n Tag(e) später" />
            </ComplexType>
            <ComplexType Name="FlightAvailability">
                <Property Name="ECONOMAX" Type="Edm.Int32" sap:label="Max. Belegung Eco." />
                <Property Name="ECONOFREE" Type="Edm.Int32" sap:label="Freie Plätze" />
                <Property Name="BUSINMAX" Type="Edm.Int32" sap:label="Max. Belegung Bus." />
                <Property Name="BUSINFREE" Type="Edm.Int32" sap:label="Freie Plätze" />
                <Property Name="FIRSTMAX" Type="Edm.Int32" sap:label="Max. Belegung 1st." />
                <Property Name="FIRSTFREE" Type="Edm.Int32" sap:label="Freie Plätze" />
            </ComplexType>
            <ComplexType Name="FlightAvailability2" BaseType="RMTSAMPLEFLIGHT.FlightAvailability" />
            <Association Name="AssocForCURR" sap:content-version="1">
                <End Type="RMTSAMPLEFLIGHT.VL_MY_CURR" Multiplicity="1" Role="FromRole_AssocForCURR" />
                <End Type="RMTSAMPLEFLIGHT.Booking" Multiplicity="1" Role="ToRole_AssocForCURR" />
            </Association>
            <Association Name="BookingCarrier" sap:content-version="1">
                <End Type="RMTSAMPLEFLIGHT.Carrier" Multiplicity="1" Role="FromRole_BookingCarrier" />
                <End Type="RMTSAMPLEFLIGHT.Booking" Multiplicity="1" Role="ToRole_BookingCarrier" />
                <ReferentialConstraint>
                    <Principal Role="FromRole_BookingCarrier">
                        <PropertyRef Name="carrid" />
                    </Principal>
                    <Dependent Role="ToRole_BookingCarrier">
                        <PropertyRef Name="carrid" />
                    </Dependent>
                </ReferentialConstraint>
            </Association>
            <Association Name="CarrierToFlight" sap:content-version="1">
                <End Type="RMTSAMPLEFLIGHT.Carrier" Multiplicity="1" Role="FromRole_CarrierToFlight" />
                <End Type="RMTSAMPLEFLIGHT.Flight" Multiplicity="*" Role="ToRole_CarrierToFlight" />
                <ReferentialConstraint>
                    <Principal Role="FromRole_CarrierToFlight">
                        <PropertyRef Name="carrid" />
                    </Principal>
                    <Dependent Role="ToRole_CarrierToFlight">
                        <PropertyRef Name="carrid" />
                    </Dependent>
                </ReferentialConstraint>
            </Association>
            <Association Name="BookingFlight" sap:content-version="1">
                <End Type="RMTSAMPLEFLIGHT.Flight" Multiplicity="1" Role="FromRole_BookingFlight" />
                <End Type="RMTSAMPLEFLIGHT.Booking" Multiplicity="1" Role="ToRole_BookingFlight" />
                <ReferentialConstraint>
                    <Principal Role="FromRole_BookingFlight">
                        <PropertyRef Name="fldate" />
                        <PropertyRef Name="connid" />
                        <PropertyRef Name="carrid" />
                    </Principal>
                    <Dependent Role="ToRole_BookingFlight">
                        <PropertyRef Name="fldate" />
                        <PropertyRef Name="connid" />
                        <PropertyRef Name="carrid" />
                    </Dependent>
                </ReferentialConstraint>
            </Association>
            <Association Name="FlightBookings" sap:content-version="1">
                <End Type="RMTSAMPLEFLIGHT.Flight" Multiplicity="1" Role="FromRole_FlightBookings" />
                <End Type="RMTSAMPLEFLIGHT.Booking" Multiplicity="*" Role="ToRole_FlightBookings" />
                <ReferentialConstraint>
                    <Principal Role="FromRole_FlightBookings">
                        <PropertyRef Name="fldate" />
                        <PropertyRef Name="connid" />
                        <PropertyRef Name="carrid" />
                    </Principal>
                    <Dependent Role="ToRole_FlightBookings">
                        <PropertyRef Name="fldate" />
                        <PropertyRef Name="connid" />
                        <PropertyRef Name="carrid" />
                    </Dependent>
                </ReferentialConstraint>
            </Association>
            <EntityContainer Name="RMTSAMPLEFLIGHT_Entities" m:IsDefaultEntityContainer="true" sap:supported-formats="atom json xlsx">
                <EntitySet Name="BookingCollection" EntityType="RMTSAMPLEFLIGHT.Booking" sap:pageable="false" sap:content-version="1" />
                <EntitySet Name="CarrierCollection" EntityType="RMTSAMPLEFLIGHT.Carrier" sap:creatable="false" sap:deletable="false" sap:content-version="1" />
                <EntitySet Name="TravelagencyCollection" EntityType="RMTSAMPLEFLIGHT.Travelagency" sap:searchable="true" sap:content-version="1">
                    <gp:collectionLayout display-order="0010" top-level="true" />
                </EntitySet>
                <EntitySet Name="TravelAgencies" EntityType="RMTSAMPLEFLIGHT.Travelagency" sap:searchable="true" sap:content-version="1" />
                <EntitySet Name="TravelAgencies_DQ" EntityType="RMTSAMPLEFLIGHT.Travelagency_DQ" sap:searchable="true" sap:content-version="1" />
                <EntitySet Name="VL_BOOK_SMOKER_ES" EntityType="RMTSAMPLEFLIGHT.VL_BOOK_SMOKER" sap:content-version="1" />
                <EntitySet Name="VL_VL_BOOK_SMOKER_ID_ES" EntityType="RMTSAMPLEFLIGHT.VL_VL_BOOK_SMOKER_ID" sap:content-version="1" />
                <EntitySet Name="VL_MY_CURR_ES" EntityType="RMTSAMPLEFLIGHT.VL_MY_CURR" sap:content-version="1" />
                <EntitySet Name="VL_BOOK_ADDRESS_COUNTRY_DEEP_ES" EntityType="RMTSAMPLEFLIGHT.VL_BOOK_ADDRESS_COUNTRY_DEEP" sap:content-version="1" />
                <EntitySet Name="VL_CT_FLIGHT_DETAILS_AIRPORT_TO_ES" EntityType="RMTSAMPLEFLIGHT.VL_CT_FLIGHT_DETAILS_AIRPORT_TO" sap:content-version="1" />
                <EntitySet Name="VL_ACTION_PARAMETER_AIRLINE_ID_ES" EntityType="RMTSAMPLEFLIGHT.VL_ACTION_PARAMETER_AIRLINE_ID" sap:content-version="1" />
                <EntitySet Name="SubscriptionCollection" EntityType="RMTSAMPLEFLIGHT.Subscription" sap:content-version="1" />
                <EntitySet Name="NotificationCollection" EntityType="RMTSAMPLEFLIGHT.Notification" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:addressable="false" sap:content-version="1" />
                <EntitySet Name="FlightCollection" EntityType="RMTSAMPLEFLIGHT.Flight" sap:content-version="1">
                    <gp:collectionLayout display-order="0010" top-level="true" />
                </EntitySet>
                <EntitySet Name="FlightCollection_DQ" EntityType="RMTSAMPLEFLIGHT.Flight_DQ" sap:content-version="1" />
                <AssociationSet Name="AssocSet_BookingCarrier" Association="RMTSAMPLEFLIGHT.BookingCarrier" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
                    <End EntitySet="CarrierCollection" Role="FromRole_BookingCarrier" />
                    <End EntitySet="BookingCollection" Role="ToRole_BookingCarrier" />
                </AssociationSet>
                <AssociationSet Name="CarrierToFlight_AssocSet" Association="RMTSAMPLEFLIGHT.CarrierToFlight" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
                    <End EntitySet="CarrierCollection" Role="FromRole_CarrierToFlight" />
                    <End EntitySet="FlightCollection" Role="ToRole_CarrierToFlight" />
                </AssociationSet>
                <AssociationSet Name="AssocSet_AssocForCURR" Association="RMTSAMPLEFLIGHT.AssocForCURR" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
                    <End EntitySet="VL_MY_CURR_ES" Role="FromRole_AssocForCURR" />
                    <End EntitySet="BookingCollection" Role="ToRole_AssocForCURR" />
                </AssociationSet>
                <AssociationSet Name="AssocSet_FlightBookings" Association="RMTSAMPLEFLIGHT.FlightBookings" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
                    <End EntitySet="FlightCollection" Role="FromRole_FlightBookings" />
                    <End EntitySet="BookingCollection" Role="ToRole_FlightBookings" />
                </AssociationSet>
                <AssociationSet Name="AssocSet_BookingFlight" Association="RMTSAMPLEFLIGHT.BookingFlight" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
                    <End EntitySet="FlightCollection" Role="FromRole_BookingFlight" />
                    <End EntitySet="BookingCollection" Role="ToRole_BookingFlight" />
                </AssociationSet>
                <FunctionImport Name="CheckFlightAvailability" ReturnType="RMTSAMPLEFLIGHT.FlightAvailability" m:HttpMethod="GET" sap:action-for="RMTSAMPLEFLIGHT.Flight">
                    <Parameter Name="airlineid" Type="Edm.String" Mode="In" MaxLength="3" sap:value-list="standard" />
                    <Parameter Name="connectionid" Type="Edm.String" Mode="In" MaxLength="4" />
                    <Parameter Name="flightdate" Type="Edm.DateTime" Mode="In" Precision="0" />
                </FunctionImport>
                <FunctionImport Name="GetAvailableFlights" ReturnType="Collection(RMTSAMPLEFLIGHT.Flight)" EntitySet="FlightCollection" m:HttpMethod="GET">
                    <Parameter Name="fromdate" Type="Edm.DateTime" Mode="In" Precision="0" />
                    <Parameter Name="todate" Type="Edm.DateTime" Mode="In" Precision="0" />
                    <Parameter Name="cityfrom" Type="Edm.String" Mode="In" MaxLength="20" />
                    <Parameter Name="cityto" Type="Edm.String" Mode="In" MaxLength="20" />
                </FunctionImport>
                <FunctionImport Name="GetFlightDetails" ReturnType="RMTSAMPLEFLIGHT.FlightDetails" m:HttpMethod="GET" sap:action-for="RMTSAMPLEFLIGHT.Flight">
                    <Parameter Name="airlineid" Type="Edm.String" Mode="In" MaxLength="3" />
                    <Parameter Name="connectionid" Type="Edm.String" Mode="In" MaxLength="4" />
                </FunctionImport>
                <FunctionImport Name="GetAgencyDetails" ReturnType="RMTSAMPLEFLIGHT.Travelagency" EntitySet="TravelagencyCollection" m:HttpMethod="GET" sap:action-for="RMTSAMPLEFLIGHT.Travelagency">
                    <Parameter Name="agency_id" Type="Edm.String" Mode="In" MaxLength="8" />
                </FunctionImport>
                <FunctionImport Name="UpdateAgencyPhoneNo" ReturnType="RMTSAMPLEFLIGHT.Travelagency" EntitySet="TravelagencyCollection" m:HttpMethod="PUT" sap:action-for="RMTSAMPLEFLIGHT.Travelagency">
                    <Parameter Name="agency_id" Type="Edm.String" Mode="In" MaxLength="8" />
                    <Parameter Name="telephone" Type="Edm.String" Mode="In" MaxLength="30" Nullable="true" />
                </FunctionImport>
            </EntityContainer>
            <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="self" href="https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/$metadata" />
            <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="latest-version" href="https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/$metadata" />
        </Schema>
    </edmx:DataServices>
</edmx:Edmx>
sap.ui.define([
  "sap/ui/core/util/MockServer",
  "./simulatePreloaded",
], function(MockServer, simulatePreloaded) {
  "use strict";

  return {
    init: async function() {
      MockServer.config({
        autoRespond: true,
        autoRespondAfter: 0,
      });
      const mockServer = new MockServer({
        rootUri: "/sampleService/",
        recordRequests: false
      });
      const entitySetsToLoad = [
        "CarrierCollection",
        "FlightCollection",
      ];
      const pathPrefix = sap.ui.require.toUrl("demo/localService");
      await simulatePreloaded(mockServer, {
        metadataUrl: `${pathPrefix}/metadata.xml`,
        mockdataDir: `${pathPrefix}/mockdata`,
        entitySetNames: entitySetsToLoad,
      });
      // async function always returns a promise ..
      return mockServer.start(); // .. resolving w/ what's returned here.
    }, // https://javascript.info/async-await

  };
});
{
  "d": {
    "results": [
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('AC')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('AC')",
          "type": "RMTSAMPLEFLIGHT.Carrier",
          "content_type": "text/html",
          "media_src": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('AC')/$value",
          "edit_media": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('AC')/$value"
        },
        "carrid": "AC",
        "CARRNAME": "Air Canada",
        "CURRCODE": "CAD",
        "URL": "http://www.AC.com",
        "mimeType": "text/html",
        "carrierFlights": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('AC')/carrierFlights"
          }
        },
        "carrierFlights_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('AC')/carrierFlights_FW"
          }
        }
      },
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('AF')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('AF')",
          "type": "RMTSAMPLEFLIGHT.Carrier",
          "content_type": "text/html",
          "media_src": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('AF')/$value",
          "edit_media": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('AF')/$value"
        },
        "carrid": "AF",
        "CARRNAME": "Air France",
        "CURRCODE": "EUR",
        "URL": "http://www.AF.com",
        "mimeType": "text/html",
        "carrierFlights": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('AF')/carrierFlights"
          }
        },
        "carrierFlights_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('AF')/carrierFlights_FW"
          }
        }
      },
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('LH')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('LH')",
          "type": "RMTSAMPLEFLIGHT.Carrier",
          "content_type": "text/html",
          "media_src": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('LH')/$value",
          "edit_media": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('LH')/$value"
        },
        "carrid": "LH",
        "CARRNAME": "Lufthansa",
        "CURRCODE": "EUR",
        "URL": "http://www.LH.com",
        "mimeType": "text/html",
        "carrierFlights": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('LH')/carrierFlights"
          }
        },
        "carrierFlights_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/CarrierCollection('LH')/carrierFlights_FW"
          }
        }
      }
    ]
  }
}
{
  "d": {
    "results": [
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='AC',connid='0820',fldate=datetime'2002-12-20T00%3A00%3A00')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='AC',connid='0820',fldate=datetime'2002-12-20T00%3A00%3A00')",
          "type": "RMTSAMPLEFLIGHT.Flight"
        },
        "flightDetails": {
          "__metadata": {
            "type": "RMTSAMPLEFLIGHT.FlightDetails"
          },
          "countryFrom": "DE",
          "cityFrom": "frankfurt/main",
          "airportFrom": "FRA",
          "countryTo": "CA",
          "cityTo": "MONTREAL-DORVAL",
          "airportTo": "YUL",
          "flightTime": 28800,
          "departureTime": "PT10H00M00S",
          "arrivalTime": "PT12H00M00S",
          "distance": "5400.0000",
          "distanceUnit": "",
          "flightType": "",
          "period": 0
        },
        "carrid": "AC",
        "connid": "0820",
        "fldate": "/Date(1579132800000)/",
        "PRICE": "1222.00",
        "CURRENCY": "CAD",
        "PLANETYPE": "A330-300",
        "SEATSMAX": 320,
        "SEATSOCC": 12,
        "PAYMENTSUM": "0.00",
        "SEATSMAX_B": 20,
        "SEATSOCC_B": 1,
        "SEATSMAX_F": 0,
        "SEATSOCC_F": 0,
        "flightbooking": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='AC',connid='0820',fldate=datetime'2002-12-20T00%3A00%3A00')/flightbooking"
          }
        },
        "flightBookings": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='AC',connid='0820',fldate=datetime'2002-12-20T00%3A00%3A00')/flightBookings"
          }
        },
        "FlightCarrier": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='AC',connid='0820',fldate=datetime'2002-12-20T00%3A00%3A00')/FlightCarrier"
          }
        },
        "FlightCarrier_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='AC',connid='0820',fldate=datetime'2002-12-20T00%3A00%3A00')/FlightCarrier_FW"
          }
        }
      },
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='AF',connid='0820',fldate=datetime'2002-12-23T00%3A00%3A00')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='AF',connid='0820',fldate=datetime'2002-12-23T00%3A00%3A00')",
          "type": "RMTSAMPLEFLIGHT.Flight"
        },
        "flightDetails": {
          "__metadata": {
            "type": "RMTSAMPLEFLIGHT.FlightDetails"
          },
          "countryFrom": "DE",
          "cityFrom": "frankfurt/main",
          "airportFrom": "FRA",
          "countryTo": "MQ",
          "cityTo": "FORT DE FRANCE",
          "airportTo": "FDF",
          "flightTime": 39600,
          "departureTime": "PT10H00M00S",
          "arrivalTime": "PT15H00M00S",
          "distance": "7233.0000",
          "distanceUnit": "",
          "flightType": "",
          "period": 0
        },
        "carrid": "AF",
        "connid": "0820",
        "fldate": "/Date(1040601600000)/",
        "PRICE": "2222.00",
        "CURRENCY": "EUR",
        "PLANETYPE": "A330-300",
        "SEATSMAX": 320,
        "SEATSOCC": 2,
        "PAYMENTSUM": "0.00",
        "SEATSMAX_B": 20,
        "SEATSOCC_B": 1,
        "SEATSMAX_F": 0,
        "SEATSOCC_F": 0,
        "flightbooking": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='AF',connid='0820',fldate=datetime'2002-12-23T00%3A00%3A00')/flightbooking"
          }
        },
        "flightBookings": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='AF',connid='0820',fldate=datetime'2002-12-23T00%3A00%3A00')/flightBookings"
          }
        },
        "FlightCarrier": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='AF',connid='0820',fldate=datetime'2002-12-23T00%3A00%3A00')/FlightCarrier"
          }
        },
        "FlightCarrier_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='AF',connid='0820',fldate=datetime'2002-12-23T00%3A00%3A00')/FlightCarrier_FW"
          }
        }
      },
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0400',fldate=datetime'1995-02-28T00%3A00%3A00')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0400',fldate=datetime'1995-02-28T00%3A00%3A00')",
          "type": "RMTSAMPLEFLIGHT.Flight"
        },
        "flightDetails": {
          "__metadata": {
            "type": "RMTSAMPLEFLIGHT.FlightDetails"
          },
          "countryFrom": "",
          "cityFrom": "frankfurt",
          "airportFrom": "FRA",
          "countryTo": "",
          "cityTo": "NEW YORK",
          "airportTo": "JFK",
          "flightTime": 30240,
          "departureTime": "PT10H10M00S",
          "arrivalTime": "PT11H34M00S",
          "distance": "7865.0000",
          "distanceUnit": "KMT",
          "flightType": "",
          "period": 0
        },
        "carrid": "LH",
        "connid": "0400",
        "fldate": "/Date(793929600000)/",
        "PRICE": "899.00",
        "CURRENCY": "DEM",
        "PLANETYPE": "A319",
        "SEATSMAX": 350,
        "SEATSOCC": 4,
        "PAYMENTSUM": "2639.00",
        "SEATSMAX_B": 0,
        "SEATSOCC_B": 0,
        "SEATSMAX_F": 0,
        "SEATSOCC_F": 0,
        "flightbooking": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0400',fldate=datetime'1995-02-28T00%3A00%3A00')/flightbooking"
          }
        },
        "flightBookings": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0400',fldate=datetime'1995-02-28T00%3A00%3A00')/flightBookings"
          }
        },
        "FlightCarrier": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0400',fldate=datetime'1995-02-28T00%3A00%3A00')/FlightCarrier"
          }
        },
        "FlightCarrier_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0400',fldate=datetime'1995-02-28T00%3A00%3A00')/FlightCarrier_FW"
          }
        }
      },
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0454',fldate=datetime'1995-11-17T00%3A00%3A00')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0454',fldate=datetime'1995-11-17T00%3A00%3A00')",
          "type": "RMTSAMPLEFLIGHT.Flight"
        },
        "flightDetails": {
          "__metadata": {
            "type": "RMTSAMPLEFLIGHT.FlightDetails"
          },
          "countryFrom": "",
          "cityFrom": "frankfurt",
          "airportFrom": "FRA",
          "countryTo": "",
          "cityTo": "SAN FRANCISCO",
          "airportTo": "SFO",
          "flightTime": 44400,
          "departureTime": "PT10H10M00S",
          "arrivalTime": "PT12H30M00S",
          "distance": "0.0000",
          "distanceUnit": "",
          "flightType": "",
          "period": 0
        },
        "carrid": "LH",
        "connid": "0454",
        "fldate": "/Date(816566400000)/",
        "PRICE": "1499.00",
        "CURRENCY": "DEM",
        "PLANETYPE": "A319",
        "SEATSMAX": 350,
        "SEATSOCC": 2,
        "PAYMENTSUM": "2949.00",
        "SEATSMAX_B": 0,
        "SEATSOCC_B": 0,
        "SEATSMAX_F": 0,
        "SEATSOCC_F": 0,
        "flightbooking": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0454',fldate=datetime'1995-11-17T00%3A00%3A00')/flightbooking"
          }
        },
        "flightBookings": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0454',fldate=datetime'1995-11-17T00%3A00%3A00')/flightBookings"
          }
        },
        "FlightCarrier": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0454',fldate=datetime'1995-11-17T00%3A00%3A00')/FlightCarrier"
          }
        },
        "FlightCarrier_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0454',fldate=datetime'1995-11-17T00%3A00%3A00')/FlightCarrier_FW"
          }
        }
      },
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0455',fldate=datetime'1995-06-06T00%3A00%3A00')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0455',fldate=datetime'1995-06-06T00%3A00%3A00')",
          "type": "RMTSAMPLEFLIGHT.Flight"
        },
        "flightDetails": {
          "__metadata": {
            "type": "RMTSAMPLEFLIGHT.FlightDetails"
          },
          "countryFrom": "",
          "cityFrom": "san francisco",
          "airportFrom": "SFO",
          "countryTo": "",
          "cityTo": "FRANKFURT",
          "airportTo": "FRA",
          "flightTime": 48600,
          "departureTime": "PT15H00M00S",
          "arrivalTime": "PT10H30M00S",
          "distance": "0.0000",
          "distanceUnit": "",
          "flightType": "",
          "period": 0
        },
        "carrid": "LH",
        "connid": "0455",
        "fldate": "/Date(802396800000)/",
        "PRICE": "1090.00",
        "CURRENCY": "USD",
        "PLANETYPE": "A319",
        "SEATSMAX": 220,
        "SEATSOCC": 1,
        "PAYMENTSUM": "1499.00",
        "SEATSMAX_B": 0,
        "SEATSOCC_B": 0,
        "SEATSMAX_F": 0,
        "SEATSOCC_F": 0,
        "flightbooking": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0455',fldate=datetime'1995-06-06T00%3A00%3A00')/flightbooking"
          }
        },
        "flightBookings": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0455',fldate=datetime'1995-06-06T00%3A00%3A00')/flightBookings"
          }
        },
        "FlightCarrier": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0455',fldate=datetime'1995-06-06T00%3A00%3A00')/FlightCarrier"
          }
        },
        "FlightCarrier_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0455',fldate=datetime'1995-06-06T00%3A00%3A00')/FlightCarrier_FW"
          }
        }
      },
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0455',fldate=datetime'1996-12-31T00%3A00%3A00')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0455',fldate=datetime'1996-12-31T00%3A00%3A00')",
          "type": "RMTSAMPLEFLIGHT.Flight"
        },
        "flightDetails": {
          "__metadata": {
            "type": "RMTSAMPLEFLIGHT.FlightDetails"
          },
          "countryFrom": "",
          "cityFrom": "san francisco",
          "airportFrom": "SFO",
          "countryTo": "",
          "cityTo": "FRANKFURT",
          "airportTo": "FRA",
          "flightTime": 48600,
          "departureTime": "PT15H00M00S",
          "arrivalTime": "PT10H30M00S",
          "distance": "0.0000",
          "distanceUnit": "",
          "flightType": "",
          "period": 0
        },
        "carrid": "LH",
        "connid": "0455",
        "fldate": "/Date(851990400000)/",
        "PRICE": "1919.00",
        "CURRENCY": "DEM",
        "PLANETYPE": "DC-10-10",
        "SEATSMAX": 380,
        "SEATSOCC": 190,
        "PAYMENTSUM": "344479.69",
        "SEATSMAX_B": 0,
        "SEATSOCC_B": 0,
        "SEATSMAX_F": 0,
        "SEATSOCC_F": 0,
        "flightbooking": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0455',fldate=datetime'1996-12-31T00%3A00%3A00')/flightbooking"
          }
        },
        "flightBookings": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0455',fldate=datetime'1996-12-31T00%3A00%3A00')/flightBookings"
          }
        },
        "FlightCarrier": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0455',fldate=datetime'1996-12-31T00%3A00%3A00')/FlightCarrier"
          }
        },
        "FlightCarrier_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='0455',fldate=datetime'1996-12-31T00%3A00%3A00')/FlightCarrier_FW"
          }
        }
      },
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-21T00%3A00%3A00')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-21T00%3A00%3A00')",
          "type": "RMTSAMPLEFLIGHT.Flight"
        },
        "flightDetails": {
          "__metadata": {
            "type": "RMTSAMPLEFLIGHT.FlightDetails"
          },
          "countryFrom": "",
          "cityFrom": "frankfurt",
          "airportFrom": "FRA",
          "countryTo": "",
          "cityTo": "BERLIN",
          "airportTo": "SXF",
          "flightTime": 3900,
          "departureTime": "PT10H30M00S",
          "arrivalTime": "PT11H35M00S",
          "distance": "0.0000",
          "distanceUnit": "",
          "flightType": "",
          "period": 0
        },
        "carrid": "LH",
        "connid": "2402",
        "fldate": "/Date(872121600000)/",
        "PRICE": "555.00",
        "CURRENCY": "DEM",
        "PLANETYPE": "A319",
        "SEATSMAX": 300,
        "SEATSOCC": 100,
        "PAYMENTSUM": "0.00",
        "SEATSMAX_B": 0,
        "SEATSOCC_B": 0,
        "SEATSMAX_F": 0,
        "SEATSOCC_F": 0,
        "flightbooking": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-21T00%3A00%3A00')/flightbooking"
          }
        },
        "flightBookings": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-21T00%3A00%3A00')/flightBookings"
          }
        },
        "FlightCarrier": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-21T00%3A00%3A00')/FlightCarrier"
          }
        },
        "FlightCarrier_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-21T00%3A00%3A00')/FlightCarrier_FW"
          }
        }
      },
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-22T00%3A00%3A00')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-22T00%3A00%3A00')",
          "type": "RMTSAMPLEFLIGHT.Flight"
        },
        "flightDetails": {
          "__metadata": {
            "type": "RMTSAMPLEFLIGHT.FlightDetails"
          },
          "countryFrom": "",
          "cityFrom": "frankfurt",
          "airportFrom": "FRA",
          "countryTo": "",
          "cityTo": "BERLIN",
          "airportTo": "SXF",
          "flightTime": 3900,
          "departureTime": "PT10H30M00S",
          "arrivalTime": "PT11H35M00S",
          "distance": "0.0000",
          "distanceUnit": "",
          "flightType": "",
          "period": 0
        },
        "carrid": "LH",
        "connid": "2402",
        "fldate": "/Date(872208000000)/",
        "PRICE": "590.00",
        "CURRENCY": "DEM",
        "PLANETYPE": "A330-300",
        "SEATSMAX": 300,
        "SEATSOCC": 250,
        "PAYMENTSUM": "0.00",
        "SEATSMAX_B": 0,
        "SEATSOCC_B": 0,
        "SEATSMAX_F": 0,
        "SEATSOCC_F": 0,
        "flightbooking": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-22T00%3A00%3A00')/flightbooking"
          }
        },
        "flightBookings": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-22T00%3A00%3A00')/flightBookings"
          }
        },
        "FlightCarrier": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-22T00%3A00%3A00')/FlightCarrier"
          }
        },
        "FlightCarrier_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-22T00%3A00%3A00')/FlightCarrier_FW"
          }
        }
      },
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-25T00%3A00%3A00')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-25T00%3A00%3A00')",
          "type": "RMTSAMPLEFLIGHT.Flight"
        },
        "flightDetails": {
          "__metadata": {
            "type": "RMTSAMPLEFLIGHT.FlightDetails"
          },
          "countryFrom": "",
          "cityFrom": "frankfurt",
          "airportFrom": "FRA",
          "countryTo": "",
          "cityTo": "BERLIN",
          "airportTo": "SXF",
          "flightTime": 3900,
          "departureTime": "PT10H30M00S",
          "arrivalTime": "PT11H35M00S",
          "distance": "0.0000",
          "distanceUnit": "",
          "flightType": "",
          "period": 0
        },
        "carrid": "LH",
        "connid": "2402",
        "fldate": "/Date(872467200000)/",
        "PRICE": "490.00",
        "CURRENCY": "DEM",
        "PLANETYPE": "A330-300",
        "SEATSMAX": 300,
        "SEATSOCC": 290,
        "PAYMENTSUM": "0.00",
        "SEATSMAX_B": 0,
        "SEATSOCC_B": 0,
        "SEATSMAX_F": 0,
        "SEATSOCC_F": 0,
        "flightbooking": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-25T00%3A00%3A00')/flightbooking"
          }
        },
        "flightBookings": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-25T00%3A00%3A00')/flightBookings"
          }
        },
        "FlightCarrier": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-25T00%3A00%3A00')/FlightCarrier"
          }
        },
        "FlightCarrier_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-25T00%3A00%3A00')/FlightCarrier_FW"
          }
        }
      },
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-30T00%3A00%3A00')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-30T00%3A00%3A00')",
          "type": "RMTSAMPLEFLIGHT.Flight"
        },
        "flightDetails": {
          "__metadata": {
            "type": "RMTSAMPLEFLIGHT.FlightDetails"
          },
          "countryFrom": "",
          "cityFrom": "frankfurt",
          "airportFrom": "FRA",
          "countryTo": "",
          "cityTo": "BERLIN",
          "airportTo": "SXF",
          "flightTime": 3900,
          "departureTime": "PT10H30M00S",
          "arrivalTime": "PT11H35M00S",
          "distance": "0.0000",
          "distanceUnit": "",
          "flightType": "",
          "period": 0
        },
        "carrid": "LH",
        "connid": "2402",
        "fldate": "/Date(872899200000)/",
        "PRICE": "485.00",
        "CURRENCY": "DEM",
        "PLANETYPE": "A330-300",
        "SEATSMAX": 300,
        "SEATSOCC": 290,
        "PAYMENTSUM": "0.00",
        "SEATSMAX_B": 0,
        "SEATSOCC_B": 0,
        "SEATSMAX_F": 0,
        "SEATSOCC_F": 0,
        "flightbooking": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-30T00%3A00%3A00')/flightbooking"
          }
        },
        "flightBookings": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-30T00%3A00%3A00')/flightBookings"
          }
        },
        "FlightCarrier": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-30T00%3A00%3A00')/FlightCarrier"
          }
        },
        "FlightCarrier_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='2402',fldate=datetime'1997-08-30T00%3A00%3A00')/FlightCarrier_FW"
          }
        }
      },
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='3577',fldate=datetime'1995-04-28T00%3A00%3A00')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='3577',fldate=datetime'1995-04-28T00%3A00%3A00')",
          "type": "RMTSAMPLEFLIGHT.Flight"
        },
        "flightDetails": {
          "__metadata": {
            "type": "RMTSAMPLEFLIGHT.FlightDetails"
          },
          "countryFrom": "",
          "cityFrom": "rom",
          "airportFrom": "FCO",
          "countryTo": "",
          "cityTo": "FRANKFURT",
          "airportTo": "FRA",
          "flightTime": 7200,
          "departureTime": "PT07H05M00S",
          "arrivalTime": "PT09H05M00S",
          "distance": "1870.0000",
          "distanceUnit": "KMT",
          "flightType": "",
          "period": 0
        },
        "carrid": "LH",
        "connid": "3577",
        "fldate": "/Date(799027200000)/",
        "PRICE": "6000.00",
        "CURRENCY": "LIT",
        "PLANETYPE": "A319",
        "SEATSMAX": 220,
        "SEATSOCC": 1,
        "PAYMENTSUM": "600.00",
        "SEATSMAX_B": 0,
        "SEATSOCC_B": 0,
        "SEATSMAX_F": 0,
        "SEATSOCC_F": 0,
        "flightbooking": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='3577',fldate=datetime'1995-04-28T00%3A00%3A00')/flightbooking"
          }
        },
        "flightBookings": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='3577',fldate=datetime'1995-04-28T00%3A00%3A00')/flightBookings"
          }
        },
        "FlightCarrier": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='3577',fldate=datetime'1995-04-28T00%3A00%3A00')/FlightCarrier"
          }
        },
        "FlightCarrier_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='3577',fldate=datetime'1995-04-28T00%3A00%3A00')/FlightCarrier_FW"
          }
        }
      },
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='9981',fldate=datetime'2002-12-21T00%3A00%3A00')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='9981',fldate=datetime'2002-12-21T00%3A00%3A00')",
          "type": "RMTSAMPLEFLIGHT.Flight"
        },
        "flightDetails": {
          "__metadata": {
            "type": "RMTSAMPLEFLIGHT.FlightDetails"
          },
          "countryFrom": "DE",
          "cityFrom": "frankfurt",
          "airportFrom": "FRA",
          "countryTo": "DE",
          "cityTo": "DRESDEN",
          "airportTo": "DRS",
          "flightTime": 3300,
          "departureTime": "PT16H40M00S",
          "arrivalTime": "PT17H35M00S",
          "distance": "300.0000",
          "distanceUnit": "",
          "flightType": "",
          "period": 0
        },
        "carrid": "LH",
        "connid": "9981",
        "fldate": "/Date(1040428800000)/",
        "PRICE": "222.00",
        "CURRENCY": "EUR",
        "PLANETYPE": "A330-300",
        "SEATSMAX": 320,
        "SEATSOCC": 12,
        "PAYMENTSUM": "0.00",
        "SEATSMAX_B": 20,
        "SEATSOCC_B": 1,
        "SEATSMAX_F": 0,
        "SEATSOCC_F": 0,
        "flightbooking": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='9981',fldate=datetime'2002-12-21T00%3A00%3A00')/flightbooking"
          }
        },
        "flightBookings": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='9981',fldate=datetime'2002-12-21T00%3A00%3A00')/flightBookings"
          }
        },
        "FlightCarrier": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='9981',fldate=datetime'2002-12-21T00%3A00%3A00')/FlightCarrier"
          }
        },
        "FlightCarrier_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='LH',connid='9981',fldate=datetime'2002-12-21T00%3A00%3A00')/FlightCarrier_FW"
          }
        }
      },
      {
        "__metadata": {
          "id": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='SQ',connid='0026',fldate=datetime'1995-02-28T00%3A00%3A00')",
          "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='SQ',connid='0026',fldate=datetime'1995-02-28T00%3A00%3A00')",
          "type": "RMTSAMPLEFLIGHT.Flight"
        },
        "flightDetails": {
          "__metadata": {
            "type": "RMTSAMPLEFLIGHT.FlightDetails"
          },
          "countryFrom": "",
          "cityFrom": "frankfurt",
          "airportFrom": "FRA",
          "countryTo": "",
          "cityTo": "NEW YORK",
          "airportTo": "JFK",
          "flightTime": 30000,
          "departureTime": "PT08H30M00S",
          "arrivalTime": "PT09H50M00S",
          "distance": "7865.0000",
          "distanceUnit": "KMT",
          "flightType": "",
          "period": 0
        },
        "carrid": "SQ",
        "connid": "0026",
        "fldate": "/Date(793929600000)/",
        "PRICE": "849.00",
        "CURRENCY": "DEM",
        "PLANETYPE": "DC-10-10",
        "SEATSMAX": 380,
        "SEATSOCC": 35,
        "PAYMENTSUM": "1684.00",
        "SEATSMAX_B": 0,
        "SEATSOCC_B": 0,
        "SEATSMAX_F": 0,
        "SEATSOCC_F": 0,
        "flightbooking": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='SQ',connid='0026',fldate=datetime'1995-02-28T00%3A00%3A00')/flightbooking"
          }
        },
        "flightBookings": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='SQ',connid='0026',fldate=datetime'1995-02-28T00%3A00%3A00')/flightBookings"
          }
        },
        "FlightCarrier": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='SQ',connid='0026',fldate=datetime'1995-02-28T00%3A00%3A00')/FlightCarrier"
          }
        },
        "FlightCarrier_FW": {
          "__deferred": {
            "uri": "https://sapes5.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='SQ',connid='0026',fldate=datetime'1995-02-28T00%3A00%3A00')/FlightCarrier_FW"
          }
        }
      }
    ]
  }
}
/**
 * Loading metadata and entity sets asynchronously in parallel.
 * Supporting 1.56+ only.
*/
sap.ui.define([
  // nothing
], () => async (server, {
  metadataUrl,
  mockdataDir,
  entitySetNames = [],
}) => {
  const setsLoaded = entitySetNames.map(name => loadSet(name, mockdataDir));
  const metadata = await loadMetadata(metadataUrl);
  return Promise.all(setsLoaded).then(sets => simulate(server, metadata, sets));

  async function loadSet(entitySetName, sourceDirectory) {
    const response = await fetch(`${sourceDirectory}/${entitySetName}.json`, {
      credentials: "include",
    });
    return {
      [entitySetName]: await response.json()
    };
  }

  async function loadMetadata(metadataUrl) {
    const response = await fetch(metadataUrl, {
      credentials: "include",
    });
    return await response.text();
  }

  function simulate(server, metadataText, sets) {
    const merge = (acc, obj) => Object.assign(acc, obj);
    const mappedSets = sets.reduce(merge);
    server.simulate(metadataText, {
      aEntitySetsNames: entitySetNames,
    });
    applySets(mappedSets, server);
  }

  function applySets(sets, server) {
    const names = Object.keys(sets);
    names.map(name => server.setEntitySetData(name, onlyResults(name)));
    function onlyResults(name) {
      return Array.isArray(sets[name]) ? sets[name] : sets[name].d.results;
    }
  }
});
sap.ui.define([
  "sap/ui/core/mvc/Controller",
  "sap/ui/core/BusyIndicator",
], function(Controller, BusyIndicator) {
  "use strict";

  return Controller.extend("demo.controller.Master", {
    onInit: async function() {
      await this.getOwnerComponent().getModel("odata").metadataLoaded();
      BusyIndicator.hide();
    },

    navTo: function(routeName, selectedItem) {
      this.getRouter().navTo(routeName, {
        itemId: selectedItem.getBindingContext("odata").getProperty("carrid"),
      });
    },

  });
});
sap.ui.define([
  "sap/ui/core/mvc/Controller",
  "sap/ui/core/syncStyleClass",
  "sap/ui/model/json/JSONModel",
], function(Controller, syncStyleClass, JSONModel) {
  "use strict";

  return Controller.extend("demo.controller.Detail", {
    onInit: function() {
      this.byId("dialog").setModel(new JSONModel(), "dialog");
      const route = this.getRouter().getRoute("masterDetail");
      route.attachPatternMatched(this.onPatternMatched, this);
    },

    onPatternMatched: function(event) {
      const model = this.getModel("odata");
      const {itemId} = event.getParameter("arguments");
      model.metadataLoaded().then(() => this.bindCarrier(model, itemId));
    },

    bindCarrier: function(model, carrid) {
      const key = model.createKey("CarrierCollection", {carrid});
      this.getView().bindElement(`odata>/${key}`);
    },

    onAddBtnPress: function() {
      const dialog = this.byId("dialog");
      syncStyleClass("sapUiSizeCompact", this.getView(), dialog);
      dialog.open();
    },

    onExit: function() {
      const route = this.getRouter().getRoute("masterDetail");
      route.detachPatternMatched(this.onPatternMatched, this);
    },

  });
});
/**
 * This is used as a controller extension which is available as of 1.61. https://github.com/SAP/openui5/commit/c70b85b761b552deb1d0203dd88f5ff3099416c7
 * See manifest.json>/sap.ui5/extends
 */
sap.ui.define([], function() {
  "use strict";

  return { // plain object. Do not call the `sap.ui.component()` API.
    getModel: function(modelName) {
      return this.getOwnerComponent().getModel(modelName);
    },

    getRoute: function(routeName) {
      return this.getOwnerComponent().getRouter().getRoute(routeName);
    },

    getRouter: function() {
      return this.getOwnerComponent().getRouter();
    }
  }
});
// WIP

sap.ui.define([
  "sap/ui/core/message/Message",
  "sap/ui/core/Core",
], function(Message, Core) {
  "use strict";
  const messageManager = Core.getMessageManager();

  return {
    onBeforeDialogOpen: function(event) {
      const context = this.getView().getBindingContext("odata");
      this.setDeferred("addingFlight", context.getModel());
      const newContext = context.getModel().createEntry("/FlightCollection", {
        groupId: "addingFlight",
        properties: {
          "carrid": context.getProperty("carrid"),
          "connid": null,
          "fldate": null,
          "flightDetails": {
            "departureTime": null // FIXME: "flightDetails" (such as "departureTime") won't be added to the table due to MockServer not supporting complex types. See https://github.com/SAP/openui5/issues/471#issuecomment-282988369
          },
          "PRICE": null,
          "CURRENCY": null,
        },
      });
      messageManager.removeAllMessages(this.getInputMessages());
      event.getSource().setBindingContext(newContext, "odata");
    },

    setDeferred: function(groupId, model) {
      const groupsIds = model.getDeferredGroups();
      if (!groupsIds.find(id => id === groupId)) {
        model.setDeferredGroups(model.getDeferredGroups().concat(groupId));
      }
    },

    // =====================================================

    getInputMessages: function() {
      const messageModel = messageManager.getMessageModel();
      const allMessages = messageModel.getProperty("/");
      const inputs = this.getInputs(this.byId("form"), "inputs");
      return allMessages
        .filter(msg => inputs.find(inp => inp.getId() === msg.getControlId()));
    },

    onValidateFieldGroup: function(event) {
      const cancelButtonId = this.byId("cancelButton").getId();
      if (Core.getCurrentFocusedControlId() === cancelButtonId) {
        return;
      }
      const inputs = this.getInputs(this.byId("form"), "inputs");
      event.bCancelBubble = true; // stop bubbling to the parent control
      inputs.map(control => this.validateInput(control.getBinding("value")));
    },

    getInputs: function(container, groupId) {
      const isInput = control => control.isA("sap.m.InputBase");
      return container.getControlsByFieldGroupId([groupId]).filter(isInput);
    },

    validateInput: function(propertyBinding) {
      try {
        propertyBinding.getType().validateValue(propertyBinding.getValue());
      } catch(e) {
        Core.getMessageManager().addMessages(new Message({
          message: e.message,
          type: "Error",
          target: this.getFullEntityPropertyPath(propertyBinding),
          processor:  this.getProper(propertyBinding).getContext().getModel(),
        }));
      }
    },

    getFullEntityPropertyPath: function(propertyBinding) {
      let binding = this.getProper(propertyBinding);
      return `${binding.getContext().getPath()}/${binding.getPath()}`;
    },

    getProper: function(propertyBinding) {
      const isOData = b => b.isA("sap.ui.model.odata.ODataPropertyBinding");
      return propertyBinding.isA("sap.ui.model.CompositeBinding")
        ? propertyBinding.getBindings().find(isOData)
        : propertyBinding;
    },

    // =====================================================

    onDialogAddPress: function() {
      const dialog = this.byId("dialog");
      const isInput = control => control.isA("sap.m.InputBase");
      const inputs = dialog.getControlsByFieldGroupId("inputs").filter(isInput);
      const invalidInput = inputs.find(c => c.getValueState() == "Error");
      if (invalidInput) {
        invalidInput.focus();
      } else {
        const connid = dialog.getBindingContext("odata").getProperty("connid");
        this.getView().getModel("odata").submitChanges({
          groupId: "addingFlight",
          success: this.onCreateSuccess.bind(this, connid),
        });
      }
    },

    onDialogCancelPress: function() {
      this.byId("dialog").close();
    },

    handleCancel: function(context) {
      context.getModel().deleteCreatedEntry(context);
    },

    onCreateSuccess: function(connid) {
      const message = `Flight ${connid} Added`;
      sap.ui.require(["sap/m/MessageToast"], MT => MT.show(message));
      this.byId("dialog").close();
    },

    onAfterDialogClose: function(event) {
      this.isCanceled({
        origin: event.getParameter("origin"),
        cancelButton: this.byId("cancel")
      }) && this.handleCancel(this.byId("dialog").getBindingContext("odata"));
      messageManager.removeAllMessages(this.getInputMessages());
      event.getSource().unbindElement("odata");
    },

    isCanceled: function({origin, cancelButton}) {
      return origin === null || origin === cancelButton;
    },

  };
});
sap.ui.require([
  "demo/localService/mockserver",
  "sap/ui/core/BusyIndicator",
], async (mockserver, BusyIndicator) => {
  "use strict";
  BusyIndicator.show(1); // > 0 == render asynchronously
  await mockserver.init();
  sap.ui.require([ "sap/ui/core/ComponentSupport" ]); // see https://openui5.hana.ondemand.com/api/module:sap/ui/core/ComponentSupport
});