Interface CatalogService


public interface CatalogService
The interface CatalogService defines a service to manage the books of a bookstore.
  • Method Summary

    Modifier and Type
    Method
    Description
    addBook(Book book)
    Adds 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.
    Updates a book in the catalog.
  • Method Details

    • addBook

      Book addBook(Book book) throws BookAlreadyExistsException
      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

      Book findBook(String isbn) throws BookNotFoundException
      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

      List<Book> 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.
      Parameters:
      keywords - the (space separated) keywords to search for
      Returns:
      the list of matching books (may be empty)
    • updateBook

      Book updateBook(Book book) throws BookNotFoundException
      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