Class RecruiterService

java.lang.Object
me.josephsf.jobportaljosephsfeir.service.RecruiterService

@Service public class RecruiterService extends Object
Service class for managing recruiter data and operations in the Job Portal system.

This service provides methods for creating, retrieving, updating, and deleting recruiter profiles, as well as searching for recruiters and calculating recruiter statistics. It interacts with the MongoDB database through the RecruiterRepository and JobRepository, handling related business logic.

Since:
2025-05-15
  • Constructor Details

    • RecruiterService

      public RecruiterService(RecruiterRepository recruiterRepository, JobRepository jobRepository)
      Constructs a new RecruiterService with required dependencies.
      Parameters:
      recruiterRepository - Repository for recruiter data operations
      jobRepository - Repository for job data operations
  • Method Details

    • getRecruiterById

      public Recruiter getRecruiterById(String id)
      Retrieves a recruiter by their ID.
      Parameters:
      id - The unique identifier of the recruiter
      Returns:
      The recruiter if found, null otherwise
    • getRecruiterByUserId

      public Recruiter getRecruiterByUserId(String userId)
      Retrieves a recruiter by their user ID.
      Parameters:
      userId - The user ID associated with the recruiter profile
      Returns:
      The recruiter if found, null otherwise
    • createRecruiterProfile

      public Recruiter createRecruiterProfile(RecruiterDto recruiterDto)
      Creates a new recruiter profile.
      Parameters:
      recruiterDto - The data transfer object containing recruiter information
      Returns:
      The created recruiter profile or null if a profile already exists for the user
    • updateRecruiterProfile

      public Recruiter updateRecruiterProfile(String id, RecruiterDto recruiterDto)
      Updates an existing recruiter profile.
      Parameters:
      id - The unique identifier of the recruiter to update
      recruiterDto - The data transfer object containing updated recruiter information
      Returns:
      The updated recruiter profile or null if the recruiter is not found
    • deleteRecruiterProfile

      public boolean deleteRecruiterProfile(String id)
      Deletes a recruiter profile.
      Parameters:
      id - The unique identifier of the recruiter to delete
      Returns:
      true if the recruiter was successfully deleted, false otherwise
    • getRecruitersByCompany

      public List<Recruiter> getRecruitersByCompany(String companyName)
      Finds recruiters by company name.
      Parameters:
      companyName - The company name to search for
      Returns:
      List of recruiters associated with the specified company
    • searchRecruiters

      public List<Recruiter> searchRecruiters(String companyName, String location, String industry)
      Searches for recruiters based on various criteria.
      Parameters:
      companyName - The company name to filter by
      location - The location to filter by
      industry - The industry to filter by
      Returns:
      List of recruiters matching the search criteria
    • verifyRecruiter

      public Recruiter verifyRecruiter(String id)
      Verifies a recruiter profile. Verification is an administrative action that confirms the legitimacy of a recruiter.
      Parameters:
      id - The unique identifier of the recruiter to verify
      Returns:
      The updated, verified recruiter or null if the recruiter is not found
    • getVerifiedRecruiters

      public List<Recruiter> getVerifiedRecruiters()
      Retrieves all verified recruiters.
      Returns:
      List of verified recruiter profiles
    • getRecruiterStats

      public Map<String,Object> getRecruiterStats(String recruiterId)
      Generates statistics for a recruiter.
      Parameters:
      recruiterId - The unique identifier of the recruiter
      Returns:
      A map containing various statistics about the recruiter's job postings
    • isVerified

      public boolean isVerified(String recruiterId)
      Checks if a recruiter is verified.
      Parameters:
      recruiterId - The unique identifier of the recruiter
      Returns:
      true if the recruiter is verified, false otherwise