Package org.example.customerdao

# Interface OrderDAO

All Superinterfaces:
  `Deleteable`

All Known Implementing Classes:
  `OrderDAOImpl`

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

Since:
  1.0
Author:
  Jonathan Earl

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `addOrder(org.example.websecurity.UserCredentials credentials, org.example.customer.Order order)`
  Adds a Order.
  `List<org.example.customer.OrderItem>`
  `findAllOrderItems(org.example.websecurity.UserCredentials credentials, org.example.customer.Order order)`
  Finds all Order_Items by Order.
  `List<org.example.customer.Order>`
  `findAllOrders(org.example.websecurity.UserCredentials credentials)`
  Finds all Orders.
  `org.example.customer.Order`
  `findOrderById(org.example.websecurity.UserCredentials credentials, int id)`
  Find Order by Id.
  `List<org.example.customer.Order>`
  `findOrdersByCustomer(org.example.websecurity.UserCredentials credentials, org.example.customer.Customer customer)`
  Find Orders by Customer.
  `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`
  `updateOrder(org.example.websecurity.UserCredentials credentials, org.example.customer.Order order)`
  Updates a Order.

  ### 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

  - ### findAllOrders

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

  - ### findAllOrderItems

    List<org.example.customer.OrderItem> findAllOrderItems(org.example.websecurity.UserCredentials credentials, org.example.customer.Order order)
    Finds all Order_Items by Order.
    Parameters:
      `credentials` - the UserCredentials for this Database operation
      `order` - the order to search for
    Returns:
      a list of OrderItems, this list may be empty
    Throws:
      `IllegalArgumentException` - if there is a connection or permission problem

  - ### findOrderById

    org.example.customer.Order findOrderById(org.example.websecurity.UserCredentials credentials, int id)
    Find Order by Id.

    This will return null if the Order cannot be found.

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

  - ### findOrdersByCustomer

    List<org.example.customer.Order> findOrdersByCustomer(org.example.websecurity.UserCredentials credentials, org.example.customer.Customer customer)
    Find Orders by Customer.
    Parameters:
      `credentials` - the UserCredentials for this Database operation
      `customer` - the Customer to search for
    Returns:
      a list of Orders, this list may be empty
    Throws:
      `IllegalArgumentException` - if there is a connection or permission problem

  - ### addOrder

    int addOrder(org.example.websecurity.UserCredentials credentials, org.example.customer.Order order)
    Adds a Order.
    Parameters:
      `credentials` - the UserCredentials for this Database operation
      `order` - the Order object to add
    Returns:
      the id of the new Order record
    Throws:
      `IllegalArgumentException` - if there is a connection or permission problem

  - ### updateOrder

    void updateOrder(org.example.websecurity.UserCredentials credentials, org.example.customer.Order order)
    Updates a Order.
    Parameters:
      `credentials` - the UserCredentials for this Database operation
      `order` - the Order object to update
    Throws:
      `IllegalArgumentException` - if there is a connection or permission problem