Package com.myhrcrmproject.service
Class ClientService
java.lang.Object
com.myhrcrmproject.service.ClientService
- All Implemented Interfaces:
CommonService<ClientRequestDTO,ClientResponseDTO>
@Service
public class ClientService
extends Object
implements CommonService<ClientRequestDTO,ClientResponseDTO>
Service class for managing client-related operations in the HR CRM system.
This service provides functionality for creating, updating, retrieving, and deleting client records.
It interacts with the ClientRepository for data access and the ClientConverter for
converting between entity and DTO objects.
The class is annotated with @Service to indicate its role as a Spring service bean.
- Version:
- 1.0
- Author:
- Denys Chaykovskyy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate(ClientRequestDTO requestDTO) Creates a new client record based on the provided data.voidDeletes a client by their unique identifier.findAll()Retrieves a list of all clients in the system.Retrieves a client by their unique identifier.update(Integer id, ClientRequestDTO requestDTO) Updates an existing client record with new data.
-
Constructor Details
-
ClientService
public ClientService()
-
-
Method Details
-
findAll
Retrieves a list of all clients in the system.- Specified by:
findAllin interfaceCommonService<ClientRequestDTO,ClientResponseDTO> - Returns:
- A list of
ClientResponseDTOrepresenting all clients.
-
findById
Retrieves a client by their unique identifier.- Specified by:
findByIdin interfaceCommonService<ClientRequestDTO,ClientResponseDTO> - Parameters:
id- The identifier of the client to retrieve.- Returns:
- The
ClientResponseDTOrepresenting the retrieved client. - Throws:
NotFoundException- if the client with the specified ID is not found.
-
create
Creates a new client record based on the provided data.- Specified by:
createin interfaceCommonService<ClientRequestDTO,ClientResponseDTO> - Parameters:
requestDTO- TheClientRequestDTOcontaining data for the new client.- Returns:
- The
ClientResponseDTOrepresenting the newly created client.
-
update
Updates an existing client record with new data.- Specified by:
updatein interfaceCommonService<ClientRequestDTO,ClientResponseDTO> - Parameters:
id- The identifier of the client to update.requestDTO- TheClientRequestDTOcontaining updated data for the client.- Returns:
- The
ClientResponseDTOrepresenting the updated client. - Throws:
NotFoundException- if the client with the specified ID is not found.
-
delete
Deletes a client by their unique identifier.- Specified by:
deletein interfaceCommonService<ClientRequestDTO,ClientResponseDTO> - Parameters:
id- The identifier of the client to delete.- Throws:
NotFoundException- if the client with the specified ID is not found.
-