Class CommunicationService

java.lang.Object
com.myhrcrmproject.service.CommunicationService
All Implemented Interfaces:
CommonService<CommunicationRequestDTO,CommunicationResponseDTO>

@Service public class CommunicationService extends Object implements CommonService<CommunicationRequestDTO,CommunicationResponseDTO>
Service class that handles CRUD (Create, Read, Update, Delete) operations for communication entities.

This service provides methods to perform operations on communication entities, such as retrieving, creating, updating, and deleting communication records. It also includes additional methods for finding communication records based on different criteria.

Version:
1.0
Author:
Denys Chaykovskyy
  • Constructor Details

    • CommunicationService

      public CommunicationService()
  • Method Details

    • findAll

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

      public CommunicationResponseDTO findById(Integer id)
      Retrieves a communication record by its unique identifier.
      Specified by:
      findById in interface CommonService<CommunicationRequestDTO,CommunicationResponseDTO>
      Parameters:
      id - The identifier of the communication record to retrieve.
      Returns:
      The response DTO representing the retrieved communication record.
      Throws:
      NotFoundException - if the communication record with the specified id is not found.
    • create

      Creates a new communication record based on the provided data.
      Specified by:
      create in interface CommonService<CommunicationRequestDTO,CommunicationResponseDTO>
      Parameters:
      requestDTO - The request DTO containing data for the new communication record.
      Returns:
      The response DTO representing the newly created communication record.
    • update

      public CommunicationResponseDTO update(Integer id, CommunicationRequestDTO requestDTO)
      Updates an existing communication record with new data.
      Specified by:
      update in interface CommonService<CommunicationRequestDTO,CommunicationResponseDTO>
      Parameters:
      id - The identifier of the communication record to update.
      requestDTO - The request DTO containing updated data for the communication record.
      Returns:
      The response DTO representing the updated communication record.
      Throws:
      NotFoundException - if the communication record with the specified id is not found.
    • delete

      public void delete(Integer id)
      Deletes a communication record by its unique identifier.
      Specified by:
      delete in interface CommonService<CommunicationRequestDTO,CommunicationResponseDTO>
      Parameters:
      id - The identifier of the communication record to delete.
      Throws:
      NotFoundException - if the communication record with the specified id is not found.
    • findAllByCommunicationTypeId

      public List<CommunicationResponseDTO> findAllByCommunicationTypeId(Integer id)
      Retrieves a list of communication records based on the type of communication.
      Parameters:
      id - The identifier of the communication type.
      Returns:
      A list of response DTOs representing communication records of the specified type.
    • findAllByEmployeeId

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

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

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

      public List<CommunicationResponseDTO> findAllByVacancyId(Integer id)
      Retrieves a list of communications associated with a specific vacancy.
      Parameters:
      id - The identifier of the vacancy to filter by.
      Returns:
      A list of CandidateShortResponseDTO representing communications associated with the specified vacancy.