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 Details

    • ContractService

      public ContractService()
  • Method Details

    • findAll

      public List<ContractResponseDTO> findAll()
      Retrieves a list of all contract records.
      Specified by:
      findAll in interface CommonService<ContractRequestDTO,ContractResponseDTO>
      Returns:
      A list of response DTOs representing all contract records.
    • findById

      public ContractResponseDTO findById(Integer id)
      Retrieves a contract record by its unique identifier.
      Specified by:
      findById in interface CommonService<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

      public ContractResponseDTO create(ContractRequestDTO requestDTO)
      Creates a new contract record based on the provided data.
      Specified by:
      create in interface CommonService<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

      public ContractResponseDTO update(Integer id, ContractRequestDTO requestDTO)
      Updates an existing contract record with new data.
      Specified by:
      update in interface CommonService<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

      public void delete(Integer id)
      Deletes a contract record by its unique identifier.
      Specified by:
      delete in interface CommonService<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

      public List<ContractResponseDTO> findAllByContractTypeId(Integer id)
      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

      public List<ContractResponseDTO> findAllByEmployeeId(Integer id)
      Retrieves a list of contracts associated with a specific employee.
      Parameters:
      id - The identifier of the employee to filter by.
      Returns:
      A list of CommunicationResponseDTO representing contracts associated with the specified employee.
    • findAllByClientId

      public List<ContractResponseDTO> findAllByClientId(Integer id)
      Retrieves a list of contracts associated with a specific client.
      Parameters:
      id - The identifier of the client to filter by.
      Returns:
      A list of CommunicationResponseDTO representing contracts associated with the specified client.
    • findAllByCandidateId

      public List<ContractResponseDTO> findAllByCandidateId(Integer id)
      Retrieves a list of contracts associated with a specific candidate.
      Parameters:
      id - The identifier of the candidate to filter by.
      Returns:
      A list of CommunicationResponseDTO representing contracts associated with the specified candidate.
    • findAllActiveContracts

      public List<ContractResponseDTO> findAllActiveContracts()
      Retrieves a list of all active contract records.
      Returns:
      A list of CommunicationResponseDTO representing all active contract records.