Package org.bookstore.customer.service
Interface CustomerService
public interface CustomerService
The interface CustomerService defines a service to manage the customers of a bookstore.
-
Method Summary
Modifier and TypeMethodDescriptionfindCustomer
(long id) Finds a customer by identifier.registerCustomer
(Customer customer) Registers a customer.updateCustomer
(Customer customer) Updates the data of a customer.
-
Method Details
-
registerCustomer
Registers a customer.- Parameters:
customer
- the data of the customer (identifier must be null)- Returns:
- the data of the registered customer
- Throws:
EmailAlreadyUsedException
- if the email address is already used by another customer
-
findCustomer
Finds a customer by identifier.- Parameters:
id
- the identifier of the customer- Returns:
- the data of the found customer
- Throws:
CustomerNotFoundException
- if no customer with the specified identifier exists
-
updateCustomer
Customer updateCustomer(Customer customer) throws CustomerNotFoundException, EmailAlreadyUsedException Updates the data of a customer.- Parameters:
customer
- the new data of the customer- Returns:
- the data of the updated customer
- Throws:
CustomerNotFoundException
- if no customer with the corresponding identifier existsEmailAlreadyUsedException
- if the email address to be changed is already used by another customer
-