Documente Academic
Documente Profesional
Documente Cultură
net/publication/304571194
Library System
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:
All content following this page was uploaded by Frank Franque on 29 June 2016.
Library System
Major Project
Frank Bivar Franque
Stélio Macumbe
02/02/2012
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
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.
UCM Page 7
Library System
Facilitate the communication between Libraries We measure this objective verifying amount of
and Readers users that will be registered in the System (Library
System)
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.
UCM Page 8
Library System
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)
UCM Page 9
Library System
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.
"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.
UCM Page 10
Library System
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.
UCM Page 11
Library System
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.
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.
UCM Page 13
Library System
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-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.
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.
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.
UCM Page 19
Library System
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
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.
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
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.
UCM Page 24
Library System
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.
UCM Page 25
Library System
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.
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.
UCM Page 27
Library System
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
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.
UCM Page 30
Library System
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");
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");
reserve.setBookTitle(title);
reserve.setState(state);
reserve.setBookIsbn(isbn);
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");
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
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.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
return 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
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):
<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>
UCM Page 36
Library System
<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>
<select id="findAllLoans"
resultType="domain.Loan"> SELECT * FROM loan
</select>
VALUES(
#{dateIssued}, #{dateDueForReturn},
#{dateReturned}, #{amountOfTime}, #{personId}, #{bookId}
)
</insert>
WHERE id =
#{id} </update>
</mapper>
UCM Page 37
Library System
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.
UCM Page 38
Library System
Tables Description
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.
UCM Page 39
Library System
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.
UCM Page 40
Library System
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.
UCM Page 41
Library System
Field List:
id – unique identifier.
firstNames – author first names.
surname – author last name.
bio – author biography.
UCM Page 42
Library System
Field List:
id – unique identifier.
userName – the name that the reader will use to access the system.
password – reader password.
userRole – reader role.
UCM Page 43
Library System
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
UCM Page 44
Library System
UCM Page 45
Library System
Activity Diagram
The followings diagrams show some activities of the system that the librarians/readers
can perform.
UCM Page 46
Library System
UCM Page 47
Library System
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.
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.
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.
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)
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
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
UCM Page 53
View publication stats