Package com.myhrcrmproject.service
Class CandidateService
java.lang.Object
com.myhrcrmproject.service.CandidateService
- All Implemented Interfaces:
CommonService<CandidateRequestDTO,CandidateResponseDTO>
@Service
public class CandidateService
extends Object
implements CommonService<CandidateRequestDTO,CandidateResponseDTO>
Service class for managing candidate-related operations in the HR CRM system.
This service provides functionality for creating, updating, retrieving, and deleting candidate records.
It interacts with the CandidateRepository for data access and the CandidateConverter for
converting between entity and DTO objects.
Additionally, the service includes methods for finding candidates by their status and by the associated
vacancy. The entityAfterCreateProcedures method is a helper function for setting default values during
candidate creation.
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(CandidateRequestDTO requestDTO) Creates a new candidate record based on the provided data.voidDeletes a candidate by their unique identifier.findAll()Retrieves a list of all candidates in the system.Retrieves a list of candidates with a specific status.Retrieves a list of candidates associated with a specific vacancy.Retrieves a candidate by their unique identifier.update(Integer id, CandidateRequestDTO requestDTO) Updates an existing candidate record with new data.
-
Constructor Details
-
CandidateService
public CandidateService()
-
-
Method Details
-
findAll
Retrieves a list of all candidates in the system.- Specified by:
findAllin interfaceCommonService<CandidateRequestDTO,CandidateResponseDTO> - Returns:
- A list of
CandidateResponseDTOrepresenting all candidates.
-
findById
Retrieves a candidate by their unique identifier.- Specified by:
findByIdin interfaceCommonService<CandidateRequestDTO,CandidateResponseDTO> - Parameters:
id- The identifier of the candidate to retrieve.- Returns:
- The
CandidateResponseDTOrepresenting the retrieved candidate. - Throws:
NotFoundException- if the candidate with the specified ID is not found.
-
create
Creates a new candidate record based on the provided data.- Specified by:
createin interfaceCommonService<CandidateRequestDTO,CandidateResponseDTO> - Parameters:
requestDTO- TheCandidateRequestDTOcontaining data for the new candidate.- Returns:
- The
CandidateResponseDTOrepresenting the newly created candidate. - Throws:
AlreadyExistsException- if the specified email already exists.
-
delete
Deletes a candidate by their unique identifier.- Specified by:
deletein interfaceCommonService<CandidateRequestDTO,CandidateResponseDTO> - Parameters:
id- The identifier of the candidate to delete.- Throws:
NotFoundException- if the candidate with the specified ID is not found.
-
update
Updates an existing candidate record with new data.- Specified by:
updatein interfaceCommonService<CandidateRequestDTO,CandidateResponseDTO> - Parameters:
id- The identifier of the candidate to update.requestDTO- TheCandidateRequestDTOcontaining updated data for the candidate.- Returns:
- The
CandidateResponseDTOrepresenting the updated candidate. - Throws:
NotFoundException- if the candidate with the specified ID is not found.
-
findAllByStatusId
Retrieves a list of candidates with a specific status.- Parameters:
id- The identifier of the status to filter by.- Returns:
- A list of
CandidateShortResponseDTOrepresenting candidates with the specified status.
-
findAllByVacancyId
Retrieves a list of candidates associated with a specific vacancy.- Parameters:
id- The identifier of the vacancy to filter by.- Returns:
- A list of
CandidateShortResponseDTOrepresenting candidates associated with the specified vacancy.
-