Class RecruiterService
java.lang.Object
me.josephsf.jobportaljosephsfeir.service.RecruiterService
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 Summary
ConstructorsConstructorDescriptionRecruiterService(RecruiterRepository recruiterRepository, JobRepository jobRepository) Constructs a new RecruiterService with required dependencies. -
Method Summary
Modifier and TypeMethodDescriptioncreateRecruiterProfile(RecruiterDto recruiterDto) Creates a new recruiter profile.booleanDeletes a recruiter profile.Retrieves a recruiter by their ID.getRecruiterByUserId(String userId) Retrieves a recruiter by their user ID.getRecruitersByCompany(String companyName) Finds recruiters by company name.getRecruiterStats(String recruiterId) Generates statistics for a recruiter.Retrieves all verified recruiters.booleanisVerified(String recruiterId) Checks if a recruiter is verified.searchRecruiters(String companyName, String location, String industry) Searches for recruiters based on various criteria.updateRecruiterProfile(String id, RecruiterDto recruiterDto) Updates an existing recruiter profile.Verifies a recruiter profile.
-
Constructor Details
-
RecruiterService
Constructs a new RecruiterService with required dependencies.- Parameters:
recruiterRepository- Repository for recruiter data operationsjobRepository- Repository for job data operations
-
-
Method Details
-
getRecruiterById
Retrieves a recruiter by their ID.- Parameters:
id- The unique identifier of the recruiter- Returns:
- The recruiter if found, null otherwise
-
getRecruiterByUserId
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
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
Updates an existing recruiter profile.- Parameters:
id- The unique identifier of the recruiter to updaterecruiterDto- The data transfer object containing updated recruiter information- Returns:
- The updated recruiter profile or null if the recruiter is not found
-
deleteRecruiterProfile
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
Finds recruiters by company name.- Parameters:
companyName- The company name to search for- Returns:
- List of recruiters associated with the specified company
-
searchRecruiters
Searches for recruiters based on various criteria.- Parameters:
companyName- The company name to filter bylocation- The location to filter byindustry- The industry to filter by- Returns:
- List of recruiters matching the search criteria
-
verifyRecruiter
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
Retrieves all verified recruiters.- Returns:
- List of verified recruiter profiles
-
getRecruiterStats
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
Checks if a recruiter is verified.- Parameters:
recruiterId- The unique identifier of the recruiter- Returns:
- true if the recruiter is verified, false otherwise
-