Table of Contents

Project

Assignment

Design and develop a web service for aircraft company which allows the clients to plan and order flights. In the project you will design the RESTful Airline Service, you will connect this service to other existing services. Part of the application is also a thick client implemented as a web page allowing the user to access the Airline Service. The client *must* be able to demonstrate all the functionality.

Realizujte projekt letecké společnosti pro plánování a rezervaci letů. Výsledný produkt musí být součástí již existující architektury a napojený na již existující služby, ale bylo dosaženo celkové kompaktnosti a efektivity systému. Hlavním požadavkem na realizaci produktu je implementace RESTful Airline Service, která spravuje dostupné datové zdroje: Destination (seznam destinací, kam společnost létá), Flight (seznam plánovaných, zrušených i uskutečněných letů) a Reservation (rezervace určitého počtu míst ve zvoleném letu). Další částí celého systému je zprostředkování plateb rezervací skrze centrální banku a tisk elektronických letenek. Součástí implementace musí být i tlustý klient implementovaný jako webová stránka prohlížeče zprostředkovávající přístup ke vzdálené Airline službě.

REST - Airline Service

You will design a service providing the following REST resources

The first three resources will provide the CRUD (Create Read Update Delete) opearations. The last source will support only the Create operation (using the POST method).

Server part

 Server part diagram

Destination Resource

The resource is defined as follows:

Methods POST, PUT and DELETE will be secured. The methods may be called only by users with the “admin” user role.

Flight Resource

Flight resource provides a list of flights and allows the user to modify the flights.

The security of this resource is the same like for the destination. The POST, PUT and DELETE operations are secured. Caution! It is necessary to connect the resurces between the flights and destination resources (using URL address of destinations).

Filtering, pagination, sorting

Use the “X-Filter” header to filter the flights in the FROM, TO manner.

example:

 X-Filter: dateOfDepartureFrom=2013-02-27T02:04:46+01:00,dateOfDepartureTo=2013-02-27T03:04:46+01:00
 

Date is in format ISO8601

It will be also possible to order the values.

Example:

 X-Order: dateOfDeparture:asc    nebo     X-Order: name:desc

It does not make sence to send all data at once, therefore pagination is used. Pagination will be created using the X-Base and X-Offset headers. Base is the number of requested records, offset is the beginning of the records. If the client requests 10 records starting from the 20tieth record, he adds the following headers to the request:

X-Base: 10 X-Offset: 20

If the request doesn't contain these headers, server sends all data. For the client to know the number of records he can get the server sends the X-Count-records header together with the data: X-Count-records: 18

Reservation

The clients create reservations for flights. New reservation starts with the state new. Once the reservation is paid (the client presses the pay button), the reservation goes to the paid state. The user can cancel the reservation using the PUT method - the state is changed to cancel. Only reservation in the state “new” can be canceled.

When the reservation is created, random password is sent to the client. When the client wishes to modify the reservation, he needs to input the password.

It is necessary to consider number of seats in the aircraft and allow the users to reserve their places accordingly. Don't forget to connect the flights with destinations.

Securing the source is a bit more complicated. The list of the reservations (GET method) may see only the user with the role “admin” or “manager”. The same applies to the DELETE operation for a given resource. To get one reservation /reservation/{id} the user has to know the password (send the “X-Password” header). The same applies to the PUT method.

Single entry point

At the address / the server will return both the thick client (by using the content-type: text/html) and the list of resources used by the service while using the header content-type: application/json or application/xml

Client

The client will be realised using HTML, JavaScript or any other suitable technology. It does not have to be nice or complicated. However, the client has to implement all the functionality provided by the server - sorting, filtering, pagination.

Third parties

Google API

Before the new destination is created, get the coordinates of the destination using the [https://developers.google.com/maps/documentation/geocoding/|The Google Geocoding API]]. Store the coordinates to the destination.

Flight distance API

When creating the new flight use the service which computes the distance between two points at the map Rome2Rio. The service may find other modes of transport than air travel. We are interested in the length of the final route. Use the distance to compute the price of the ticket. 100 km = 1000 CZK.

WebSockets: Number of connected clients

Implement visualisation of number of currently connected clients in the client part using Websockets.

JAX-WS Printing Service

Printing Service is a service for automatic generation of e-tickets. It accepts the object of the reservation as a parameter. The reservation has to be paid.

Requirements Summary

Airline Service a Client

Implement a RESTful service and using an API allow the users to manage these resources:

The service has to fulfil the following:

Grading

The following is the grading criteria. You need to get at least 25 points to pass.

Checkpoint 1 max 17 points
RESTful management of resources for Airline Service 6b
HTML / Javascript client 6b
Single entry point for Airline Service, lists of resources 1b
Filtering and sorting using headers 4b
Checkpoint 2 max 12 points
Flight, Destination: authorisation BASIC for resource management 3b
Reservation: authorisation BASIC (GET and DELETE, admin/manager can do anything) 2b
Reservation: authorisation X-Password (PUT and GET, who knows the password can do anything) 2b
Google Geocoding API for getting the coordinates 1b
Rome2Rio for getting the flight distance 1b
PrintService design using the bottom-up approach 3b
Checkpoint 3 max 21 points
WebSockets: Number of parallel clients is displayed in the client 3b
PrintService design using the top-down approach 3b
JMS producer - generates the request for email 3b
JMS consumer - processes the request for email 3b
File sending using the PrintService 3b
Code quality 6b