Interface ProductDAO

All Superinterfaces:
Deleteable
All Known Implementing Classes:
ProductDAOImpl

public interface ProductDAO extends Deleteable
This is the ProductDAO Interface for the Customer DAO component of the Customer Web Application. This will be the primary Product database exposure for the Customer Web Layer.
Since:
1.0
Author:
Jonathan Earl
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    addProduct(org.example.websecurity.UserCredentials credentials, org.example.customer.Product product)
    Adds a Product.
    List<org.example.customer.Product>
    findAllActiveProducts(org.example.websecurity.UserCredentials credentials)
    Finds all non discontinued Products.
    List<org.example.customer.Product>
    findAllProducts(org.example.websecurity.UserCredentials credentials)
    Finds all Products.
    org.example.customer.Product
    findProductById(org.example.websecurity.UserCredentials credentials, int id)
    Find Product by Id.
    List<org.example.customer.Product>
    findProductsBySupplier(org.example.websecurity.UserCredentials credentials, org.example.customer.Supplier supplier)
    Find Products by Supplier.
    void
    Sets the Read Only DataSource for this DAO Implication.
    void
    Sets the Read/Write DataSource for this DAO Implication.
    void
    updateProduct(org.example.websecurity.UserCredentials credentials, org.example.customer.Product product)
    Updates a Product.

    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
    • findAllProducts

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

      List<org.example.customer.Product> findAllActiveProducts(org.example.websecurity.UserCredentials credentials)
      Finds all non discontinued Products.
      Parameters:
      credentials - the UserCredentials for this Database operation
      Returns:
      a list of active Products, this list may be empty
      Throws:
      IllegalArgumentException - if there is a connection or permission problem
    • findProductById

      org.example.customer.Product findProductById(org.example.websecurity.UserCredentials credentials, int id)
      Find Product by Id.

      This will return null if the Product cannot be found.

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

      List<org.example.customer.Product> findProductsBySupplier(org.example.websecurity.UserCredentials credentials, org.example.customer.Supplier supplier)
      Find Products by Supplier.
      Parameters:
      credentials - the UserCredentials for this Database operation
      supplier - the Supplier to search for
      Returns:
      a list of Products, this list may be empty
      Throws:
      IllegalArgumentException - if there is a connection or permission problem
    • addProduct

      int addProduct(org.example.websecurity.UserCredentials credentials, org.example.customer.Product product)
      Adds a Product.

      Only a Manager is permitted to add a Product.

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

      void updateProduct(org.example.websecurity.UserCredentials credentials, org.example.customer.Product product)
      Updates a Product.

      Only a Manager is permitted to update a Product.

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