---
# System prepended metadata

title: Sequence Diagram

---

Sequence Diagram
===

**Search Book: Use Case**
**- Main scenario -**
The Customer specifies an author on the Search Page and then presses the Search button.
The system validates the Customer's search criteria.

if author is entered, the System searches the Catalog for books associated with the specified author.

When the search is complete, the system displays the search results on the Search Results page.


**- Alternate path -**

if the Customer did not enter the name of an author before pressing the Search button, the System displays an error message
```mermaid

sequenceDiagram
    participant Customer
    participant Search Page
    participant Search Results Page
    participant Catalog
    participant Search Results
    
    activate Customer
    Customer ->> Search Page: 1: onSearch(author)
    activate Search Page
        Search Page ->> Search Page: 1.1: validateSearchCriteria()
        alt author entered

            Search Page ->> Catalog: 1.2: searchByAuthor(author)
            activate Catalog
                Catalog ->> Search Results: 1.2.1: create()
                activate Search Results

                    Search Results ->> Search Results Page: 1.2.1.1: display()
                    activate Search Results Page
                    deactivate Search Results Page
                deactivate Search Results

        else author not entered
            deactivate Catalog
            Search Page ->> Search Page: 1.3: displayErrorMessage()
        end
    deactivate Search Page
    deactivate Customer
```