Package org.example.customerdao
Class OrderDAOImpl
java.lang.Object
org.example.customerdao.OrderDAOImpl
- All Implemented Interfaces:
OrderDAO,Deleteable
This is the OrderDAO Implementation 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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintaddOrder(org.example.websecurity.UserCredentials credentials, org.example.customer.Order order) Adds a Order.voiddeleteEntity(org.example.websecurity.UserCredentials credentials, int id) Deletes a CuUstomerEntity by id.voiddeleteEntity(org.example.websecurity.UserCredentials credentials, org.example.customer.utility.CustomerEntity entity) Deletes an CustomerEntity.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.OrderfindOrderById(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.booleanisDeleteable(org.example.websecurity.UserCredentials credentials, int id) This method will determine if a CustomerEntity record can be deleted.booleanisDeleteable(org.example.websecurity.UserCredentials credentials, org.example.customer.utility.CustomerEntity entity) Checks to see if a Product has Orders, if not the Product is deleteable.voidsetReadOnlyDS(DataSource readOnlyDS) Sets the Read Only DataSource for this DAO Implication.voidsetReadWriteDS(DataSource readWriteDS) Sets the Read/Write DataSource for this DAO Implication.voidupdateOrder(org.example.websecurity.UserCredentials credentials, org.example.customer.Order order) Updates a Order.
-
Constructor Details
-
OrderDAOImpl
public OrderDAOImpl()
-
-
Method Details
-
setReadOnlyDS
Sets the Read Only DataSource for this DAO Implication.- Specified by:
setReadOnlyDSin interfaceOrderDAO- Parameters:
readOnlyDS- the readOnlyDS to set
-
setReadWriteDS
Sets the Read/Write DataSource for this DAO Implication.- Specified by:
setReadWriteDSin interfaceOrderDAO- Parameters:
readWriteDS- the readWriteDS to set
-
findAllOrders
public List<org.example.customer.Order> findAllOrders(org.example.websecurity.UserCredentials credentials) Finds all Orders.- Specified by:
findAllOrdersin interfaceOrderDAO- Parameters:
credentials- the UserCredentials for this Database operation- Returns:
- a list of Orders, this list may be empty
-
findAllOrderItems
public List<org.example.customer.OrderItem> findAllOrderItems(org.example.websecurity.UserCredentials credentials, org.example.customer.Order order) Finds all Order_Items by Order.- Specified by:
findAllOrderItemsin interfaceOrderDAO- Parameters:
credentials- the UserCredentials for this Database operationorder- the order to search for- Returns:
- a list of OrderItems, this list may be empty
-
findOrderById
public 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.
- Specified by:
findOrderByIdin interfaceOrderDAO- Parameters:
credentials- the UserCredentials for this Database operationid- the Order ID to search for- Returns:
- a Order or null if the Order is not found
-
findOrdersByCustomer
public List<org.example.customer.Order> findOrdersByCustomer(org.example.websecurity.UserCredentials credentials, org.example.customer.Customer customer) Find Orders by Customer.- Specified by:
findOrdersByCustomerin interfaceOrderDAO- Parameters:
credentials- the UserCredentials for this Database operationcustomer- the Customer to search for- Returns:
- a list of Orders, this list may be empty
-
addOrder
public int addOrder(org.example.websecurity.UserCredentials credentials, org.example.customer.Order order) Adds a Order. -
updateOrder
public void updateOrder(org.example.websecurity.UserCredentials credentials, org.example.customer.Order order) Updates a Order.- Specified by:
updateOrderin interfaceOrderDAO- Parameters:
credentials- the UserCredentials for this Database operationorder- the Order object to update
-
deleteEntity
public void deleteEntity(org.example.websecurity.UserCredentials credentials, org.example.customer.utility.CustomerEntity entity) Deletes an CustomerEntity.Only a Manager is permitted to delete a CustomerEntity.
If this CustomerEntity fails to meet the criteria for deletion, the delete will fail.
- Specified by:
deleteEntityin interfaceDeleteable- Parameters:
credentials- the UserCredentials for this Database operationentity- the CustomerEntity object to delete
-
deleteEntity
public void deleteEntity(org.example.websecurity.UserCredentials credentials, int id) Deletes a CuUstomerEntity by id.Only a Manager is permitted to delete a CustomerEntity.
- Specified by:
deleteEntityin interfaceDeleteable- Parameters:
credentials- the UserCredentials for this Database operationid- the CustomerEntity id to delete
-
isDeleteable
public boolean isDeleteable(org.example.websecurity.UserCredentials credentials, int id) This method will determine if a CustomerEntity record can be deleted.Only Managers can delete CustomerEntity records.
Order are deleteable.
- Specified by:
isDeleteablein interfaceDeleteable- Parameters:
credentials- the UserCredentials for this Database operationid- the if of the object to delete- Returns:
- true if the object is deleteable
-
isDeleteable
public boolean isDeleteable(org.example.websecurity.UserCredentials credentials, org.example.customer.utility.CustomerEntity entity) Checks to see if a Product has Orders, if not the Product is deleteable.Only Managers can delete CustomerEntity records.
Order are deleteable.
- Specified by:
isDeleteablein interfaceDeleteable- Parameters:
credentials- the UserCredentials for this Database operationentity- the CustomerEntity object to check- Returns:
- true if the CustomerEntity is deleteable
-