Package org.example.customerdao
Interface CustomerDAO
- All Superinterfaces:
Deleteable
- All Known Implementing Classes:
CustomerDAOImpl
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 TypeMethodDescriptionintaddCustomer(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.CustomerfindCustomerById(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.voidsetReadOnlyDS(DataSource readOnlyDS) Sets the Read Only DataSource for this DAO Implication.voidsetReadWriteDS(DataSource readWriteOnlyDS) Sets the Read/Write DataSource for this DAO Implication.voidupdateCustomer(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
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:
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 operationid- 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 operationfirstName- the first name to search forlastName- 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 operationcustomer- 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 operationcustomer- the Customer object to update- Throws:
IllegalArgumentException- if there is a connection or permission problem
-