TaskRepo

interface TaskRepo : JpaRepository<TaskEntity, Long> , JpaSpecificationExecutor<TaskEntity>

Functions

Link copied to clipboard
abstract fun count(spec: Specification<TaskEntity?>?): Long
abstract fun count(): Long
abstract fun <S : TaskEntity?> count(example: Example<S?>?): Long
Link copied to clipboard
@Query(value = "select count(*) from TaskEntity t where t.parentTask.id = :taskId")
abstract fun countChildrenTasks(taskId: Long): Int
Link copied to clipboard
@Query(value = "select count(*) from TaskEntity t where t.parentTask.id = :taskId and t.id != :exceptTaskId and t.runningStatus < 40")
abstract fun countNotEndedChildrenTasks(taskId: TaskId, exceptTaskId: TaskId): Int
Link copied to clipboard
@Query(value = " select count(*) from task t join task_type tt on tt.id = t.type_id where t.pipeline_task_id = :pipelineTaskId and tt.category = 10 and t.running_status < 50 ", nativeQuery = true)
abstract fun countUnfinishedNormalPipelineTasks(pipelineTaskId: TaskId): Int
Link copied to clipboard
abstract fun delete(spec: Specification<TaskEntity?>?): Long
abstract fun delete(entity: TaskEntity?)
Link copied to clipboard
abstract fun deleteAll()
abstract fun deleteAll(entities: Iterable<out TaskEntity?>?)
Link copied to clipboard
abstract fun deleteAllById(ids: Iterable<out Long?>?)
Link copied to clipboard
abstract fun deleteAllByIdInBatch(ids: Iterable<Long?>?)
Link copied to clipboard
abstract fun deleteAllInBatch()
abstract fun deleteAllInBatch(entities: Iterable<TaskEntity?>?)
Link copied to clipboard
abstract fun deleteById(id: Long?)
Link copied to clipboard
open fun deleteInBatch(entities: Iterable<TaskEntity?>?)
Link copied to clipboard
abstract fun exists(spec: Specification<TaskEntity?>?): Boolean
abstract fun <S : TaskEntity?> exists(example: Example<S?>?): Boolean
Link copied to clipboard
abstract fun existsById(id: Long?): Boolean
Link copied to clipboard
abstract fun findAll(spec: Specification<TaskEntity?>?): List<TaskEntity?>?
abstract fun findAll(spec: Specification<TaskEntity?>?, pageable: Pageable?): Page<TaskEntity?>?
abstract fun findAll(spec: Specification<TaskEntity?>?, sort: Sort?): List<TaskEntity?>?
abstract fun findAll(): List<TaskEntity?>?
abstract fun findAll(pageable: Pageable?): Page<TaskEntity?>?
abstract fun findAll(sort: Sort?): List<TaskEntity?>?
abstract fun <S : TaskEntity?> findAll(example: Example<S?>?): List<S?>?
abstract fun <S : TaskEntity?> findAll(example: Example<S?>?, pageable: Pageable?): Page<S?>?
abstract fun <S : TaskEntity?> findAll(example: Example<S?>?, sort: Sort?): List<S?>?
Link copied to clipboard
abstract fun findAllById(ids: Iterable<Long?>?): List<TaskEntity?>?
Link copied to clipboard
abstract fun <S : TaskEntity?, R : Any?> findBy(spec: Specification<TaskEntity?>?, queryFunction: Function<FluentQuery.FetchableFluentQuery<S?>?, R?>?): R?
abstract fun <S : TaskEntity?, R : Any?> findBy(example: Example<S?>?, queryFunction: Function<FluentQuery.FetchableFluentQuery<S?>?, R?>?): R?
Link copied to clipboard
@Query(value = "select o from TaskEntity o where o.executor.id = :execId")
abstract fun findByExecutorId(execId: Int): List<TaskEntity>
Link copied to clipboard
@Query(value = "select t from TaskEntity t where t.hid = :hid and t.ownerTenantId = :tenantId")
abstract fun findByHid(tenantId: Int, hid: String): TaskEntity?
Link copied to clipboard
abstract fun findById(id: Long?): Optional<TaskEntity?>?
Link copied to clipboard
@Lock(value = LockModeType.PESSIMISTIC_WRITE)
@Query(value = "select t from TaskEntity t where t.id = :taskId")
abstract fun findByIdForUpdate(taskId: Long): TaskEntity?
Link copied to clipboard
@Query(value = "select t from TaskEntity t where t.type = :type and t.ownerTenantId = :tenantId")
abstract fun findByType(tenantId: Int, type: TaskTypeEntity): List<TaskEntity>
@Query(value = " select t.id from task t join task_type tt on tt.id = t.type_id where t.is_cancelled = true and t.running_status < 50 and t.update_time <= :cancelledBefore and tt.category = 10 order by t.id limit :limit for update of t skip locked ", nativeQuery = true)
abstract fun findCancelledUnfinishedNormalTaskIdsForUpdate(cancelledBefore: Instant, limit: Int): List<TaskId>
Link copied to clipboard
@Query(value = " select t from TaskEntity t where t.pipelineTask.id = :pipelineTaskId and t.runningStatus = 50 ")
abstract fun findFinishedPipelineTasks(pipelineTaskId: TaskId, pageable: Pageable): Page<TaskEntity>
@Query(value = " select t from TaskEntity t where t.pipelineTask.id = :pipelineTaskId and t.runningStatus = 50 and t.type.hid in :taskTypeHids ")
abstract fun findFinishedPipelineTasks(pipelineTaskId: TaskId, taskTypeHids: List<String>, pageable: Pageable): Page<TaskEntity>
Link copied to clipboard
abstract fun findOne(spec: Specification<TaskEntity?>?): Optional<TaskEntity?>?
abstract fun <S : TaskEntity?> findOne(example: Example<S?>?): Optional<S?>?
Link copied to clipboard
@Query(value = " select pipeline.id from task pipeline join task_type pipeline_type on pipeline_type.id = pipeline.type_id where pipeline_type.category = 20 and pipeline.running_status < 50 and pipeline.finishing_state is not null and not exists ( select 1 from task child join task_type child_type on child_type.id = child.type_id where child.pipeline_task_id = pipeline.id and child_type.category = 10 and child.running_status < 50 ) order by pipeline.id for update of pipeline skip locked ", nativeQuery = true)
abstract fun findPipelinesReadyToFinishForUpdate(): List<TaskId>
Link copied to clipboard
@Query(value = " select candidate.id from task_executor_type tet join task_executor_type_to_task_type tcon on tcon.task_executor_type_id = tet.id join task_type tt on tt.id = tcon.task_type_id join lateral ( select t.id from task t where t.type_id = tt.id and t.running_status = 20 and t.is_cancelled = false and ( not tt.ordered or ( t.order_key is not null and not exists ( select 1 from task older where older.type_id = t.type_id and older.order_key = t.order_key and older.running_status = 20 and older.is_cancelled = false and older.id < t.id ) and not exists ( select 1 from task running where running.type_id = t.type_id and running.order_key = t.order_key and running.running_status = 30 ) ) ) order by t.id limit 1 for update of t skip locked ) candidate on true where tet.hid = :executorTypeHid order by candidate.id limit 1 ", nativeQuery = true)
abstract fun findTaskForExecutionForUpdate(executorTypeHid: String): Long?
Link copied to clipboard
abstract fun flush()
Link copied to clipboard
abstract fun getById(id: Long?): TaskEntity?
Link copied to clipboard
@Query(value = "select t from TaskEntity t where t.parentTask.id = :parentTaskId")
abstract fun getChildren(parentTaskId: TaskId): List<TaskEntity>
Link copied to clipboard
abstract fun getOne(id: Long?): TaskEntity?
Link copied to clipboard
abstract fun getReferenceById(id: Long?): TaskEntity?
Link copied to clipboard
@Query(value = "select t from TaskEntity t where t.id = :taskId and t.ownerTenantId = :tenantId")
abstract fun getTask(tenantId: Int, taskId: Long): TaskEntity?
Link copied to clipboard
abstract fun <S : TaskEntity?> save(entity: S?): S?
Link copied to clipboard
abstract fun <S : TaskEntity?> saveAll(entities: Iterable<S?>?): List<S?>?
Link copied to clipboard
abstract fun <S : TaskEntity?> saveAllAndFlush(entities: Iterable<S?>?): List<S?>?
Link copied to clipboard
abstract fun <S : TaskEntity?> saveAndFlush(entity: S?): S?