Upload
nguyen-duy-thao
View
215
Download
0
Embed Size (px)
Citation preview
7/31/2019 Documentation Project Hotel DIT126 V2
1/6
Documentation Project Hotel DIT126
Group 16 Hotel
Members
Viktor Ljungstrm 890618-5932 [email protected]
Anton Karlsson 900312-3339 [email protected]
Robin Pettersson 890207-4932 [email protected]
Overview
Our application is a model of a hotel website with functionality for room booking and
administration of rooms and bookings.
Even though some static pages which are essential on a hotel website (like information
about the rooms and contact) are not yet working the main dynamic fucntions are working
(login, add and delete rooms and book rooms).
The application is used in two ways; the regular user side and the administrator side. A user
can register with a username and password to be able to book rooms at the hotel and the
administrator can view and bookings from all users and create and edit rooms at the hotel.
Running the application
To run the application
Change e-mail (SMTP) login in top of ConfirmControllerBean.java.
Possibly create database hotel.
/init creates one user (guest/guest) and one administrator (admin/admin) before logging in
as an administrator.
mailto:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]7/31/2019 Documentation Project Hotel DIT126 V2
2/6
Use cases
AdmLogIn
Login for administrators (i.e. hotel staff), login handling detects if logging in user is a
regular user or an administrator.
AdmLogOutLogout for administrators, same button and functionality as logout for regular users.
AdmAddRoom
Add a room with a couple of options.
AdmShowRooms
View all rooms on the hotel, together with their properties.
AdmDeleteRoom
Delete a room.
AdmShowBookedRooms
View all bookings with dates, which room is booked and the user who booked it.
AdmEditBookingChange properites of a booking or delete it.
RegUser
Register as a new user.
LogIn
Log in to see bookings and make new bookings.
LogOut
Log out.
BookRoom
Book a room in several steps (choose date, choose matching room, pay and confirm).MyPage
7/31/2019 Documentation Project Hotel DIT126 V2
3/6
Lists all bookings the logged in user has made.
CancelBooking
Cancel a booking.
LookPic
Look at photos from the hotel and its surrounding.
These use cases were planned but are not implemented:
AdmBookRoom
It should be a special form for administrators to book a room to a customer, now the
same form is used.
AdmShowFreeRoomsByDate
An administrator should be able to see all rooms that are free on a specific date.
AdmShowFreeRoomsByType
An administrator should be able to see all rooms of a specific type that are free.
ShowInfoView some static info about the hotel.
ViewHelp
View help or FAQ about the hotel and the booking process.
ViewContact
View contact info and an email form.
AddPic
Logged in users should be able to upload photos from their stay at the hotel.
7/31/2019 Documentation Project Hotel DIT126 V2
4/6
Technical design
Object-oriented model
Physical set up
The application is divided in tiers accordnig to the MVC pattern. The model consists of all
data classes and the database, view contains all html pages which is everything that is shown
to the user and the control which is basically the link between view and model (handling
links, buttons, actions etc.).
Participating software componentsThe components used in the application are database (Java DB), JPA (communication withthe database), Java (data classes and controllers) and JSF (website).
Modules
Ctrl.Entities - Consists of all entities that are kept over time and stored in the database.
Typical model classes, but tightly connected to the controller classes, therefore the package
placement.
Ctrl - Managed Beans containing business methods for almost all logic in the application.
Here is most of the control tier located, with a small influence of model in some classes.
7/31/2019 Documentation Project Hotel DIT126 V2
5/6
Ctrl.JPA - The JPA package contains all classes that communicate directly with the database.
Class Database is a facade for accessing the different controllers that do CRUD operations to
the database. This is part of the control tier.
Model - Here are data storing managed beans located. These are backing beans with no
business logic but only instance fields and get/set methods. Some beans are almost direct
representatives of entities that are stored in the database and others are sessions bean thatkeep information when the user is moving between different pages.
Utils - Some listeners and validators. Belongs to the control tier.
Layers
The layers in the application are the model with all managed beans. (Package Model).
The controller with all business logic. (Package Ctrl and Utils).
The persistence layer with all management of the database and its entities. (Package Ctrl.JPA
and Ctrl.Entities).
The website layer with all html pages that the user (three views of this; not logged in user,
logged in user and administrator) accesses.
The website services like scripts, stylesheet and template imports.
Database design
GuestUser - The user entity which needs another name than user to avoid a collision with
the reserved word user in the database.
Hotel - An entity that could be used in the future if the application is extended (or another
application is added with the same database in the background) to handle many hotels and
not just one.
Room - Information about one room. Should have a relationship to the entity RoomType but
due to problems with this relationsship, only strings are used to represent the types of a
room.
RoomType - Rooms can be of different type (single, double, suite) where the rooms of a
specific type have the same number of beds. This entity is not used because of the problems
with combining it with room.
Booking - Combines a user and a room with dates for when the booking was made and when
the booking should start and end.
Weak partsMost of the logic and CRUD on the entities is implemented but after a many tests of
different methods to achieve full functionality there are still some missing parts.
- The booking process is not fully implemented. Choosing a date, number of nights and pick
a room that suits the users wishes works but all steps in the process could be developed
further. Check of credit is not implemented but the controller is prepared to handle this.
- The HTML code is a mix of pure HTML tags and tags of different JSF libraries. It would look
nicer to use fewer JSF libraries but to achieve everything in a simple way tags of different
libraries was a good and working solution. The GUI was originally written in pure HTML and
CSS and the conversion to JSF caused some problems. Also, the links are implemented in
different manners due to the problem of finding the relative paths to libraries and otherfiles.
7/31/2019 Documentation Project Hotel DIT126 V2
6/6
- The photos page should have a field for uploading photos and store them in a database.
But after many tests and lots of different implementations a working solution has not been
found.
Technologies used
JSF and JSF libraries (Prime Faces and Facelets)
Used on all GUI pages to separate unique content from the common template, to
render forms and buttons and for many of the links and administrator pages. Some
pure HTML is used where JSF tags were not applicable.
JSTL
Some JSTL, for example c:if, had to be used in the template and login pages to achieve
if conditions on the gui pages instead of showing different pages when there are only
small differencies.JSP
The core of the application is built in JSF but the initiation of the database which
populates the database (/init) is a JSP servlet.
JQuery
Components from the JQuery UI are used in the application. The dialog box to choose
date when booking a room and the main menu come from this library.
JPQL / JPA
When communicating with the database, the JPQL language is used to query the
different entities. The technique used to handle the database management is JPA. Allclasses that communicate with the database are located in the hotel.jpa package.
XHTML
The GUI is a website built in XHTML with both HTML and JSF tags from different
libraries.
CSS
CSS is used to style the GUI:s layout, text, forms, links and other appearance.
JUnit
JUint is used for testing.
JavaData classes, persistence handling and controller classes are written in Java.