public interface JpaCommandRepository extends JpaBaseRepository<CommandEntity>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
FIND_UNUSED_COMMANDS_IN_STATUS_CREATED_BEFORE_QUERY
The query used to find commands that are in a certain status, not used in jobs and created some time ago.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<java.lang.Long> |
findUnusedCommandsByStatusesCreatedBefore(java.util.Set<java.lang.String> statuses,
java.time.Instant commandCreatedThreshold,
int limit)
Find commands from the database where their status is in statuses and they were created
before commandCreatedThreshold and they aren't attached to any jobs still in the database.
|
java.util.Optional<CommandEntity> |
getCommandAndApplications(java.lang.String id)
Find the command with the given id but also eagerly load that commands applications.
|
java.util.Optional<CommandEntity> |
getCommandAndApplicationsDto(java.lang.String id)
Find the command with the given id but also eagerly load that commands applications full dto contents.
|
java.util.Optional<CommandEntity> |
getCommandAndClusterCriteria(java.lang.String id)
Find the command with the given id but also eagerly load that commands cluster criteria.
|
java.util.Optional<CommandEntity> |
getCommandDto(java.lang.String id)
Find the command with the given id but also eagerly load all data needed for a command DTO.
|
int |
setStatusWhereIdIn(java.lang.String desiredStatus,
java.util.Set<java.lang.Long> commandIds)
Bulk set the status of commands which match the given inputs.
|
deleteByIdIn, existsByUniqueId, findByUniqueId, findByUniqueIddeleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getById, getOne, saveAll, saveAllAndFlush, saveAndFlushfindAllcount, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, savestatic final java.lang.String FIND_UNUSED_COMMANDS_IN_STATUS_CREATED_BEFORE_QUERY
@Query(value="UPDATE CommandEntity c SET c.status = :desiredStatus WHERE c.id IN (:commandIds)")
@Modifying
int setStatusWhereIdIn(@Param(value="desiredStatus")
java.lang.String desiredStatus,
@Param(value="commandIds")
java.util.Set<java.lang.Long> commandIds)
desiredStatus - The new status the matching commands should havecommandIds - The ids which should be updated@Query(value="SELECT id FROM commands WHERE status IN (:statuses) AND created < :commandCreatedThreshold AND id NOT IN (SELECT DISTINCT(command_id) FROM jobs WHERE command_id IS NOT NULL) LIMIT :limit",
nativeQuery=true)
java.util.Set<java.lang.Long> findUnusedCommandsByStatusesCreatedBefore(@Param(value="statuses")
java.util.Set<java.lang.String> statuses,
@Param(value="commandCreatedThreshold")
java.time.Instant commandCreatedThreshold,
@Param(value="limit")
int limit)
statuses - The set of statuses a command must be in for it to be considered unusedcommandCreatedThreshold - The instant in time a command must have been created before to be considered
unused. Exclusive.limit - Maximum number of IDs to return@Query(value="SELECT c FROM CommandEntity c WHERE c.uniqueId = :id")
@EntityGraph(value="Command.applications",
type=LOAD)
java.util.Optional<CommandEntity> getCommandAndApplications(@Param(value="id")
java.lang.String id)
id - The id of the command to getCommandEntity with its applications data loaded or Optional.empty() if there is no
command with the given id@Query(value="SELECT c FROM CommandEntity c WHERE c.uniqueId = :id")
@EntityGraph(value="Command.applications.dto",
type=LOAD)
java.util.Optional<CommandEntity> getCommandAndApplicationsDto(@Param(value="id")
java.lang.String id)
id - The id of the command to getCommandEntity with its applications data loaded or Optional.empty() if there is no
command with the given id@Query(value="SELECT c FROM CommandEntity c WHERE c.uniqueId = :id")
@EntityGraph(value="Command.clusterCriteria",
type=LOAD)
java.util.Optional<CommandEntity> getCommandAndClusterCriteria(@Param(value="id")
java.lang.String id)
id - The id of the command to getCommandEntity with its criteria data loaded or Optional.empty() if there is no
command with the given id@Query(value="SELECT c FROM CommandEntity c WHERE c.uniqueId = :id")
@EntityGraph(value="Command.DTO",
type=LOAD)
java.util.Optional<CommandEntity> getCommandDto(@Param(value="id")
java.lang.String id)
id - The id of the command to getCommandEntity all DTO data loaded or Optional.empty() if there is no
command with the given id