Interface JpaApplicationRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<ApplicationEntity,Long>, JpaBaseRepository<ApplicationEntity>, org.springframework.data.jpa.repository.JpaRepository<ApplicationEntity,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<ApplicationEntity>, org.springframework.data.repository.PagingAndSortingRepository<ApplicationEntity,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<ApplicationEntity>, org.springframework.data.repository.Repository<ApplicationEntity,Long>

public interface JpaApplicationRepository extends JpaBaseRepository<ApplicationEntity>
Application repository.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Find any application records where they are not linked to any jobs and it's not linked to any commands and was created before the given time.
  • Method Summary

    Modifier and Type
    Method
    Description
    findUnusedApplications(Instant createdThreshold, int limit)
    Delete any application records where it's not linked to any jobs and it's not linked to any commands and was created before the given time.
    Get the ApplicationEntity but eagerly fetch all command base information as well.
    Get the ApplicationEntity but eagerly fetch all command DTO information as well.
    Get the ApplicationEntity but eagerly fetch all relational information needed to construct a DTO.

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

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface com.netflix.genie.web.data.services.impl.jpa.repositories.JpaBaseRepository

    deleteByIdIn, existsByUniqueId, findByUniqueId, findByUniqueId

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getById, getOne, getReferenceById, saveAll, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor

    count, exists, findAll, findAll, findAll, findOne

    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
  • Field Details

    • FIND_UNUSED_APPLICATIONS_QUERY

      static final String FIND_UNUSED_APPLICATIONS_QUERY
      Find any application records where they are not linked to any jobs and it's not linked to any commands and was created before the given time.
      See Also:
  • Method Details

    • findUnusedApplications

      @Query(value="SELECT id FROM applications WHERE created < :createdThreshold AND id NOT IN (SELECT DISTINCT(application_id) FROM commands_applications) AND id NOT IN (SELECT DISTINCT(application_id) FROM jobs_applications) LIMIT :limit", nativeQuery=true) Set<Long> findUnusedApplications(@Param("createdThreshold") Instant createdThreshold, @Param("limit") int limit)
      Delete any application records where it's not linked to any jobs and it's not linked to any commands and was created before the given time.
      Parameters:
      createdThreshold - The instant in time before which records should be considered for deletion. Exclusive.
      limit - Maximum number of IDs to return
      Returns:
      The ids of the applications that are unused
    • getApplicationDto

      @Query("SELECT a FROM ApplicationEntity a WHERE a.uniqueId = :id") @EntityGraph(value="Application.dto", type=LOAD) Optional<ApplicationEntity> getApplicationDto(@Param("id") String id)
      Get the ApplicationEntity but eagerly fetch all relational information needed to construct a DTO.
      Parameters:
      id - The unique identifier of the application to get
      Returns:
      An ApplicationEntity with dto data loaded or Optional.empty() if no application with the given id exists
    • getApplicationAndCommands

      @Query("SELECT a FROM ApplicationEntity a WHERE a.uniqueId = :id") @EntityGraph(value="Application.commands", type=LOAD) Optional<ApplicationEntity> getApplicationAndCommands(@Param("id") String id)
      Get the ApplicationEntity but eagerly fetch all command base information as well.
      Parameters:
      id - The unique identifier of the application to get
      Returns:
      An ApplicationEntity with command data loaded or Optional.empty() if no application with the given id exists
    • getApplicationAndCommandsDto

      @Query("SELECT a FROM ApplicationEntity a WHERE a.uniqueId = :id") @EntityGraph(value="Application.commands.dto", type=LOAD) Optional<ApplicationEntity> getApplicationAndCommandsDto(@Param("id") String id)
      Get the ApplicationEntity but eagerly fetch all command DTO information as well.
      Parameters:
      id - The unique identifier of the application to get
      Returns:
      An ApplicationEntity with command data loaded or Optional.empty() if no application with the given id exists