diff --git a/db/data/com.sap.dps-Namespaces.csv b/db/data/com.sap.dps-Namespaces.csv new file mode 100644 index 00000000..070ba60c --- /dev/null +++ b/db/data/com.sap.dps-Namespaces.csv @@ -0,0 +1,2 @@ +NamespaceID;Description +cap.sflight;CAP SFlight diff --git a/db/data/com.sap.dps-Providers.csv b/db/data/com.sap.dps-Providers.csv new file mode 100644 index 00000000..97a9b1b0 --- /dev/null +++ b/db/data/com.sap.dps-Providers.csv @@ -0,0 +1,7 @@ +ProviderID;NamespaceID;Description;ServiceURL +Airport;cap.sflight;List of Airports;/cdi-airport +Airline;cap.sflight;List of Airlines;/cdi-airline +Flight;cap.sflight;List of Flights;/cdi-flight +FlightConnection;cap.sflight;List of FlightConnections;/cdi-flight-connection +Countries;cap.sflight;List of Countries;/cdi-countries +Currencies;cap.sflight;List of Currencies;/cdi-currencies diff --git a/db/dps-integration.cds b/db/dps-integration.cds new file mode 100644 index 00000000..9eebc6e8 --- /dev/null +++ b/db/dps-integration.cds @@ -0,0 +1,32 @@ +namespace com.sap.dps; + +entity Namespaces { + key NamespaceID : String; + Description : String; + + Providers : Association to many Providers on Providers.Namespace = $self; +} + +entity Providers { + key ProviderID : String; + key NamespaceID : String; + Description : String; + ServiceURL : String; + + Namespace : Association to one Namespaces on Namespace.NamespaceID = NamespaceID; + Subscriptions : Association to many Subscriptions on Subscriptions.NamespaceID = NamespaceID + and Subscriptions.ProviderID = ProviderID; +} + +entity Subscriptions { + key SubscriptionID : String; + key NamespaceID : String; + key ProviderID : String; + Filter : String; + Selection : String; + Description : String; + CurrentDeltaLink : String; + PreviousDeltaLink : String; + ExternalID : String; + EntitySetName : String; +} diff --git a/mta.yaml b/mta.yaml index ff60c2c7..a1fd527e 100644 --- a/mta.yaml +++ b/mta.yaml @@ -21,7 +21,7 @@ modules: path: gen/srv requires: - name: sflight-db - - name: sflight-uaa +# - name: sflight-uaa provides: - name: srv-api # required by consumers of CAP services (e.g. approuter, destinations) properties: @@ -39,73 +39,75 @@ modules: buildpack: nodejs_buildpack requires: - name: sflight-db - - name: sflight-uaa +# - name: sflight-uaa build-parameters: ignore: ["node_modules/"] - # ------------------ APPLICATION CONTENT --------------------- - - name: sflight-appcontent - # ------------------------------------------------------------ - type: com.sap.application.content - path: app - requires: - - name: sflight-destination-service - - name: sflight-html5-repo-host - parameters: - content-target: true - build-parameters: - build-result: resources - requires: - - name: sflight-app-travel-processor - artifacts: - - travel-processor.zip - target-path: resources/ - # ------------- APPLICATION: TRAVEL PROCESSOR ---------------- - - name: sflight-app-travel-processor - # ------------------------------------------------------------ - type: html5 - path: app/travel_processor - build-parameters: - build-result: dist - builder: custom - commands: - - npm install - - npm run build - supported-platforms: [] - # ------------------ DESTINATION CONTENT --------------------- - - name: sflight-destinationcontent - # ------------------------------------------------------------ - type: com.sap.application.content - build-parameters: - no-source: true - requires: - - name: sflight-uaa - parameters: - service-key: - name: sflight-uaa-key - - name: sflight-html5-repo-host - parameters: - service-key: - name: sflight-html5-repo-host-key - - name: sflight-destination-service - parameters: - content-target: true - parameters: - content: - instance: - existing_destinations_policy: update - destinations: - - Name: sflight-html5-repository - ServiceInstanceName: sflight-html5-repo-host - ServiceKeyName: sflight-html5-repo-host-key - sap.cloud.service: sap.fe.cap.sflight - - Name: sflight-uaa - Authentication: OAuth2UserTokenExchange - ServiceInstanceName: sflight-uaa - ServiceKeyName: sflight-uaa-key - sap.cloud.service: sap.fe.cap.sflight +# # ------------------ APPLICATION CONTENT --------------------- +# - name: sflight-appcontent +# # ------------------------------------------------------------ +# type: com.sap.application.content +# path: app +# requires: +# - name: sflight-destination-service +# - name: sflight-html5-repo-host +# parameters: +# content-target: true +# build-parameters: +# build-result: resources +# requires: +# - name: sflight-app-travel-processor +# artifacts: +# - travel-processor.zip +# target-path: resources/ +# +# # ------------- APPLICATION: TRAVEL PROCESSOR ---------------- +# - name: sflight-app-travel-processor +# # ------------------------------------------------------------ +# type: html5 +# path: app/travel_processor +# build-parameters: +# build-result: dist +# builder: custom +# commands: +# - npm install +# - npm run build +# supported-platforms: [] +# +# # ------------------ DESTINATION CONTENT --------------------- +# - name: sflight-destinationcontent +# # ------------------------------------------------------------ +# type: com.sap.application.content +# build-parameters: +# no-source: true +# requires: +# - name: sflight-uaa +# parameters: +# service-key: +# name: sflight-uaa-key +# - name: sflight-html5-repo-host +# parameters: +# service-key: +# name: sflight-html5-repo-host-key +# - name: sflight-destination-service +# parameters: +# content-target: true +# parameters: +# content: +# instance: +# existing_destinations_policy: update +# destinations: +# - Name: sflight-html5-repository +# ServiceInstanceName: sflight-html5-repo-host +# ServiceKeyName: sflight-html5-repo-host-key +# sap.cloud.service: sap.fe.cap.sflight +# - Name: sflight-uaa +# Authentication: OAuth2UserTokenExchange +# ServiceInstanceName: sflight-uaa +# ServiceKeyName: sflight-uaa-key +# sap.cloud.service: sap.fe.cap.sflight resources: # ------------------------------------------------------------ @@ -118,68 +120,68 @@ resources: properties: hdi-service-name: ${service-name} - # ------------------------------------------------------------ - - name: sflight-uaa - # ------------------------------------------------------------ - type: org.cloudfoundry.managed-service - parameters: - service: xsuaa - service-plan: application - path: ./app/travel_processor/xs-security.json - config: - xsappname: sflight-${space} - tenant-mode: dedicated - role-collections: - - name: 'sflight-reviewer-${space}' - description: Review travels - role-template-references: - - $XSAPPNAME.reviewer - - name: 'sflight-processor-${space}' - description: Process travels - role-template-references: - - $XSAPPNAME.processor - - name: 'sflight-admin-${space}' - description: Manage travels - role-template-references: - - $XSAPPNAME.admin - - # ------------------------------------------------------------ - - name: sflight-html5-repo-runtime - # ------------------------------------------------------------ - type: org.cloudfoundry.managed-service - parameters: - service: html5-apps-repo - service-plan: app-runtime - - # ------------------------------------------------------------ - - name: sflight-html5-repo-host - # ------------------------------------------------------------ - type: org.cloudfoundry.managed-service - parameters: - service: html5-apps-repo - service-plan: app-host - - # ------------------------------------------------------------ - - name: sflight-destination-service - # ------------------------------------------------------------ - type: org.cloudfoundry.managed-service - requires: - - name: srv-api - parameters: - service: destination - service-plan: lite - config: - version: 1.0.0 - HTML5Runtime_enabled: true - init_data: - instance: - existing_destinations_policy: update - destinations: - - Name: sflight-srv - URL: ~{srv-api/srv-url} - Authentication: NoAuthentication - Type: HTTP - ProxyType: Internet - HTML5.ForwardAuthToken: true - HTML5.DynamicDestination: true +# # ------------------------------------------------------------ +# - name: sflight-uaa +# # ------------------------------------------------------------ +# type: org.cloudfoundry.managed-service +# parameters: +# service: xsuaa +# service-plan: application +# path: ./app/travel_processor/xs-security.json +# config: +# xsappname: sflight-${space} +# tenant-mode: dedicated +# role-collections: +# - name: 'sflight-reviewer-${space}' +# description: Review travels +# role-template-references: +# - $XSAPPNAME.reviewer +# - name: 'sflight-processor-${space}' +# description: Process travels +# role-template-references: +# - $XSAPPNAME.processor +# - name: 'sflight-admin-${space}' +# description: Manage travels +# role-template-references: +# - $XSAPPNAME.admin +# +# # ------------------------------------------------------------ +# - name: sflight-html5-repo-runtime +# # ------------------------------------------------------------ +# type: org.cloudfoundry.managed-service +# parameters: +# service: html5-apps-repo +# service-plan: app-runtime +# +# # ------------------------------------------------------------ +# - name: sflight-html5-repo-host +# # ------------------------------------------------------------ +# type: org.cloudfoundry.managed-service +# parameters: +# service: html5-apps-repo +# service-plan: app-host +# +# # ------------------------------------------------------------ +# - name: sflight-destination-service +# # ------------------------------------------------------------ +# type: org.cloudfoundry.managed-service +# requires: +# - name: srv-api +# parameters: +# service: destination +# service-plan: lite +# config: +# version: 1.0.0 +# HTML5Runtime_enabled: true +# init_data: +# instance: +# existing_destinations_policy: update +# destinations: +# - Name: sflight-srv +# URL: ~{srv-api/srv-url} +# Authentication: NoAuthentication +# Type: HTTP +# ProxyType: Internet +# HTML5.ForwardAuthToken: true +# HTML5.DynamicDestination: true diff --git a/srv/dps-service.cds b/srv/dps-service.cds new file mode 100644 index 00000000..fc9809d5 --- /dev/null +++ b/srv/dps-service.cds @@ -0,0 +1,88 @@ +// https://github.tools.sap/DataPlane/cloud-data-integration-specification/blob/master/specification/v1.4/admin_metadata.xml + +using { com.sap.dps } from '../db/dps-integration'; +using { sap.fe.cap.travel as my } from '../db/schema'; +using { sap.common } from '@sap/cds/common'; + +service com.sap.cloudDataIntegration { + + @Capabilities.UpdateRestrictions.Updatable: false + @Capabilities.InsertRestrictions.Insertable: false + @Capabilities.DeleteRestrictions.Deletable: false + entity Namespaces as projection on dps.Namespaces; + + @Capabilities.UpdateRestrictions.Updatable: false + @Capabilities.InsertRestrictions.Insertable: false + @Capabilities.DeleteRestrictions.Deletable: false + entity Providers as projection on dps.Providers; + + @Capabilities.UpdateRestrictions.Updatable: false + @Capabilities.FilterRestrictions: { + Filterable: true, + FilterExpressionRestrictions: [ + { Property: NamespaceID, AllowedExpressions: #MultiValueOrSearchExpression }, // according to vocabulary this should be a string rather than an enum + { Property: ProviderID, AllowedExpressions: #MultiValueOrSearchExpression }, + { Property: SubscriptionID, AllowedExpressions: #MultiValueOrSearchExpression }, + { Property: ExternalID, AllowedExpressions: #MultiValueOrSearchExpression } + ] + } + entity Subscriptions as projection on dps.Subscriptions; +} + + +@path:'/cdi-airport' +service com.sap.cloudDataIntegrationData.Airport { + @DataIntegration.Extractable + entity Airport as projection on my.Airport { + *, + CountryCode.code as CountryCode + }; +} + +@path:'/cdi-airline' +service com.sap.cloudDataIntegrationData.Airline { + @DataIntegration.Extractable + entity Airline as projection on my.Airline { + *, + CurrencyCode.code as CurrencyCode + }; +} + +@path:'/cdi-flight' +service com.sap.cloudDataIntegrationData.Flight { + @DataIntegration.Extractable + entity Flight as projection on my.Flight { + *, + CurrencyCode.code as CurrencyCode + } excluding {to_Airline, to_Connection}; +} + +@path:'/cdi-flight-connection' +service com.sap.cloudDataIntegrationData.FlightConnection { + @DataIntegration.Extractable + entity FlightConnection as projection on my.FlightConnection { + *, + DepartureAirport.AirportID as DepartureAirport, + DestinationAirport.AirportID as DestinationAirport + } excluding {to_Airline}; +} + +@path:'/cdi-countries' +service com.sap.cloudDataIntegrationData.Countries { + @DataIntegration.Extractable + entity Countries as projection on common.Countries { + * + } excluding {name, description, texts, localized}; // exclude localized elements for the time being + + entity Countries_texts as projection on common.Countries.texts; +} + +@path:'/cdi-currencies' +service com.sap.cloudDataIntegrationData.Currencies { + @DataIntegration.Extractable + entity Currencies as projection on common.Currencies { + * + } excluding {name, description, texts, localized}; // exclude localized elements for the time being + + entity Currencies_texts as projection on common.Currencies.texts; +}