Interface ApplicationRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<JobApplication,,String> org.springframework.data.repository.ListCrudRepository<JobApplication,,String> org.springframework.data.repository.ListPagingAndSortingRepository<JobApplication,,String> org.springframework.data.mongodb.repository.MongoRepository<JobApplication,,String> org.springframework.data.repository.PagingAndSortingRepository<JobApplication,,String> org.springframework.data.repository.query.QueryByExampleExecutor<JobApplication>,org.springframework.data.repository.Repository<JobApplication,String>
@Repository
public interface ApplicationRepository
extends org.springframework.data.mongodb.repository.MongoRepository<JobApplication,String>
Repository interface for accessing and manipulating JobApplication documents in MongoDB.
This repository provides methods for CRUD operations on JobApplication entities, as well as custom queries for retrieving applications based on various criteria such as candidate ID, job ID, application status, date ranges, and combinations of these factors. It leverages Spring Data MongoDB's query method naming conventions for defining custom finder methods and supports pagination for result sets.
As a Spring Data repository, it automatically provides standard operations like:
- Saving and updating job applications
- Deleting job applications
- Finding job applications by ID
- Retrieving all job applications
The interface also defines custom queries for application tracking, candidate and recruiter dashboards, and application analytics.
- Since:
- 2025-05-15
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionlongcountByCandidateId(String candidateId) Counts the total number of applications submitted by a specific candidate.longcountByJobId(String jobId) Counts the total number of applications for a specific job.longcountByJobIdAndStatus(String jobId, String status) Counts the number of applications for a specific job with a specific status.Finds applications submitted after a specific date.findByApplicationDateBetween(LocalDateTime startDate, LocalDateTime endDate) Finds applications submitted within a specific date range.findByCandidateId(String candidateId) Finds all applications submitted by a specific candidate.org.springframework.data.domain.Page<JobApplication> findByCandidateId(String candidateId, org.springframework.data.domain.Pageable pageable) Finds applications submitted by a specific candidate with pagination support.findByCandidateIdAndJobId(String candidateId, String jobId) Finds an application by both candidate ID and job ID.findByJobId(String jobId) Finds all applications submitted for a specific job.org.springframework.data.domain.Page<JobApplication> findByJobId(String jobId, org.springframework.data.domain.Pageable pageable) Finds applications submitted for a specific job with pagination support.findByStatus(String status) Finds all applications with a specific status.org.springframework.data.domain.Page<JobApplication> findByStatus(String status, org.springframework.data.domain.Pageable pageable) Finds applications with a specific status with pagination support.findByStatusIn(List<String> statuses) Finds applications with any of the specified statuses.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.mongodb.repository.MongoRepository
findAll, findAll, insert, insertMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByCandidateId
Finds all applications submitted by a specific candidate.- Parameters:
candidateId- the ID of the candidate- Returns:
- a list of job applications from the specified candidate
-
findByJobId
Finds all applications submitted for a specific job.- Parameters:
jobId- the ID of the job- Returns:
- a list of job applications for the specified job
-
findByStatus
Finds all applications with a specific status.- Parameters:
status- the application status to filter by (e.g., APPLIED, REVIEWING, SHORTLISTED, REJECTED, ACCEPTED)- Returns:
- a list of job applications with the specified status
-
findByCandidateIdAndJobId
Finds an application by both candidate ID and job ID. This is primarily used to check if a candidate has already applied to a specific job.- Parameters:
candidateId- the ID of the candidatejobId- the ID of the job- Returns:
- an Optional containing the application if found, or empty if not
-
findByCandidateId
org.springframework.data.domain.Page<JobApplication> findByCandidateId(String candidateId, org.springframework.data.domain.Pageable pageable) Finds applications submitted by a specific candidate with pagination support.- Parameters:
candidateId- the ID of the candidatepageable- pagination and sorting information- Returns:
- a page of job applications from the specified candidate
-
findByJobId
org.springframework.data.domain.Page<JobApplication> findByJobId(String jobId, org.springframework.data.domain.Pageable pageable) Finds applications submitted for a specific job with pagination support.- Parameters:
jobId- the ID of the jobpageable- pagination and sorting information- Returns:
- a page of job applications for the specified job
-
findByStatus
org.springframework.data.domain.Page<JobApplication> findByStatus(String status, org.springframework.data.domain.Pageable pageable) Finds applications with a specific status with pagination support.- Parameters:
status- the application status to filter bypageable- pagination and sorting information- Returns:
- a page of job applications with the specified status
-
findByApplicationDateBetween
Finds applications submitted within a specific date range.- Parameters:
startDate- the start of the date rangeendDate- the end of the date range- Returns:
- a list of job applications submitted within the specified period
-
countByJobIdAndStatus
Counts the number of applications for a specific job with a specific status. This is useful for generating application statistics.- Parameters:
jobId- the ID of the jobstatus- the application status to count- Returns:
- the count of applications matching the criteria
-
countByCandidateId
Counts the total number of applications submitted by a specific candidate.- Parameters:
candidateId- the ID of the candidate- Returns:
- the count of applications submitted by the candidate
-
countByJobId
Counts the total number of applications for a specific job.- Parameters:
jobId- the ID of the job- Returns:
- the count of applications for the job
-
findByApplicationDateAfter
Finds applications submitted after a specific date. This is useful for retrieving recent applications.- Parameters:
date- the threshold date- Returns:
- a list of job applications submitted after the specified date
-
findByStatusIn
Finds applications with any of the specified statuses.- Parameters:
statuses- a list of application statuses to match- Returns:
- a list of job applications with any of the specified statuses
-