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
ConstructorDescriptionCustomerQueryHandlerService
(CustomerRepository customerRepository, Mappers mappers) Constructs aCustomerQueryHandlerService
with the specifiedCustomerRepository
andMappers
instance. -
Method Summary
Modifier and TypeMethodDescriptionon
(@NotNull GetAllCustomersQuery query) Handles theGetAllCustomersQuery
by retrieving and mapping all customers.on
(@NotNull GetCustomerByIdQuery query) Handles theGetCustomerByIdQuery
by retrieving and mapping a customer's details by ID.on
(@NotNull SearchCustomersQuery query) Handles theSearchCustomersQuery
by performing a keyword search and mapping the results.
-
Constructor Details
-
CustomerQueryHandlerService
Constructs aCustomerQueryHandlerService
with the specifiedCustomerRepository
andMappers
instance.- Parameters:
customerRepository
- The repository for retrieving customer data.mappers
- The mapper utility for converting entities to DTOs.
-
-
Method Details
-
on
Handles theGetCustomerByIdQuery
by retrieving and mapping a customer's details by ID.- Parameters:
query
- TheGetCustomerByIdQuery
to handle.- Returns:
- A
CustomerResponseDTO
containing the details of the requested customer. - Throws:
CustomerNotFoundException
- if no customer with the given ID is found.
-
on
Handles theSearchCustomersQuery
by performing a keyword search and mapping the results.- Parameters:
query
- TheSearchCustomersQuery
to handle.- Returns:
- A list of
CustomerResponseDTO
objects matching the search criteria.
-
on
Handles theGetAllCustomersQuery
by retrieving and mapping all customers.- Parameters:
query
- TheGetAllCustomersQuery
to handle.- Returns:
- A list of
CustomerResponseDTO
objects representing all customers.
-