Computer Science: Data Structure assignment 1.
This project is a java project that shows how t create an animal project using java programing language.
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
Animal Project
1. Animal Project
AHMED ALI
STUDENT ID: 15037511
MODULE TITLE & CODE: CS5003 - Data Structures and Specialist Programming
COURSEWORK NUMBER 2
2. 1
Overview
This application is a simple web-technology site using MySQL and JSF to manage the animals in the zoo.
The functionalities include inserting, updating, deleting, listing, and searching. It also takes advantage of
Ajax handling and file uploading to increase user interaction experience. So we simply call it ‘The Zoo’.
Site map
User interface principles
The application is simple, so as the principle: Reusability and Structural
1. Reusability
The application uses the same grid to display the result for both the listing and searching
functionalities.
The application takes advantage of Ajax to provide the result immediately on request.
2. Structural
The application allows image uploading. Moreover, it uses a separate folder to store the
images uploaded, outside of the folder containing the application. This is to avoid
accidentally deleting them when redeploying.
Database
1. Tables
The application is simple with only one table.
Animals (animal_name, animal_image, imported_in)
3. 2
Animals
animal_name varchar(32)
animal_image varchar(64)
imported_in date
3. Classes
DBConnectionHelper class
The class DBConnectionHelper is a utility class to help create the connection to database and
close connection when it is not needed anymore.
Animal class
The class Animal is a bean class to help create or update an animal object.
When creating a new animal, the animal’s image will be uploaded to the image property of
the class and will be copied to the specified folder configured on web.xml. To avoid file
name collision, the method will generate a unique name, using UUID class.
When updating an animal object, the class will update the object’s ‘mode’ to editable. This
will ease the process of updating the record on the animal object grid.
Besides the methods listed above, the class also contains getter and setter methods for name,
image Url and year imported properties.
YearImportedConverter class
4. 3
The class YearImportedConverter is a converter class to help convert the string value of year
imported field to a Date object, and vice versa. This is due to the application to expect a
number representing the year when the animal has been imported, but the value is saved as a
date column in the database.
ZooController class
The class ZooController class is the main class to handle business of the application: insert,
update, delete, list, and search. So it contains several fields to support each function.
Insert
The controller class uses Ajax to handle animal image uploading via uploadImage() method.
It also contains an Animal object to store the information for the being-created animal.
After creating the animal successful,the application navigates to the list page, so user can see
the new record in the grid.
List
The controller class displays the animals in a grid, the same way as search page. Each row
has separate buttons to delete and edit the animal in-line. Clicking on the Edit button will
make the animal in the row editable.
Update
When the animal is in editable mode, the user can choose to save the new information added.
Delete
5. 4
The application allows to delete the animal using Ajax by sending the animal name attached
to the Delete button which has been clicked. The controller will identify the animal by name
and delete it in the database,together with delete it from the animal collection displayed in
the grid.
Search
The search functionality is in the same page with listing. So the controller contains a search
text to bind the value to search via Ajax.
Static contents
The application stores the icons used in a separate folder named img. Both the css file and
img folder reside in the resources folder.
10. 9
Conclusion
For this coursework, I have demonstrated how MYSQL can be effectively used to store and display data
directly from and to my web application. To take things further when making my web app I used pictures
to accommodate each animal.
The most difficult thing that I was faced with was to create an object that allows one to perform CRUD
operations a short hand for simple INESRT,SELECT, UPDATE,and DELETE queries on a single table
on the specified connection pool and table. In conclusion making web app can never be easy as a lot of
things must be considered such as how the information will be stored, what features if any will you go for
in terms of making your app more appealing for the users.