Class CustomerQueryHandlerService
java.lang.Object
com.brodygaudel.bank.query.service.customer.CustomerQueryHandlerService
Service class for handling customer-related queries and providing query responses.
-
Constructor Summary
ConstructorsConstructorDescriptionCustomerQueryHandlerService(CustomerRepository customerRepository, Mappers mappers) Constructs aCustomerQueryHandlerServicewith the specifiedCustomerRepositoryandMappersinstance. -
Method Summary
Modifier and TypeMethodDescriptionon(@NotNull GetAllCustomersQuery query) Handles theGetAllCustomersQueryby retrieving and mapping all customers.on(@NotNull GetCustomerByIdQuery query) Handles theGetCustomerByIdQueryby retrieving and mapping a customer's details by ID.on(@NotNull SearchCustomersQuery query) Handles theSearchCustomersQueryby performing a keyword search and mapping the results.
-
Constructor Details
-
CustomerQueryHandlerService
Constructs aCustomerQueryHandlerServicewith the specifiedCustomerRepositoryandMappersinstance.- Parameters:
customerRepository- The repository for retrieving customer data.mappers- The mapper utility for converting entities to DTOs.
-
-
Method Details
-
on
Handles theGetCustomerByIdQueryby retrieving and mapping a customer's details by ID.- Parameters:
query- TheGetCustomerByIdQueryto handle.- Returns:
- A
CustomerResponseDTOcontaining the details of the requested customer. - Throws:
CustomerNotFoundException- if no customer with the given ID is found.
-
on
Handles theSearchCustomersQueryby performing a keyword search and mapping the results.- Parameters:
query- TheSearchCustomersQueryto handle.- Returns:
- A list of
CustomerResponseDTOobjects matching the search criteria.
-
on
Handles theGetAllCustomersQueryby retrieving and mapping all customers.- Parameters:
query- TheGetAllCustomersQueryto handle.- Returns:
- A list of
CustomerResponseDTOobjects representing all customers.
-