Sunteți pe pagina 1din 54

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/304571194

Library System

Technical Report · February 2012


DOI: 10.13140/RG.2.1.2853.5284

CITATIONS READS
0 10,800

1 author:

Frank Franque
Universidade Católica de Moçambique
3 PUBLICATIONS 0 CITATIONS

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Academic Project View project

All content following this page was uploaded by Frank Franque on 29 June 2016.

The user has requested enhancement of the downloaded file.


Catholic University of Mozambique

Library System
Major Project
Frank Bivar Franque
Stélio Macumbe

02/02/2012

Faculty of Tourism Management and Information Technology Beira


Library System

Library System
By Frank Bivar Franque

UCM Page 2
Library System

Contents
List of Figures ................................................................................................................................. 5
Chapter 1 – Introduction ................................................................................................................. 6
Chapter 2 – Problem Description .................................................................................................... 7
Chapter 3 – Main Objectives and Expected Result ........................................................................ 8
Chapter 4 – Work Break Down ...................................................................................................... 9
Chapter 5 – Information research of the problem’s field .............................................................. 10
Java ............................................................................................................................................ 10
JEE (Java Platform, Enterprise Edition) .................................................................................... 11
JSP (JavaServer Pages) .............................................................................................................. 12
Servlet ........................................................................................................................................ 12
MyBatis Framework .................................................................................................................. 13
Spring Framework ..................................................................................................................... 14
Modules................................................................................................................................. 15
Core Container ...................................................................................................................... 15
Data Access/Integration ........................................................................................................ 16
Web ....................................................................................................................................... 17
jQuery ........................................................................................................................................ 18
Dojo Toolkit .............................................................................................................................. 19
MySQL Workbench 5.2 CE ...................................................................................................... 20
Features ................................................................................................................................. 20
MySQL Server 5.1 ..................................................................................................................... 21
Eclipse IDE ................................................................................................................................ 22
astah* professional ................................................................................................................... 23
Chapter 6 – Survey of similar projects/solutions .......................................................................... 24
The Online Book Page Project .................................................................................................. 24
Questia Online Library .............................................................................................................. 25
The Free Library ........................................................................................................................ 26
Open Library.............................................................................................................................. 27
Library Management System..................................................................................................... 28
Assessment or Selection of the project or solution.................................................................... 29
Name of MP............................................................................................................................... 30
Characteristics ........................................................................................................................... 30
Chapter 7 – Design and Implementation of Solution.................................................................... 31

UCM Page 3
Library System

Web ............................................................................................................................................ 31
DAO........................................................................................................................................... 34
Database..................................................................................................................................... 36
Entity Relationship Diagram ..................................................................................................... 38
Tables Description ..................................................................................................................... 39
Book Table Description ........................................................................................................ 39
Loan Table Description......................................................................................................... 40
Person Table Description ...................................................................................................... 41
Author Table Description ..................................................................................................... 42
User Table Description ......................................................................................................... 43
Reserve Table Description .................................................................................................... 44
Use Case Diagram ..................................................................................................................... 45
Activity Diagram ....................................................................................................................... 46
Update Book Activity Diagram ............................................................................................ 46
Reserve Book Activity Diagram ........................................................................................... 47
Sequence Diagram ..................................................................................................................... 48
Reserve Book Sequence Diagram ......................................................................................... 48
System Structure ........................................................................................................................ 49
Domain Layer ....................................................................................................................... 49
Data Layer ............................................................................................................................. 49
Service Layer ........................................................................................................................ 50
Web.controller Layer ............................................................................................................ 50
Chapter 8 – Conclusion ................................................................................................................. 51
Glossary ........................................................................................................................................ 52
References ..................................................................................................................................... 53
Books Sources:...................................................................................................................... 53
Web sites Sources: ................................................................................................................ 53

UCM Page 4
Library System

List of Figures
Figure 1 JEE Architecture ............................................................................................................. 11
Figure 2 MyBatis Architecture ..................................................................................................... 14
Figure 3 Spring Framework Architecture ..................................................................................... 17
Figure 4 Screen shot of The Online Books Page .......................................................................... 24
Figure 5 Screen Shot of questia .................................................................................................... 25
Figure 6 Screen Shot of THE FREE LIBRARY .......................................................................... 26
Figure 7 Screen Shot of OPEN LIBRARY................................................................................... 27
Figure 8 Entity Relationship Diagram .......................................................................................... 38
Figure 9 Book Table Schema ........................................................................................................ 39
Figure 10 Loan table Schema ....................................................................................................... 40
Figure 11 Person Table Schema ................................................................................................... 41
Figure 12 Author Table Schema ................................................................................................... 42
Figure 13 User Table Schema ....................................................................................................... 43
Figure 14 Reserve Table Schema ................................................................................................. 44
Figure 15 Use Case Diagram ........................................................................................................ 45
Figure 16 Update Book activity diagram ...................................................................................... 46
Figure 17 Reserve Book Activity Diagram .................................................................................. 47
Figure 18 Reserve Book Sequence diagram ................................................................................. 48
Figure 19 System Structure........................................................................................................... 49
Figure 20 Package Diagram .......................................................................................................... 50

UCM Page 5
Library System

Chapter 1 – Introduction

The major Project was designed to approach the aims and solve the problems which book readers
are dealing with when it comes to Library; it covers the design, implementation and solutions.

What caught my interested in this project is the desire to help and or facilitate the iterations
between the Libraries and the readers, as we can see in nowadays when we go to the library we
do not know if the book that we want is there and if it is available, thenceforth that is why I aim
to build an Enterprise Application that will help the libraries and readers in the future.

In this document I will describe witch technologies I will use, the data base structure,
programming language and all the diagrams which will explain each process or workflow that is
implemented in the application.

At the end of this project the application that I have built will help and or facilitate the
communication among Libraries and readers.

UCM Page 6
Library System

Chapter 2 – Problem Description

The basic problems goes around the inter-communication among libraries and readers, and as we
know libraries are a little distant from the readers, plus have a lot of books, making it a bit
difficult to find a specific book.

Another problem I could find was revolving around the management of books, the problem is
when we want to loan some book, the readers goes to library and discovers that the book he want
is borrowed, and the readers does not know when the book will return to become available, and
he can goes back to the library another day but he can comes across with a borrowed book again.

Among the problems I found, I marked three very interesting to highlight,


 Many readers are omitted information that are in books or papers with electronic
information,

 When the libraries have a lot of book and according to the amount of books it is bit
difficult to manage the loan,

 Staffs of the libraries use papers to record information about the loan, and when they
want to search some information about the loan it become difficult.

UCM Page 7
Library System

Chapter 3 – Main Objectives and Expected Result

EXPECTED RESULTS INDICATOR

Facilitate the communication between Libraries We measure this objective verifying amount of
and Readers users that will be registered in the System (Library
System)

Online Reservation We measure this objective verifying the books that


will be reserved

Visualization of all Book and Service of the According to the books and information of services
Library over the internet available in the system we have measured this
objective

Management of Books After the librarian has registered all the books of
the library we have measured this result.

Table 1 Objectives and Expected Result

UCM Page 8
Library System

Chapter 4 – Work Break Down

1. Library System (Enterprise Application)

1.1. Draft UML diagram describing the functionality

1.2. Draft DB model using MySQL Workbench 5.2 CE

1.2.1. Implementation of DB model using SQL

1.3. Starting with the project using java language and eclipse IDE

1.3.1. Creation of layers within Java Resources (database, domain, data, service and

controller)

1.3.2. Creation of connection of DB using Spring Framework (JDBC Support)

1.4. Creation of iBatis sqlMap to map DB entity to java object

1.5. Creation of web pages using HTML/CSS

1.5.1. Implementation of JSP for dynamic HTML pages

1.5.2. Creation of form using Spring framework for insertion of data

1.5.3. Implementation of Dojo Toolkit for validation of forms

1.6. Implementation of controller layer for inter-communication between DB layer

and presentation layer (JSP)

1.6.1. Make available all data of DB to the JSP pages

1.7. Implementation of session for security

1.8. Implementation of login to improve the security

1.9. Implementation of jQuery to improve the presentation of data

UCM Page 9
Library System

Chapter 5 – Information research of the problem’s field

There are lot of ways to solve the problems heightened in problem description, and the solution
that I thought and qualified as objective and practical is to build an enterprise application,
because it is a powerful source (like security and reliability) and can eliminates a lot of job that
the librarian do, like write down data on papers and/or count manually books.

The source and technologies that can help to build the enterprise application which will solve the
problem are many, and I will specifically use Java Programming Language, JEE, JSP,
Servlet, MyBatis framework, spring framework, jQuery library, Dojo Toolkit, MyQLS
Workbench 5.2 CE, eclipse IDE, MySQL Server 5.1 and Jude Community.

Java
Java is originally developed by James Gosling at Sun Microsystems and released in 1995 as a
core component of Sun Microsystems' Java platform. The language derives much of its syntax
from C and C++ but has a simpler object model and fewer low-level facilities. Java applications
are typically compiled to byte code (class file) that can run on any Java Virtual Machine (JVM)
regardless of computer architecture.

Java is a general-purpose, concurrent, class-based, object-oriented language that is specifically


designed to have as few implementation dependencies as possible. It is intended to let
application developers "write once, run anywhere." Java is currently one of the most popular
programming languages in use, particularly for client-server web applications.

"write once, run anywhere" means that any program written in Java can be run on any machine
that has a JVM installed in it, in other words Java is not OS reliant, which makes it very portable
from smart phones to different OS computers.

For more information go to www.java.com.

UCM Page 10
Library System

JEE (Java Platform, Enterprise Edition)


Java Platform, Enterprise Edition is widely used platform for server programming in the Java
programming language. The Java platform (Enterprise Edition) differs from the Java Standard
Edition Platform (Java SE) in that it adds libraries which provide functionality to deploy fault-
tolerant, distributed, multi-tier Java software, based largely on modular components running on
an application server.

The platform was known as Java 2 Platform, Enterprise Edition or J2EE until the name was
changed to Java EE in version 5. The current version is called Java EE 6.

Java EE includes several API specifications, such as JDBC, RMI, e-mail, JMS, web services,
XML, etc., and defines how to coordinate them.

These include Enterprise JavaBeans, Connectors, servlets, portlets, JavaServer Pages and several
web service technologies. This allows developers to create enterprise applications that are
portable and scalable, and that integrate with legacy technologies.

A Java EE application server can handle transactions, security, scalability, concurrency and
management of the components that are deployed to it, in order to enable developers to
concentrate more on the business logic of the components rather than on infrastructure and
integration tasks.

Figure 1 JEE Architecture

UCM Page 11
Library System

JSP (JavaServer Pages)


JavaServer Pages (JSP) technology allows you to easily create web content that has both static
and dynamic components. JSP technology makes available all the dynamic capabilities of Java
Servlet technology but provides a more natural approach to creating static content.
The main features of JSP technology are as follows:

 A language for developing JSP pages, which  are text-based documents that describe how
to process a request and construct a response;
 
 An expression language for accessing server-side objects;
 
Mechanisms for defining extensions to the JSP language.

A JSP page is a text document that contains two types of text: static data, which can be expressed
in any text-based format (such as HTML, SVG, WML, and XML), and JSP elements, which
construct dynamic content.

Servlet
Initially, Common Gateway Interface (CGI) scripts were the main technology used to generate
dynamic content. Although widelyused, CGI scripting technology has a number of shortcomings,
including platform dependenceand lack of scalability. To address these limitations, Java Servlet
technology was created as aportable way to provide dynamic, user-oriented content.

A servlet is a Java programming language class that is used to extend the capabilities of servers
that host applications accessed by means of a request-response programming model. Although
servlets can respond to any type of request, they are commonly used to extend the applications
hosted by web servers. For such applications, Java Servlet technology defines HTTP-specific
servlet classes.

For more information go to


http://www.oracle.com/technetwork/java/javaee/overview/index.html.

UCM Page 12
Library System

MyBatis Framework
MyBATIS is a persistence framework which automates the mapping between SQL databases and
objects in Java, .NET, and Ruby on Rails. In Java, the objects are POJOs (Plain Old Java
Objects). The mappings are decoupled from the application logic by packaging the SQL
statements in XML configuration files. The result is a significant reduction in the amount of code
that a developer needs to access a relational database using lower level APIs like JDBC and
ODBC.

Other persistence frameworks such as Hibernate allow the creation of an object model (in Java,
say) by the user, and create and maintain the relational database automatically. iBATIS takes the
reverse approach: the developer starts with an SQL database and MyBATIS automates the
creation of the Java objects. Both approaches have advantages, and MyBATIS is a good choice
when the developer does not have full control over the SQL database schema. For example, an
application may need to access an existing SQL database used by other software, or access a new
database whose schema is not fully under the application developer's control, such as when a
specialized database design team has created the schema and carefully optimized it for high
performance.

On May 21, 2010 the development team decided to move from ASF to Google code changing
the project name to MyBatis.

For more information go to http://www.mybatis.org.

UCM Page 13
Library System

Figure 2 MyBatis Architecture

Spring Framework
The Spring Framework is a lightweight solution and a potential one-stop-shop for building your
enterprise-ready applications. However, spring is modular, allowing you to use only those parts
that you need, without having to bring in the rest. You can use the IoC container, with Struts on
top, but you can also use only the Hibernate integration code or the JDBC abstraction layer. The
Spring Framework supports declarative transaction management, remote access to your logic
through RMI or web services, and various options for persisting your data. It offers a full
featured MVC framework, and enables you to integrate AOP transparently into your software.
Spring is designed to be non-intrusive, meaning that your domain logic code generally has node
pendencies on the framework itself. In your integration layer (such as the data access layer),

UCM Page 14
Library System

some dependencies on the data access technology and the Spring libraries will exist. However, it
should be easy to isolate these dependencies from the rest of your code base.

Spring Framework is a Java platform that provides comprehensive infrastructure support for
developing Java applications. Spring handles the infrastructure so you can focus on your
application.

Spring enables you to build applications from “plain old Java objects” (POJOs) and to apply
enterprise services non-invasively to POJOs. This capability applies to the Java SE programming
model and to full and partial Java EE.
Examples of how you, as an application developer, can use the Spring platform advantage:

 Make a Java method execute in a database transaction without having to deal with
transaction APIs.
 
 Make a local Java method a remote procedure without having to deal with remote APIs.

 Make a local Java method a management operation without having to deal with JMX
APIs.
 
Make a local Java method a message handler without having to deal with JMS APIs.

Modules
The Spring Framework consists of features organized into about 20 modules. These modules are
grouped into Core Container, Data Access/Integration, Web, AOP (Aspect Oriented
Programming), Instrumentation, and Test. And I will only describe the module that I used.

Core Container

The Core Container consists of the Core, Beans, Context, and Expression Language modules.
The Core and Beans modules provide the fundamental parts of the framework, including the IoC
and dependency Injection features. The Bean Factory is a sophisticated implementation of the
factory pattern. It removes the need for programmatic singletons and allows you to decouple the
configuration and specification of dependencies from your actual program logic.

The Context module builds on the solid base provided by the Core and Beans modules: it is a
means to access objects in a framework-style manner that is similar to a JNDI registry. The

UCM Page 15
Library System

Context module inherits its features from the Beans module and adds support for
internationalization (using, for example, resource bundles), event-propagation, resource-loading,
and the transparent creation of contexts by, for example, a servlet container. The Context module
also supports Java EE features such as EJB, JMX, andbasic remoting. The
ApplicationContextinterface is the focal point of the Context module.

The Expression Language module provides a powerful expression language for querying and
manipulating an object graph at runtime. It is an extension of the unified expression language
(unifiedEL) as specified in the JSP 2.1 specification. The language supports setting and getting
property values, property assignment, method invocation, accessing the context of arrays,
collections and indexers, logical and arithmetic operators, named variables, and retrieval of
objects by name from Spring's IoC container.
It also supports list projection and selection as well as common list aggregations.

Data Access/Integration

The Data Access/Integration layer consists of the JDBC, ORM, OXM, JMS and Transaction
modules.

 The JDBC module provides a JDBC-abstraction layer that removes the need to do tedious
JDBC coding and parsing of database-vendor specific error codes.


 The ORM module provides integration layers for popular object-relational mapping
APIs, including JPA, JDO, Hibernate, and iBatis. Using the ORM package you can use
all of these O/R-mapping frameworksin combinations with all of the other features
Spring offers, such as the simple declarative transaction management feature mentioned
previously.

UCM Page 16
Library System

Web

The Web layer consists of the Web, Web-Servlet, Web-Struts, and Web-Portlet modules.
Spring's Web module provides basic web-oriented integration features such as multipart file-
upload functionality and the initialization of the IoC container using servlet listeners and a web
oriented application context. It also contains the web-related parts of Spring's remoting support.

The Web-Servlet module contains Spring's model-view-controller (MVC) implementation for


web applications. Spring's MVC framework provides a clean separation between domain model
code and web forms, and integrates with all the other features of the Spring Framework.

The Web-Struts module contains the support classes for integrating a classic Struts web tier
within a Spring application. Note that this support is now deprecated as of Spring 3.0. Consider
migrating your application to Struts 2.0 and its Spring integration or to a Spring MVC solution.

For more information go to http://www.springsource.org.

Figure 3 Spring Framework Architecture

UCM Page 17
Library System

jQuery
jQuery is a cross-browser JavaScript library designed to simplify the client-side scripting of
HTML.
jQuery is free, open source software, dual-licensed under the MIT License or the GNU General
Public License, Version 2. jQuery's syntax is designed to make it easier to navigate a document,
select DOM elements, create animations, handle events, and develop Ajax applications. jQuery
also provides capabilities for developers to create plug-ins on top of the JavaScript library. This
enables developers to create abstractions for low-level interaction and animation, advanced
effects and high-level, theme-able widgets. The modular approach to the jQuery framework
allows the creation of powerful and dynamic web pages and web applications.

jQuery contains the following features:

DOM element selections using the cross-browser open source selector engine Sizzle, a spin-off
out of the jQuery project;
 
 DOM traversal and modification (including support for CSS 1-3);
 
 Events;
CSS manipulation;
 
 Effects and animations;
Ajax;
Extensibility through plug-ins;
 
 Utilities - such as user agent information, feature detection;


  but need fallbacks
Compatibility methods that are natively available in modern browsers
for older ones - For example the inArray() and each() functions;
 
 Cross-browser support.
For

more information go to http://jquery.com.










UCM Page 18
Library System

Dojo Toolkit
Dojo Toolkit is an open source modular JavaScript library (or more specifically JavaScript
toolkit) designed to ease the rapid development of cross-platform, JavaScript/Ajax-based
applications and web sites.

It brings more productivity for building applications, adding a number of features such as
simplified syntax, functions for AJAX interactions, component graphics, visual effects, form
validation, among others.

It was started by Alex Russell, Dylan Schiemann, David Schontzler, and others in 2004 and is
dual-licensed under the modified BSD license or the Academic Free License. The Dojo
Foundation is a non-profit organization designed to promote the adoption of the toolkit.

For more information go to http://dojotoolkit.org.

UCM Page 19
Library System

MySQL Workbench 5.2 CE

MySQL Workbench is a visual database design tool that


integrates SQL development, administration, database design, creation and maintenance into a
single integrated development environment for the MySQL database system. It is the successor
to DBDesigner 4 from fabFORCE.net, and replaces the previous package of software, MySQL
GUI Tools Bundle.

Features
 
 General
 Database Connection & Instance Management

 Wizard driven action items

 Fully scriptable with Python and Lua

 Support for custom plugins
 
 SQL Editor
 Schema object browsing

 SQL syntax highlighter and statement parser

 Multiple-, editable result sets

 SQL snippets collections
 
 Data modeling
 ER diagramming

 Drag'n'Drop visual modeling

 Reverse engineering from SQL Scripts and live database

 Forward engineering to SQL Scripts and live database

 Schema synchronization

 Printing of models

 Import from fabFORCE.net DBDesigner4

 Database administration

 Start and stop of database instances
For more information go to http://www.mysql.com/products/workbench.

UCM Page 20
Library System

MySQL Server 5.1


MySQL is a relational database management system (RDBMS) that runs as a server providing
multi-user access to a number of databases. It is named after developer Michael Widenius'
daughter, My. The SQL phrase stands for Structured Query Language.

The MySQL development project has made its source code available under the terms of the
GNU General Public License, as well as under a variety of proprietary agreements. MySQL was
owned and sponsored by a single for-profit firm, the Swedish company MySQL AB, now owned
by Oracle Corporation.

Free-software-open source projects that require a full-featured database management system


often use MySQL. For commercial use, several paid editions are available, and offer additional
functionality. Applications which use MySQL databases include: TYPO3, Joomla, WordPress,
phpBB, Drupal and other software built on the LAMP software stack. MySQL is also used in
many high-profile, large-scale World Wide Web products, including Wikipedia, Google,
Facebook, and Twitter.

For more information go to http://www.mysql.com.

UCM Page 21
Library System

Eclipse IDE
Eclipse is a multi-language software development environment comprising an integrated
development environment (IDE) and an extensible plug-in system. It is written mostly in Java
and can be used to develop applications in Java and, by means of various plug-ins, other
programming languages including Ada, C, C++, COBOL, Perl, PHP, Python, R, Ruby
(including Ruby on Rails framework), Scala, Clojure, Groovy and Scheme. It can also be used to
develop packages for the software Mathematica. Development environments include the Eclipse
JDT (Java Development Toolkit) for Java, Eclipse CDT for C/C++ and Eclipse PDT for PHP,
among others.

The initial codebase originated fromVisualAge. In its default form it is meant for Java
developers, consisting of the Java Development Tools (JDT). Users can extend its abilities by
installing plug-ins written for the Eclipse software framework, such as development toolkits for
other programming languages, and can write and contribute their own plug-in modules. Released
under the terms of the Eclipse Public License, Eclipse is free and open source software. It was
one of the first IDEs to run under GNU Classpath and it runs without issues under IcedTea.

Eclipse began as an IBM Canada project. Object Technology International (OTI), which had
previously marketed the Smalltalk-based VisualAge family of IDE products,[1] developed
the new product as a Java-based replacement. In November 2001, a consortium was formed
to further the development of Eclipse as open-source software. In January 2004, the Eclipse
Foundation was created.
For more information go to http://www.eclipse.org.

UCM Page 22
Library System

astah* professional
astah* is formerly known as JUDE (Java and UML Developers' Environment), is a UML
modeling tool created by Japanese company ChangeVision. The Community edition for prior to
version 1.4, is free to use and offers the following functionality:

Support of UML  1.4 (part of UML 2.0 expression in commercial version
JUDE/Professional.)
 
 Class diagram (Object, Package, Subsystem and Robustness Diagrams are included.)
 
 Use case diagram
 
 Sequence diagram
 
 Collaboration Diagram
 
 State diagram
 
 Activity diagram
 
 Deployment diagram
 
 Component diagram
 
 Generate Java 1.4 sourcecode from model.
 
Import Java 1.4 source files to create model.

On September 2009, JUDE was renamed to astah* after receiving concerns from German
users who pointed out the product name similarity with the German word Jude, which refers to a
male Jew.
For more information go to http://astah.net.

UCM Page 23
Library System

Chapter 6 – Survey of similar projects/solutions

The Online Book Page Project


The Online Book Page is a web site that makes available electronic book, articles and online text.
The users or readers do not have to have registration to read or get the book, is free to everyone,
the site has very simple layout and is very easy to use.

This web site has an index over one million of online book free to the users and/or readers, to use
this site the users must have a computer with minimum capacity and connected to the internet.
For more information go to http://onlinebooks.library.upenn.edu.

Figure 4 Screen shot of The Online Books Page

UCM Page 24
Library System

Questia Online Library


The Questia Online Library is web site that makes available collections of completes books,
journals and articles. The users or readers must have authentication to access the materials, and
the material is online, which means the users only read the information electronically.

The readers or users can be undergraduate, high school, graduate students, and internet users of
all ages. The Questia Online Library has a dynamic interface to find specific book or a group of
books that belong to some author, edition or publisher.

For more information go to www.questia.com.

Figure 5 Screen Shot of questia

UCM Page 25
Library System

The Free Library


The Free Library is a simple web site that makes available books and/or articles to the fond of
reading. The books and/or articles are organized by a massive collection of categories like:
Business and Industry, Communications, Entertainment, Health, Humanities, Law, Government,
Politics, Recreation and Leisure, Science and Technology, and Social Sciences.

Nowadays as the libraries have a lot of books and articles is a bit difficult to find specific book or
article, and The Free Library have powerful research tool and the fastest, easiest way to locate
useful information on virtually any topic.
For more information go to http://www.thefreelibrary.com.

Figure 6 Screen Shot of THE FREE LIBRARY

UCM Page 26
Library System

Open Library
The Open Library is an open project, is a web site that makes almost everything available to the
users or readers, the application is open, and the data are open which means that the fond of
reading can add books or articles to the web site and can read.

The Open Library has simple and friendly user interface with standard tool for search and
advanced search to find specific book or articles.
For more information go to http://openlibrary.org.

Figure 7 Screen Shot of OPEN LIBRARY

UCM Page 27
Library System

Library Management System


The Library management System is an enterprise application that makes available books and
articles only to view or appreciate to the students and teachers. This application only illustrates
which kind of books and articles has in the library, all books and articles are in physic form.

The application has 4 kinds of users: manager, librarian, student and teacher. The manager
administrates the DB of the application, improve the application functionality, register librarian,
students, teachers to the system; the librarian work with information about the library, register
books information and author of books; the students access the system with username and
password and only view the available to read in the library, the teachers makes the same thing
that students does.

UCM Page 28
Library System

Assessment or Selection of the project or solution


After I study the 5 similar project or solution above mentioned, I choose the last one, The
Library Management System. I choose that project or solution because of is characteristics and
or behaviour, this project is similar to mine because their structure and the core functionality are
also similar.

Based on that project or solution, it can be the layout or basis of my own project, in comparison
of the projects, mine and The Library Management System the differences remark on the
technologies used, because I used new technologies, as new functionality and much more.

UCM Page 29
Library System

The table bellow illustrates the similar projects and their characteristics.

Name of MP Characteristics
1. The Online Book Page  is a website

An index of over one million online books
freely readable on the Internet

Special exhibits of particularly interesting
classes of online books

has a standard and advanced search
 http://onlinebooks.library.upenn.edu.

2. Questia Online Library  Online collection of complete books,


journals and articles

Undergraduate, high school, graduate
students, and Internet users of all ages can
use Questia

Has a standard and advanced search
 www.questia.com

3. The Free Library  Has a massive collection of categories like:


Health, Law, Science and Technology

Have a research tool and the fastest, easiest
way to locate useful information on
virtually any topic.
 http://www.thefreelibrary.com.

4. Open Library  The application is open, the data are open,


the documentation is open
 http://openlibrary.org.
5. Library Management System  The application is specific for school or
faculty

Online book to student and teacher
Table 2 Similar projects/Solutions

UCM Page 30
Library System

Chapter 7 – Design and Implementation of Solution


In this phase I will illustrate the design phase and implementation phase, the system is
compound by 3 parts: Web, DAO, and DB.

Web
In this part we can find the presentation layer, that is, the JSP pages and the controllers.
The controllers are used to connect the Web part and Dao part.
The code below is an example of controller (ReserveContrller.java):

package web.controller;
import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import domain.Reserve;

import service.BookManager;
import service.PersonManager;
import service.ReserveManager;

import
web.controller.util.Util; /**
*
* @author Frank
Franque */
@Controller
public class ReserveController {

@Autowired
ReserveManager
reserveManager; @Autowired
BookManager
bookManager; @Autowired
PersonManager personManager;

@RequestMapping("/myReserves.view")
public ModelAndView myReserves(){
ModelAndView mav = new ModelAndView("myReserves");

mav.addObject("reserveList", reserveManager.findAllReserves());
mav.addObject("personList", personManager.findAllPeople());

return mav;

UCM Page 31
Library System

@RequestMapping("/reserveSearch.view")
public ModelAndView reserveSearch(HttpServletRequest request){
ModelAndView mav = new ModelAndView("myReserves");

String search = request.getParameter("search");


String searchType = request.getParameter("searchType");

if(search.isEmpty()){
mav.addObject("reserveList",
reserveManager.findAllReserves());
mav.addObject("personList",
personManager.findAllPeople()); }else{
if("Title".equals(searchType)){
mav.addObject("reserveList",
reserveManager.findReserveByTile(search));
mav.addObject("personList",
personManager.findAllPeople());
}else if("State".equals(searchType)){
mav.addObject("reserveList",
reserveManager.findReserveByState(search));
mav.addObject("personList",
personManager.findAllPeople());
}else if("Isbn".equals(searchType)){
mav.addObject("reserveList",
reserveManager.findReserveByIsbn(search));
mav.addObject("personList",
personManager.findAllPeople());
}
}

return mav;
}

@RequestMapping("/reserveAdvancedSearch.view")
public ModelAndView lreserveAdvancedSearch(HttpServletRequest
request){ ModelAndView mav = new ModelAndView("myReserves");

String title = request.getParameter("title");


String state = request.getParameter("state");
String isbn = request.getParameter("isbn");

Reserve reserve = new Reserve();

reserve.setBookTitle(title);
reserve.setState(state);
reserve.setBookIsbn(isbn);

if(title.isEmpty() && state.isEmpty() &&


isbn.isEmpty()){ mav.addObject("reserveList",
reserveManager.findAllReserves());
mav.addObject("personList",
personManager.findAllPeople()); }else{
mav.addObject("reserveList",
reserveManager.findReserveBy(reserve));

UCM Page 32
Library System

mav.addObject("personList", personManager.findAllPeople());
}

return mav;
}

@RequestMapping("/deleteReserve.view")
public ModelAndView reserves(HttpServletRequest request){
ModelAndView mav = new ModelAndView("myReserves");

int id = Util.convertToInt(request.getParameter("id"));

reserveManager.deleteReserve(id);

mav.addObject("reserveList", reserveManager.findAllReserves());
mav.addObject("personList", personManager.findAllPeople());

return mav;
}

@RequestMapping("/editReserve.view")
public ModelAndView editReserve(HttpServletRequest request){
ModelAndView mav = new ModelAndView("myReserve");

int id = Util.convertToInt(request.getParameter("id")); String


url = request.getContextPath()+"/updateReserve.view";

Reserve reserve = new Reserve();

if(id != 0){
reserve = reserveManager.findReserveById(id);
}

mav.addObject("reserve", reserve);
mav.addObject("url", url);

return mav;
}

@RequestMapping("/updateReserve.view")
public ModelAndView updateReserve(@ModelAttribute("reserve")
Reserve reserve){
ModelAndView mav = new ModelAndView("myReserves");

reserveManager.updateReserve(reserve);

if("Available".equals(reserve.getState())){
bookManager.updateBookByIdAdding(reserve.getBookId());
}

mav.addObject("reserveList", reserveManager.findAllReserves());
mav.addObject("personList", personManager.findAllPeople());

return mav;
}

@RequestMapping("/reserve.view")

UCM Page 33
Library System

public ModelAndView reserve(HttpServletRequest request){


ModelAndView mav = new ModelAndView("myReserves");

int id = Util.convertToInt(request.getParameter("borrow"));
int personId =
Util.convertToInt(request.getParameter("personId")); String
isbn = request.getParameter("isbn"); String
title = request.getParameter("title");

Reserve reserve = new Reserve();

reserve.setBookId(id);
reserve.setPersonId(personId);
reserve.setBookIsbn(isbn);
reserve.setBookTitle(title);

reserveManager.addReserve(reserve);
bookManager.updateBookByIdRemoving(id);

mav.addObject("reserveList", reserveManager.findAllReserves());
mav.addObject("personList", personManager.findAllPeople());

return mav;
}

DAO
In this part we can find java interfaces classes that contain operations/methods without body, in
which this is used for DB operations, we can also find java classes that implement the dao, with
suffix DaoImpl, and their methods implement DB operations.
The code below is an example of java class that implement the dao
interface (LoanDaoImpl.java):

package dataImpl;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import data.LoanDao;
import domain.Loan;
/**
*
* @author Frank
Franque */
@SuppressWarnings("unchecked")
public class LoanDaoImpl extends SqlMapClientDaoSupport implements LoanDao {

UCM Page 34
Library System

private static Logger log = Logger.getLogger(LoanDaoImpl.class);

public Loan findLoanById(int loanId)


{ Loan loan = null;
loan = (Loan)
getSqlMapClientTemplate().queryForObject("Loan.findLoanById", loanId);

return loan;
}

public List<Loan> findAllLoans()


{ return (List<Loan>)
getSqlMapClientTemplate().queryForList("Loan.findAllLoans");
}

public void deleteLoan(int id) {


getSqlMapClientTemplate().delete("Loan.deleteLoan", id);
}

public void updateLoan(Loan loan) {


getSqlMapClientTemplate().update("Loan.updateLoan", loan);
}

public void addLoan(Loan loan) {


getSqlMapClientTemplate().insert("Loan.addLoan", loan);
}

@Override
public List<Loan> findLoanByDateIssued(String dateIssued)
{ // TODO Auto-generated method stub

return (List<Loan>)

getSqlMapClientTemplate().queryForList("Loan.findLoanByDateIssued",dateIssued );

@Override
public List<Loan> findLoanByDateDueForReturn(String ddfReturn)
{ // TODO Auto-generated method stub
return (List<Loan>)
getSqlMapClientTemplate().queryForList("Loan.findLoanByDateDueForReturn",ddfR
eturn);
}

@Override
public List<Loan> findLoanByDateReturned(String dateReturned)
{ // TODO Auto-generated method stub
return (List<Loan>)
getSqlMapClientTemplate().queryForList("Loan.findLoanByDateReturned",dateRetu
rned);
}

@Override
public List<Loan> findLoanBy(Loan loan) {

UCM Page 35
Library System

// TODO Auto-generated method


stub return (List<Loan>)
getSqlMapClientTemplate().queryForList("Loan.findLoanBy",loan);
}

Database
In this part we can find sqlMaps that is XML file that contain tags related to the DB operation,
sqlMap is a file that converts DB entity to java object. We can also find SQL file that contain
the implementation of the DB.
The code below is an example of the sqlMap of Loan (LoanDao.xml):

<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper
3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="data.LoanDao" >

<!-- find one Person by id-->


<select id="findLoanById" parameterType="int"
resultType="domain.Loan"> SELECT loan.*
FROM loan
WHERE loan.id =
#{value} </select>

<select id="findLoanByDateIssued"
parameterType="String" resultType="domain.Loan">
SELECT *
FROM loan
WHERE loan.dateIssued REGEXP
#{value} </select>

<select id="findLoanByDateDueForReturn"
parameterType="String" resultType="domain.Loan">
SELECT *
FROM loan
WHERE loan.dateDueForReturn REGEXP
#{value} </select>

<select id="findLoanByDateReturned"
parameterType="String" resultType="domain.Loan">
SELECT *
FROM loan
WHERE loan.dateReturned REGEXP
#{value} </select>

<resultMap type="domain.Loan" id="loanResult">


<result property="dateIssued" column="strDateIssued"/>
<result property="dateDueForReturn" column="strDateDueForReturn"/>

UCM Page 36
Library System

<result property="dateReturned" column="strDateReturned"/>


</resultMap>

<select id="findLoanBy"
parameterType="domain.Loan" resultType="domain.Loan">
SELECT *
FROM loan
WHERE loan.dateIssued REGEXP #{dateIssued}
AND loan.dateDueForReturn REGEXP #{dateDueForReturn}
AND loan.dateReturned REGEXP #{dateReturned}
</select>

<delete id="deleteLoan" parameterType="int">


DELETE FROM loan WHERE id = #{value}
</delete>

<select id="findAllLoans"
resultType="domain.Loan"> SELECT * FROM loan
</select>

<insert id="addLoan" parameterType="domain.Loan">


INSERT INTO loan(dateIssued , dateDueForReturn,
dateReturned, amountOfTime, personId, bookId)

VALUES(
#{dateIssued}, #{dateDueForReturn},
#{dateReturned}, #{amountOfTime}, #{personId}, #{bookId}
)

</insert>

<update id="updateLoan" parameterType="domain.Loan">

UPDATE loan SET dateIssued = #{dateIssued}


, dateDueForReturn = #{dateDueForReturn}
, dateReturned = #{dateReturned}
, amountOfTime = #{amountOfTime}
, personId = #{personId}
, bookId = #{bookId}

WHERE id =
#{id} </update>
</mapper>

UCM Page 37
Library System

Entity Relationship Diagram

The system’s DB consists of 7 entities which all of them are related with each other, Book,
Loan, Person, Author, BookAuthor, Reserve and User.

The following figure show the entity relationship diagram.

Figure 8 Entity Relationship Diagram

UCM Page 38
Library System

Tables Description

Book Table Description

Table Name: Book


Number of Fields: 10

Field List:
 
 id – unique identifier for each entity within the table.
 
 isbn – is a unique numeric commercial book identifier.
 
 title – book title.
 
 dateOfPublication – date that the book is published.
 
 category – book category, ex.: sport, romance.
 
 publisher – the company that publish the book.
 
 edition – number of book publishing.
 
 nrCopies – number of copies that the library has.
 
 pages – number of page.
 
cover – book cover in image.

Figure 9 Book Table Schema

UCM Page 39
Library System

Loan Table Description

Table Name: Loan


Number of Fields: 4

Field List:
 
 id – unique identifier.
 
 dateIssued – date that the reader borrow the book.
 
 dateDueForReturn – date that the reader must return the book.
 
dateReturned – date that the reader returned the book.

Figure 10 Loan table Schema

UCM Page 40
Library System

Person Table Description

Table Name: Person


Number of Fields: 8

Field List:
 
 id– unique identifier.
 
 firstNames – first names of the reader.
 
 surname – reader surname.
 
 gender – reader gender.
 
 address – reader address.
 
 phoneNumber – reader cable telephone line.
 
 emailAddress – reader electronic mail address.
 
dateBirth – date that the reader was born.

Figure 11 Person Table Schema

UCM Page 41
Library System

Author Table Description

Table Name: Author


Number of Fields: 4

Field List:
 
 id – unique identifier.
 
 firstNames – author first names.
 
 surname – author last name.
 
bio – author biography.

Figure 12 Author Table Schema

UCM Page 42
Library System

User Table Description

Table Name: User


Number of Fields: 4

Field List:
 
 id – unique identifier.
 
 userName – the name that the reader will use to access the system.
 
 password – reader password.
 
userRole – reader role.

Figure 13 User Table Schema

UCM Page 43
Library System

Reserve Table Description

Table Name: Reserve


Number of Fields: 6

Field List:
 
 id – unique identifier.
 
 bookIsbn – ISBN of Book Reserved
 
 bookTitle – Title of Book Reserved
 
 reservationDate – Date of Reservation
 
 state – state of book
 
observation – observation of book after return

Figure 14 Reserve Table Schema

UCM Page 44
Library System

Use Case Diagram


The use case diagram bellow shows the system and the main functional processes.

Figure 15 Use Case Diagram

UCM Page 45
Library System

Activity Diagram
The followings diagrams show some activities of the system that the librarians/readers
can perform.

Update Book Activity Diagram

Figure 16 Update Book activity diagram

UCM Page 46
Library System

Reserve Book Activity Diagram

Figure 17 Reserve Book Activity Diagram

UCM Page 47
Library System

Sequence Diagram

Reserve Book Sequence Diagram

Figure 18 Reserve Book Sequence diagram

UCM Page 48
Library System

System Structure
The system is compound of 4 main layers which are: domain, data, service and web.controller.

Figure 19 System Structure

Domain Layer
This layer contain java classes that is used to map data that come from DB to the system (java
objects), the java classes contain attribute with the same data type of the DB attribute and also
contain methods that get and set data to the DB.

Data Layer
The data layer contain java interface, interface is a group of related methods with empty bodies.
Each interface contains methods related with each DB table.

All the methods within the interface represent the action that will be used for interaction between
the DB and the System.

UCM Page 49
Library System

Service Layer
This layer contain java interface that contain the service related to the java object (e.g.
AuthorService.java) and/or DB, the service class contain all methods of data layer and others
methods that the system will be use as service, and contain managers that also is related with the
object.

The managers implement all the methods of the service class.

Web.controller Layer
This layer contain java class that connect the presentation layer (JSP) with data layer, the
controller layer in some case use manager to perform some actions, this classes are located in
service layer.

For better performance all objects or entity has one controller to manage their actions.

Figure 20 Package Diagram

UCM Page 50
Library System

Chapter 8 – Conclusion
Nowadays the process of computerization texts and/or files or make available texts and/or files in
the internet is becoming a challenge in the whole world, and many readers no longer are going to
the library preferring the internet as source of academic information.

The table bellow is from chapter 3, stating the expected results with the success indicators.
EXPECTED RESULTS INDICATOR

Facilitate the communication between Libraries We measure this objective verifying amount of
and Readers users that will be registered in the System (Library
System)

Online Reservation We measure this objective verifying the books that


will be reserved

Visualization of all Book and Service of the According to the books and information of services
Library over the internet available in the system we will measure this
objective

Table 3 Expected Results/Indicators

At the end, the enterprise application (Library System) is done, and the second expected result
was achieved with success, and the others results will be achieved after the application begins
to be used.

In the future I hope to improve the application core functionalities, and as the readers only
reserve the book, I will improve the application in order to make the book online, or taking
the library closer the readers.

UCM Page 51
Library System

Glossary
 
 API – Application Programming Interface
 
 JDBC – Java Data Base Connectivity
 
 RMI – Remote Method Invocation
 
 JMS – Java Message Service
 
 SVG – Scalable Vector Graphics
 
 ODBC – Open Date Base Connectivity
 
 EJB – Enterprise JavaBeans
 
 ORM – Object Relational Mapping
 
 JPA – Java Persistence API
 
 JDO – Java Date Object
 
 RDBMS – Relational Data Base Management System
 
DB – Database

UCM Page 52
Library System

References

Books Sources:


Portny, E. Stanley,
Project Management for Dummies, Wiley Publishing, Inc.:
 Indianapolis, 2010

  J., Vukotic, A., Chakraborty, A. and Ditt J., Pro Spring 2.5, apress: USA,
Machacek,
2008
 
 Begin C., Goodin B., Meadors L., iBatis in Action, Manning Publications Co: NY, 2007
 
 Hayes, D. K., Getting Started with Dojo, friendsof: USA, 2009
 
Sheldon, Robert, SQL: A Beginner’s Guide, Second Edition, Ventura: California, 2003

Web sites Sources:

“Java Programming Language”,


http://en.wikipedia.org/wiki/Java_(programming_language) (collected 15/12/2011)
“iBATIS”, http://en.wikipedia.org/wiki/IBATIS (collected 15/12/2011)
“Dojo Toolkit”, http://en.wikipedia.org/wiki/Dojo_Toolkit (collected 15/12/2011)

“MySQL Workbench 5.2 CE”, http://en.wikipedia.org/wiki/MySQL_Workbench


(collected 15/12/2011)
“MySQL Server”, http://en.wikipedia.org/wiki/MySQL (collected 15/12/2011)
 “Eclipse IDE”, http://en.wikipedia.org/wiki/Eclipse_(software) (collected 15/12/2011)























 UCM Page 53
View publication stats

S-ar putea să vă placă și