Develop a program for managing a library using the Java programming language. The program must satisfy the following conditions:
- Utilize the Factory Method pattern to create instances of books of different genres.
- Utilize the Decorator pattern is applied to extend the functionality of books. The description automatically includes a list of users who have borrowed this book.
- Use the Observer pattern to implement a mechanism for notifying users about the appearance of ordered books in the library.
- Singleton pattern for connecting to the mail server to send notifications to users.
- Iterator pattern for traversing the collection of books.
- Template Method pattern for taking and returning a book
The program utilizes:
- Unit test coverage: 84%. Due to the requirement for automatic execution of the application, changes had to be made to the application. Some tests do not execute
- Documentation
- Database: H2.
Application functionality:
- Adding a new user, where the name must be unique.
- Adding a new book, where the ISBN field must be unique. When adding a book with an existing ISBN, the availability counter increases. There are no checks for uniqueness of author, title, publishing year, genre, or description.
- User borrowing a book. Upon borrowing, user information is added to the description field.
- User returning a book.
- If the book is not available, the user has the opportunity to order the book. After returning this book to the library, users who ordered the book will receive email about the availability of the book
- Viewing user information by name. User information includes all books they have borrowed
- Viewing book information by ISBN.
- Viewing book information by author.
- Viewing book information by title.
- Viewing information about all books.
Book information includes all users currently reading that book. When taking a book, checks are performed for: the validity of the user, the book, and re-taking the book. When returning a book, checks are performed for: the validity of the user, the book, whether the user has the book. When ordering a book when ordering a book: validity of the user, book, availability of the book from the user, ordering the book again.