Package org.example.customerdao

# Interface CustomerDAO

All Superinterfaces:
  `Deleteable`

All Known Implementing Classes:
  `CustomerDAOImpl`

public interface CustomerDAO extends Deleteable
This is the CustomerDAO Interface for the Customer DAO component of the Customer Web Application. This will be the primary Customer database exposure for the Customer Web Layer.

Since:
  1.0
Author:
  Jonathan Earl

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `addCustomer(org.example.websecurity.UserCredentials credentials, org.example.customer.Customer customer)`
  Adds a Customer.
  `List<org.example.customer.Customer>`
  `findAllCustomers(org.example.websecurity.UserCredentials credentials)`
  Finds all Customers.
  `org.example.customer.Customer`
  `findCustomerById(org.example.websecurity.UserCredentials credentials, int id)`
  Find Customer by Id.
  `List<org.example.customer.Customer>`
  `findCustomersByName(org.example.websecurity.UserCredentials credentials, String firstName, String lastName)`
  Find Customers by Name.
  `void`
  `setReadOnlyDS(DataSource readOnlyDS)`
  Sets the Read Only DataSource for this DAO Implication.
  `void`
  `setReadWriteDS(DataSource readWriteOnlyDS)`
  Sets the Read/Write DataSource for this DAO Implication.
  `void`
  `updateCustomer(org.example.websecurity.UserCredentials credentials, org.example.customer.Customer customer)`
  Updates a Customer.

  ### Methods inherited from interface org.example.customerdao.utility.Deleteable

  `deleteEntity, deleteEntity, isDeleteable, isDeleteable`

- ## Method Details

  - ### setReadOnlyDS

    void setReadOnlyDS(DataSource readOnlyDS)
    Sets the Read Only DataSource for this DAO Implication.
    Parameters:
      `readOnlyDS` - the readOnlyDS to set

  - ### setReadWriteDS

    void setReadWriteDS(DataSource readWriteOnlyDS)
    Sets the Read/Write DataSource for this DAO Implication.
    Parameters:
      `readWriteOnlyDS` - the readWriteOnlyDS to set

  - ### findAllCustomers

    List<org.example.customer.Customer> findAllCustomers(org.example.websecurity.UserCredentials credentials)
    Finds all Customers.
    Parameters:
      `credentials` - the UserCredentials for this Database operation
    Returns:
      a list of Customers, this list may be empty
    Throws:
      `IllegalArgumentException` - if there is a connection or permission problem

  - ### findCustomerById

    org.example.customer.Customer findCustomerById(org.example.websecurity.UserCredentials credentials, int id)
    Find Customer by Id.

    This will return null if the Customer cannot be found.

    Parameters:
      `credentials` - the UserCredentials for this Database operation
      `id` - the Customer ID to search for
    Returns:
      a Customer or null if the Customer is not found
    Throws:
      `IllegalArgumentException` - if there is a connection or permission problem

  - ### findCustomersByName

    List<org.example.customer.Customer> findCustomersByName(org.example.websecurity.UserCredentials credentials, String firstName, String lastName)
    Find Customers by Name.
    Parameters:
      `credentials` - the UserCredentials for this Database operation
      `firstName` - the first name to search for
      `lastName` - the last name to search for
    Returns:
      a list of Customers, this list may be empty
    Throws:
      `IllegalArgumentException` - if there is a connection or permission problem

  - ### addCustomer

    int addCustomer(org.example.websecurity.UserCredentials credentials, org.example.customer.Customer customer)
    Adds a Customer.

    Only a Manager is permitted to add a Customer.

    Parameters:
      `credentials` - the UserCredentials for this Database operation
      `customer` - the Customer object to add
    Returns:
      the id of the new Customer record
    Throws:
      `IllegalArgumentException` - if there is a connection or permission problem

  - ### updateCustomer

    void updateCustomer(org.example.websecurity.UserCredentials credentials, org.example.customer.Customer customer)
    Updates a Customer.

    Only a Manager is permitted to update a Customer.

    Parameters:
      `credentials` - the UserCredentials for this Database operation
      `customer` - the Customer object to update
    Throws:
      `IllegalArgumentException` - if there is a connection or permission problem