Lab#SB00-3: LibraryManagement

Spring Boot Library Management Borrow

Spring-Boot
lab
Spring Boot
Author

albertprofe

Published

Tuesday, June 1, 2021

Modified

Saturday, September 7, 2024

📘 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 and Librarian domain (all CRUD operations)
  • LibraryProject: from Java SE project we have the business logic of borrowing a book and the Borrow 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

Java Classes Library Management

Java Classes Library Management

Templates Library Management

Templates Library Management

General View Library Management

General View Library Management
  • Library5 is a library module that provides CRUD (Create, Read, Update, Delete) operations for the Book domain. This means that the Library5 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 the User and Librarian 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 a Borrow class. The Borrow class represents a transaction in which a user borrows a book from the library.

2 user-story & use-case

user-story

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 a HashMap
  • renovation borrow
  • return books from borrow
  • close a borrow
  • findBorrowsByUser
  • selectBooks by userId

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 database HashMap 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.

Mockup Web Library Management core use-case

Mockup Web Library Management core use-case

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

Mockup Web Library Management core use-case extended

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