Package com.myhrcrmproject.service
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate(TaskRequestDTO requestDTO) Creates a new task record based on the provided data.voidDeletes a task record by its unique identifier.findAll()Retrieves a list of all task records.Retrieves a list of task records associated with a specific candidate.findAllByCandidateIdAndEmployeeId(Integer candidateId, Integer employeeId) Retrieves a list of short task records based on the candidate id and employee id.findAllByDateAndEmployeeId(Integer id, TaskDateRequestDTO requestDTO) Retrieves a list of short task records based on the date and employee id.Retrieves a list of task records associated with a specific employee.findAllByStartDate(TaskDateRequestDTO requestDTO) Retrieves a list of task records based on the start date.findAllByStatusIdAndEmployeeId(Integer statusId, Integer employeeId) Retrieves a list of short task records based on the status id and employee id.Retrieves a list of task records based on the task status.Retrieves a list of task records associated with a specific vacancy.findAllByVacancyIdAndEmployeeId(Integer vacancyId, Integer employeeId) Retrieves a list of short task records based on the vacancy id and employee id.Retrieves a task record by its unique identifier.update(Integer id, TaskRequestDTO requestDTO) Updates an existing task record with new data.
-
Constructor Details
-
TaskService
public TaskService()
-
-
Method Details
-
findAll
Retrieves a list of all task records.- Specified by:
findAllin interfaceCommonService<TaskRequestDTO,TaskResponseDTO> - Returns:
- A list of response DTOs representing all task records.
-
findById
Retrieves a task record by its unique identifier.- Specified by:
findByIdin interfaceCommonService<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
Creates a new task record based on the provided data.- Specified by:
createin interfaceCommonService<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
Updates an existing task record with new data.- Specified by:
updatein interfaceCommonService<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
Deletes a task record by its unique identifier.- Specified by:
deletein interfaceCommonService<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
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
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
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
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
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.
-