Package org.example.customerdao
Interface ProductDAO
- All Superinterfaces:
Deleteable
- All Known Implementing Classes:
ProductDAOImpl
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 TypeMethodDescriptionintaddProduct(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.ProductfindProductById(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.voidsetReadOnlyDS(DataSource readOnlyDS) Sets the Read Only DataSource for this DAO Implication.voidsetReadWriteDS(DataSource readWriteDS) Sets the Read/Write DataSource for this DAO Implication.voidupdateProduct(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
Sets the Read Only DataSource for this DAO Implication.- Parameters:
readOnlyDS- the readOnlyDS to set
-
setReadWriteDS
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 operationid- 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 operationsupplier- 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 operationproduct- 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 operationproduct- the Product object to update- Throws:
IllegalArgumentException- if there is a connection or permission problem
-