Lab#SB00-3: LibraryManagement
Spring Boot Library Management Borrow
📘 Spring Boot Lab#SB00-3: Borrow Domain
After Lab#SB00-1 and Lab#SB00-2 it is time to integrate and refactor the code created at projects:
- Libray5:
Book
domain (all CRUD operations) - controllerView:
User
andLibrarian
domain (all CRUD operations) - LibraryProject: from
Java SE
project we have thebusiness logic
of borrowing a book and theBorrow
clas
LibraryManagement
is the result of combining three base projects into a single system.
It is a legacy system, meaning it has been in use for some time. The three original projects likely provided different functionality, such as book creation, user management, and borrowing/returning books, which were combined to eventually create the LibraryManagement system.
1 Initial integration
- Library Management just initial integration with book-selection.
Library5
is a library module that provides CRUD (Create, Read, Update, Delete) operations for theBook
domain. This means that theLibrary5
module provides functions or classes that allow users of the software to create, read, update, and delete information about books in the system.controllerView
is a module that provides CRUD operations for both theUser
andLibrarian
domains. This module provides functions or classes that allow users and librarians to interact with the system, including creating, reading, updating, and deleting information about users and librarians.LibraryProject
is the main Java SE project that contains the business logic for borrowing a book, as well as aBorrow
class. The Borrow class represents a transaction in which a user borrows a book from the library.
2 user-story & use-case
As a user/librarian
, we are able to access user’s borrow domain from use/users
web domain and perform such a operations:
- create a new
borrow
borrows
stored in aHashMap
- renovation
borrow
- return books from
borrow
- close a
borrow
findBorrowsByUser
selectBooks
byuserId
And also:
- fake login and logout
2.1 use-cases
- Create a new borrow: initiate a new record in the borrow
HashMap
for a user borrowing a book(s). - Borrows
HashMap
: a databaseHashMap
that stores information about borrowed books, including user information and return dates. - Renovation borrow: extend the return date for a borrowed book by updating the corresponding borrow record.
- Return books: update the borrow record to indicate that the borrowed book(s) have been returned.
- Close a borrow: mark a borrow record as closed to indicate that the borrowed book(s) have been returned and the borrow is complete.
- Fake login as librarian or user: simulate a login as a librarian or user for testing or debugging purposes.
- Logout: terminate a user’s authenticated session.
- Find borrows by user: retrieve all borrow records associated with a particular user from the borrow
HashMap
.
3 Mock up
Creating a web Thymeleaf app without CSS means that the application’s user interface will not have any styling.
The focus of the app is to test Spring Boot’s controller and service layers using data stored in HashMaps
.
This app will be useful for testing and development purposes, as it allows developers to quickly build and test the functionality of the controller and service layers without worrying about the presentation layer and the database
However, it is not intended for production use, as a production app would require a more polished and professional user interface with styling and layout design
4 Versions
Code Version | Commit | Folder-Tree | Screeshoots |
---|---|---|---|
Library Management 0.0 | create project pom and first integration | Basic Structure - Java Classes - Templates | - |
Library Management 0.1 | select books and userid without a borrow, send Array from TH to @Controller | - | - |
Library Management 0.2 | session and httpServletRequest & filter tables with JS script in static resources | - | - |
Library Management 0.3 | simplify login and put together login user and librarian, using select option and th:if | - | - |
Library Management 0.4 | borrowByUserId, borrow -serviceBorrow- and book domain, two columns css, logout | Folder-Tree Library Management | 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 |
Library Management 0.5 | create borrow from user domain and allBorrows & activeBorrows | - | 12 - 13 - 14 |
Library Management 0.6 | return book (selecting byBorrowId and not using UserId) | - | 15 - 16 |
Library Management 0.7 | create Borrow from borrows ByUserId And BookIds | - | 17 - 18 - 19 - 20 - 21 |