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 Type
    Method
    Description
    long
    Counts the total number of applications submitted by a specific candidate.
    long
    Counts the total number of applications for a specific job.
    long
    Counts the number of applications for a specific job with a specific status.
    Finds applications submitted after a specific date.
    Finds applications submitted within a specific date range.
    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.
    Finds an application by both candidate ID and job ID.
    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.
    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.
    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, save

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.mongodb.repository.MongoRepository

    findAll, findAll, insert, insert

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • findByCandidateId

      List<JobApplication> findByCandidateId(String candidateId)
      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

      List<JobApplication> findByJobId(String jobId)
      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

      List<JobApplication> findByStatus(String status)
      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

      Optional<JobApplication> findByCandidateIdAndJobId(String candidateId, String jobId)
      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 candidate
      jobId - 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 candidate
      pageable - 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 job
      pageable - 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 by
      pageable - pagination and sorting information
      Returns:
      a page of job applications with the specified status
    • findByApplicationDateBetween

      List<JobApplication> findByApplicationDateBetween(LocalDateTime startDate, LocalDateTime endDate)
      Finds applications submitted within a specific date range.
      Parameters:
      startDate - the start of the date range
      endDate - the end of the date range
      Returns:
      a list of job applications submitted within the specified period
    • countByJobIdAndStatus

      long countByJobIdAndStatus(String jobId, String status)
      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 job
      status - the application status to count
      Returns:
      the count of applications matching the criteria
    • countByCandidateId

      long countByCandidateId(String candidateId)
      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

      long countByJobId(String jobId)
      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

      List<JobApplication> findByApplicationDateAfter(LocalDateTime date)
      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

      List<JobApplication> findByStatusIn(List<String> statuses)
      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