Package org.bookstore.catalog.service
Interface CatalogService
public interface CatalogService
The interface CatalogService defines a service to manage the books of a bookstore.
-
Method Summary
Modifier and TypeMethodDescriptionAdds a book to the catalog.Finds a book in the catalog.searchBooks
(String keywords) Searches for books in the catalog.
A book is included in the result list if every keyword is contained in the title, authors or publisher field.updateBook
(Book book) Updates a book in the catalog.
-
Method Details
-
addBook
Adds a book to the catalog.- Parameters:
book
- the data of the book to be added- Returns:
- the data of the added book
- Throws:
BookAlreadyExistsException
- if a book with the same ISBN already exists
-
findBook
Finds a book in the catalog.- Parameters:
isbn
- the ISBN of the book- Returns:
- the data of the found book
- Throws:
BookNotFoundException
- if no book with the specified ISBN exists
-
searchBooks
Searches for books in the catalog.
A book is included in the result list if every keyword is contained in the title, authors or publisher field.- Parameters:
keywords
- the (space separated) keywords to search for- Returns:
- the list of matching books (may be empty)
-
updateBook
Updates a book in the catalog.- Parameters:
book
- the new data of the book- Returns:
- the data of the updated book
- Throws:
BookNotFoundException
- if no book with the corresponding ISBN exists
-