Your task is to implement web application and external API for searching flights (as Google Flights).
You are provided with following modules to help you build up your applications:
- data-services - module used for working with data storage using DAO pattern.
- search-engine - module used as engine for searching routes and flights.
Implementation should consist of web application and external API service used for data selection. Consider next splitting for tasks.
Provide database scheme and ER model for Flights application. You must cover next use cases for common searching of the flights:
- Each flight must departure and arrive to some airport.
- Each airline and airport have international flight code known as IATA.
- Each flight must by operated by some airline (you can omit shared flights).
- Each flight must flight on some plane, which define number of seats and classes.
- Consider only regular flights. Each of regular flights operated with same name, code, plane, time and very on the date of derarture.
- Flight can departure and arrive from airports with different time zones.
Provide implementation of data-services for selection of data from data storage. Implementation should be based on Spring and Hibernate framework.
You are provided with following data objects:
- Airport - holds information about airport abstraction entity.
- Airline - holds information about airline abstraction entity.
- FlightRoute - holds information about scheduled flight, times of arrival and departure, airports and operated airline.
- Flight - holds information about flight as FlightRoute on some defined date.
- Plane - holds information about Plane abstraction entity.
- SeatClass - holds information about plane seat class abstraction entity.
Services you have to implement:
- AirlineService - service which helps access airline data store.
- AirportService - service which helps access airport data store.
- FlightsService - service which helps access flights data store.
- RoutesService - service which helps access flight routes data store.
Note! You cannot remove any methods from provided interfaces, but you can extend it any time.
Optionally provide implementation of data-services module which integrates with OpenFlights database (https://openflights.org/data.html)
You may use this data further in tests for search engines.
Your task here is to provide implementation for search-engine module. You are supplied with following interfaces:
-
RoutesEngine - engine for searching of flight routes without any date between two defined airports and maximum number of stops. Several limitations in implementaion here are: same airport must not be passed twice, next plane should not departure before current open arrive. Optionally you can define minimum time for flights change.
-
FlightsEngine - engine for searching of flights on concrete day. It must use RoutesEngine for routes selection and does not select any flights when there are not free seats left.
(Optionally in flight engine you can set class you want to search.)
Your task here is to provide implementation for external-api-services module. You may use Spring MVC or Spring Boot in your implementation.
You are supplied by following classes:
- Airline - data object for airline entity.
- Airport - data object for airpot entity.
- FlightRoute - holds information about some flight route between airport on some date.
Resource for search information about airports by city name. Implementation should search city by contains (like '%city%')
METHOD: GET
REQUEST PARAMETERS: city (String, REQUIRED) - name of city.
Example:
GET http://localhost:8080/api/airports/byCity?city=Kiev HTTP/1.1
[
{
"iata": "KBP",
"name": "Boryspil International Airport",
"city": "Kiev",
"country": "Ukraine",
"timeZone": "Europe/Kiev"
},
{
"iata": "IEV",
"name": "Kiev Zhuliany International Airport",
"city": "Kiev",
"country": "Ukraine",
"timeZone": "Europe/Kiev"
},
{
"iata": "GML",
"name": "Gostomel Airport",
"city": "Kiev",
"country": "Ukraine",
"timeZone": "Europe/Kiev"
}
]
Resource for searching of the airports using internation flight identity (IATA).
METHOD: GET
REQUEST PARAMETERS: iata (String, REQUIRED) - IATA code of airport.
Exampl**e: GET http://localhost:8080/api/airports/byIata?iata=KBP HTTP/1.1
[{
"iata": "KBP",
"name": "Boryspil International Airport",
"city": "Kiev",
"country": "Ukraine",
"timeZone": "Europe/Kiev"
}]
Resource for searching the flights between airpots with defined number of stops and some date.
METHOD: GET
REQUEST PARAMETERS:
- date (String, ISO formatted, REQUIRED) - date of the flight departure.
- departure (String, REQUIRED) - IATA code of departure airport.
- arrival (String, REQUIRED) - IATA code of arrival airport.
- stops (integer, REQUIRED) - max number of stops.
- page (integer, OPTIONAL, default - 0) - number of selection page, 0 based.
- max_results (integer, OPTIONAL, default - 50) - number of results per selection page.
Example: GET http://localhost:8080/api/flights/search?date=2017-09-28&departure=KBP&arrival=AMS&stops=1 HTTP/1.1
[
{
"price": 0,
"flights": [ {
"name": "KL1382",
"departure": {
"iata": "KBP",
"name": "Boryspil International Airport",
"city": "Kiev",
"country": "Ukraine",
"timeZone": "Europe/Kiev"
},
"arrival": {
"iata": "AMS",
"name": "Amsterdam Airport Schiphol",
"city": "Amsterdam",
"country": "Netherlands",
"timeZone": "Europe/Amsterdam"
},
"airline": {
"name": "KLM Royal Dutch Airlines",
"iata": "KL",
"country": "Netherlands"
},
"departureTime": "2017-09-28T05:45:00+03:00[Europe/Kiev]",
"arrivalTime": "2017-09-28T07:35:00+02:00[Europe/Amsterdam]"
}]
},
{
"price": 0,
"flights": [ {
"name": "KL3098",
"departure": {
"iata": "KBP",
"name": "Boryspil International Airport",
"city": "Kiev",
"country": "Ukraine",
"timeZone": "Europe/Kiev"
},
"arrival": {
"iata": "AMS",
"name": "Amsterdam Airport Schiphol",
"city": "Amsterdam",
"country": "Netherlands",
"timeZone": "Europe/Amsterdam"
},
"airline": {
"name": "Ukraine International Airlines",
"iata": "PS",
"country": "Ukraine"
},
"departureTime": "2017-09-28T19:40:00+03:00[Europe/Kiev]",
"arrivalTime": "2017-09-28T21:45:00+02:00[Europe/Amsterdam]"
}]
}
]
Provide web application for searching flights between two airports. You must use Spring framework and any king of frond-end technology. (For example FreeMarker).
Follow common style of https://www.google.com.ua/flights/.
Implementation should follow code conventions and Google checkstyle rules, satisfy all provided tests. For external API and WEB application you should enable logging for request and events happens during selection.
Good luck!