Package org.example.customerdao

# Interface SupplierDAO

All Superinterfaces:
  `Deleteable`

All Known Implementing Classes:
  `SupplierDAOImpl`

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

Since:
  1.0
Author:
  Jonathan Earl

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `addSupplier(org.example.websecurity.UserCredentials credentials, org.example.customer.Supplier supplier)`
  Adds a Supplier.
  `List<org.example.customer.Supplier>`
  `findAllSuppliers(org.example.websecurity.UserCredentials credentials)`
  Finds all Suppliers.
  `org.example.customer.Supplier`
  `findSupplierById(org.example.websecurity.UserCredentials credentials, int id)`
  Find Supplier by Id.
  `List<org.example.customer.Supplier>`
  `findSuppliersByCompanyName(org.example.websecurity.UserCredentials credentials, String name)`
  Find Suppliers by Company name.
  `void`
  `setReadOnlyDS(DataSource readOnlyDS)`
  Sets the Read Only DataSource for this DAO Implication.
  `void`
  `setReadWriteDS(DataSource readWriteDS)`
  Sets the Read/Write DataSource for this DAO Implication.
  `void`
  `updateSupplier(org.example.websecurity.UserCredentials credentials, org.example.customer.Supplier supplier)`
  Updates a Supplier.

  ### 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 readWriteDS)
    Sets the Read/Write DataSource for this DAO Implication.
    Parameters:
      `readWriteDS` - the readWriteDS to set

  - ### findAllSuppliers

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

  - ### findSupplierById

    org.example.customer.Supplier findSupplierById(org.example.websecurity.UserCredentials credentials, int id)
    Find Supplier by Id.

    This will return null if the Supplier cannot be found.

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

  - ### findSuppliersByCompanyName

    List<org.example.customer.Supplier> findSuppliersByCompanyName(org.example.websecurity.UserCredentials credentials, String name)
    Find Suppliers by Company name.

    This will use a Wild Card search to find any Supplier with the provided string and a portion of their Company name.

    Parameters:
      `credentials` - the UserCredentials for this Database operation
      `name` - the string to search for
    Returns:
      a list if Suppliers, this list may be empty
    Throws:
      `IllegalArgumentException` - if there is a connection or permission problem

  - ### addSupplier

    int addSupplier(org.example.websecurity.UserCredentials credentials, org.example.customer.Supplier supplier)
    Adds a Supplier.

    Only a Manager is permitted to add a Supplier.

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

  - ### updateSupplier

    void updateSupplier(org.example.websecurity.UserCredentials credentials, org.example.customer.Supplier supplier)
    Updates a Supplier.

    Only a Manager is permitted to update a Supplier.

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