Interface CommonService<Q,R>

Type Parameters:
Q - The type of the request DTO.
R - The type of the response DTO.
All Known Implementing Classes:
CandidateService, ClientService, CommunicationService, CompensationService, ContractService, EmployeeService, InterviewService, TaskService, UserDetailsServiceImpl, VacancyService

public interface CommonService<Q,R>
Generic interface for common CRUD (Create, Read, Update, Delete) operations in a service layer.

This interface defines standard methods for performing CRUD operations on entities. Implementing services should provide concrete implementations for these methods based on the specific requirements of the entities they manage.

The type parameters Q and R represent the request and response DTO types, respectively.

Version:
1.0
Author:
Denys Chaykovskyy
  • Method Summary

    Modifier and Type
    Method
    Description
    create(Q requestDTO)
    Creates a new entity based on the provided data.
    void
    Deletes an entity by its unique identifier.
    Retrieves a list of all entities.
    Retrieves an entity by its unique identifier.
    update(Integer id, Q requestDTO)
    Updates an existing entity with new data.
  • Method Details

    • findAll

      List<R> findAll()
      Retrieves a list of all entities.
      Returns:
      A list of response DTOs representing all entities.
    • findById

      R findById(Integer id)
      Retrieves an entity by its unique identifier.
      Parameters:
      id - The identifier of the entity to retrieve.
      Returns:
      The response DTO representing the retrieved entity.
    • create

      R create(Q requestDTO)
      Creates a new entity based on the provided data.
      Parameters:
      requestDTO - The request DTO containing data for the new entity.
      Returns:
      The response DTO representing the newly created entity.
    • update

      R update(Integer id, Q requestDTO)
      Updates an existing entity with new data.
      Parameters:
      id - The identifier of the entity to update.
      requestDTO - The request DTO containing updated data for the entity.
      Returns:
      The response DTO representing the updated entity.
    • delete

      void delete(Integer id)
      Deletes an entity by its unique identifier.
      Parameters:
      id - The identifier of the entity to delete.