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