Class TaskService

java.lang.Object
com.myhrcrmproject.service.TaskService
All Implemented Interfaces:
CommonService<TaskRequestDTO,TaskResponseDTO>

@Service public class TaskService extends Object implements CommonService<TaskRequestDTO,TaskResponseDTO>
Service class that handles CRUD (Create, Read, Update, Delete) operations for task entities.

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

Version:
1.0
Author:
Denys Chaykovskyy
  • Constructor Details

    • TaskService

      public TaskService()
  • Method Details

    • findAll

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

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

      public TaskResponseDTO create(TaskRequestDTO requestDTO)
      Creates a new task record based on the provided data.
      Specified by:
      create in interface CommonService<TaskRequestDTO,TaskResponseDTO>
      Parameters:
      requestDTO - The request DTO containing data for the new task record.
      Returns:
      The response DTO representing the newly created task record.
    • update

      public TaskResponseDTO update(Integer id, TaskRequestDTO requestDTO)
      Updates an existing task record with new data.
      Specified by:
      update in interface CommonService<TaskRequestDTO,TaskResponseDTO>
      Parameters:
      id - The identifier of the task record to update.
      requestDTO - The request DTO containing updated data for the task record.
      Returns:
      The response DTO representing the updated task record.
      Throws:
      NotFoundException - if the task record with the specified id is not found.
      org.springframework.web.server.NotAcceptableStatusException - if the authenticated user does not have permission to access this entity.
    • delete

      public void delete(Integer id)
      Deletes a task record by its unique identifier.
      Specified by:
      delete in interface CommonService<TaskRequestDTO,TaskResponseDTO>
      Parameters:
      id - The identifier of the task record to delete.
      Throws:
      NotFoundException - if the task record with the specified id is not found.
      org.springframework.web.server.NotAcceptableStatusException - if the authenticated user does not have permission to access this entity.
    • findAllByTaskStatusId

      public List<TaskResponseDTO> findAllByTaskStatusId(Integer id)
      Retrieves a list of task records based on the task status.
      Parameters:
      id - The identifier of the task status.
      Returns:
      A list of response DTOs representing task records with the specified status.
    • findAllByEmployeeId

      public List<TaskResponseDTO> findAllByEmployeeId(Integer id)
      Retrieves a list of task records associated with a specific employee.
      Parameters:
      id - The identifier of the employee to filter by.
      Returns:
      A list of response DTOs representing task records associated with the specified employee.
      Throws:
      NotFoundException - if the employee with the specified id is not found.
      org.springframework.web.server.NotAcceptableStatusException - if the authenticated user does not have permission to access this entity.
    • findAllByCandidateId

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

      public List<TaskResponseDTO> findAllByVacancyId(Integer id)
      Retrieves a list of task records associated with a specific vacancy.
      Parameters:
      id - The identifier of the vacancy to filter by.
      Returns:
      A list of response DTOs representing task records associated with the specified vacancy.
    • findAllByStartDate

      public List<TaskResponseDTO> findAllByStartDate(TaskDateRequestDTO requestDTO)
      Retrieves a list of task records based on the start date.
      Parameters:
      requestDTO - The request DTO containing the start date.
      Returns:
      A list of response DTOs representing task records with the specified start date.
    • findAllByDateAndEmployeeId

      public List<TaskShortResponseDTO> findAllByDateAndEmployeeId(Integer id, TaskDateRequestDTO requestDTO)
      Retrieves a list of short task records based on the date and employee id.
      Parameters:
      id - The identifier of the employee to filter by.
      requestDTO - The request DTO containing the date.
      Returns:
      A list of short response DTOs representing task records with the specified date and associated with the employee.
      Throws:
      NotFoundException - if the employee with the specified id is not found.
      org.springframework.web.server.NotAcceptableStatusException - if the authenticated user does not have permission to access this entity.
    • findAllByCandidateIdAndEmployeeId

      public List<TaskShortResponseDTO> findAllByCandidateIdAndEmployeeId(Integer candidateId, Integer employeeId)
      Retrieves a list of short task records based on the candidate id and employee id.
      Parameters:
      candidateId - The identifier of the candidate to filter by.
      employeeId - The identifier of the employee to filter by.
      Returns:
      A list of short response DTOs representing task records associated with the specified candidate and employee.
      Throws:
      NotFoundException - if the employee or candidate with the specified id is not found.
      org.springframework.web.server.NotAcceptableStatusException - if the authenticated user does not have permission to access this entity.
    • findAllByStatusIdAndEmployeeId

      public List<TaskShortResponseDTO> findAllByStatusIdAndEmployeeId(Integer statusId, Integer employeeId)
      Retrieves a list of short task records based on the status id and employee id.
      Parameters:
      statusId - The identifier of the task status.
      employeeId - The identifier of the employee to filter by.
      Returns:
      A list of short response DTOs representing task records with the specified status and associated with the employee.
      Throws:
      NotFoundException - if the employee with the specified id is not found or if no enum is found with the given id.
      org.springframework.web.server.NotAcceptableStatusException - if the authenticated user does not have permission to access this entity.
    • findAllByVacancyIdAndEmployeeId

      public List<TaskShortResponseDTO> findAllByVacancyIdAndEmployeeId(Integer vacancyId, Integer employeeId)
      Retrieves a list of short task records based on the vacancy id and employee id.
      Parameters:
      vacancyId - The identifier of the vacancy to filter by.
      employeeId - The identifier of the employee to filter by.
      Returns:
      A list of short response DTOs representing task records associated with the specified vacancy and employee.
      Throws:
      NotFoundException - if the employee or vacancy with the specified id is not found.
      org.springframework.web.server.NotAcceptableStatusException - if the authenticated user does not have permission to access this entity.