Package com.myhrcrmproject.service
Class ContractService
java.lang.Object
com.myhrcrmproject.service.ContractService
- All Implemented Interfaces:
CommonService<ContractRequestDTO,ContractResponseDTO>
@Service
public class ContractService
extends Object
implements CommonService<ContractRequestDTO,ContractResponseDTO>
Service class that handles CRUD (Create, Read, Update, Delete) operations for contract entities.
This service provides methods to perform operations on contract entities, such as retrieving, creating, updating, and deleting contract records. It also includes additional methods for finding contract records based on different criteria.
- Version:
- 1.0
- Author:
- Denys Chaykovskyy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate(ContractRequestDTO requestDTO) Creates a new contract record based on the provided data.voidDeletes a contract record by its unique identifier.findAll()Retrieves a list of all contract records.Retrieves a list of all active contract records.Retrieves a list of contracts associated with a specific candidate.Retrieves a list of contracts associated with a specific client.Retrieves a list of contract records based on the type of contract.Retrieves a list of contracts associated with a specific employee.Retrieves a contract record by its unique identifier.update(Integer id, ContractRequestDTO requestDTO) Updates an existing contract record with new data.
-
Constructor Details
-
ContractService
public ContractService()
-
-
Method Details
-
findAll
Retrieves a list of all contract records.- Specified by:
findAllin interfaceCommonService<ContractRequestDTO,ContractResponseDTO> - Returns:
- A list of response DTOs representing all contract records.
-
findById
Retrieves a contract record by its unique identifier.- Specified by:
findByIdin interfaceCommonService<ContractRequestDTO,ContractResponseDTO> - Parameters:
id- The identifier of the contract record to retrieve.- Returns:
- The response DTO representing the retrieved contract record.
- Throws:
NotFoundException- if the contract record with the specified id is not found.
-
create
Creates a new contract record based on the provided data.- Specified by:
createin interfaceCommonService<ContractRequestDTO,ContractResponseDTO> - Parameters:
requestDTO- The request DTO containing data for the new contract record.- Returns:
- The response DTO representing the newly created contract record.
-
update
Updates an existing contract record with new data.- Specified by:
updatein interfaceCommonService<ContractRequestDTO,ContractResponseDTO> - Parameters:
id- The identifier of the contract record to update.requestDTO- The request DTO containing updated data for the contract record.- Returns:
- The response DTO representing the updated contract record.
- Throws:
NotFoundException- if the contract record with the specified id is not found.
-
delete
Deletes a contract record by its unique identifier.- Specified by:
deletein interfaceCommonService<ContractRequestDTO,ContractResponseDTO> - Parameters:
id- The identifier of the contract record to delete.- Throws:
NotFoundException- if the contract record with the specified id is not found.
-
findAllByContractTypeId
Retrieves a list of contract records based on the type of contract.- Parameters:
id- The identifier of the contract type.- Returns:
- A list of response DTOs representing contract records of the specified type.
-
findAllByEmployeeId
Retrieves a list of contracts associated with a specific employee.- Parameters:
id- The identifier of the employee to filter by.- Returns:
- A list of
CommunicationResponseDTOrepresenting contracts associated with the specified employee.
-
findAllByClientId
Retrieves a list of contracts associated with a specific client.- Parameters:
id- The identifier of the client to filter by.- Returns:
- A list of
CommunicationResponseDTOrepresenting contracts associated with the specified client.
-
findAllByCandidateId
Retrieves a list of contracts associated with a specific candidate.- Parameters:
id- The identifier of the candidate to filter by.- Returns:
- A list of
CommunicationResponseDTOrepresenting contracts associated with the specified candidate.
-
findAllActiveContracts
Retrieves a list of all active contract records.- Returns:
- A list of
CommunicationResponseDTOrepresenting all active contract records.
-