Interface ExecutionRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<ExecutionEntity, Long>, org.springframework.data.jpa.repository.JpaRepository<ExecutionEntity, Long>, org.springframework.data.repository.ListCrudRepository<ExecutionEntity, Long>, org.springframework.data.repository.ListPagingAndSortingRepository<ExecutionEntity, Long>, org.springframework.data.repository.PagingAndSortingRepository<ExecutionEntity, Long>, org.springframework.data.repository.query.QueryByExampleExecutor<ExecutionEntity>, org.springframework.data.repository.Repository<ExecutionEntity, Long>

@Repository public interface ExecutionRepository extends org.springframework.data.jpa.repository.JpaRepository<ExecutionEntity, Long>
Repository for Execution entities.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    countByWorkflowIdAndStatus(Long workflowId, ai.nervemind.common.enums.ExecutionStatus status)
    Count executions by status for a workflow.
    long
    Count failed executions for a workflow.
    long
    Count successful executions for a workflow.
    void
    Delete old executions (cleanup).
    findByStatus(ai.nervemind.common.enums.ExecutionStatus status)
    Find all executions by status.
    Find executions within a time range.
    org.springframework.data.domain.Page<ExecutionEntity>
    findByWorkflowId(Long workflowId, org.springframework.data.domain.Pageable pageable)
    Find paginated executions for a workflow.
    Find all executions for a workflow.
    findRecentExecutions(org.springframework.data.domain.Pageable pageable)
    Find recent executions.
    Find running executions.

    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.jpa.repository.JpaRepository

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

    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.repository.PagingAndSortingRepository

    findAll

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

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

    • findByWorkflowIdOrderByStartedAtDesc

      List<ExecutionEntity> findByWorkflowIdOrderByStartedAtDesc(Long workflowId)
      Find all executions for a workflow.
      Parameters:
      workflowId - the workflow ID
      Returns:
      list of execution entities ordered by start time descending
    • findByWorkflowId

      org.springframework.data.domain.Page<ExecutionEntity> findByWorkflowId(Long workflowId, org.springframework.data.domain.Pageable pageable)
      Find paginated executions for a workflow.
      Parameters:
      workflowId - the workflow ID
      pageable - pagination information
      Returns:
      page of execution entities
    • findByStatus

      List<ExecutionEntity> findByStatus(ai.nervemind.common.enums.ExecutionStatus status)
      Find all executions by status.
      Parameters:
      status - the execution status
      Returns:
      list of execution entities with the specified status
    • findRunningExecutions

      @Query("SELECT e FROM ExecutionEntity e WHERE e.status IN ('RUNNING', 'WAITING')") List<ExecutionEntity> findRunningExecutions()
      Find running executions.
      Returns:
      list of execution entities that are currently running or waiting
    • findRecentExecutions

      @Query("SELECT e FROM ExecutionEntity e ORDER BY e.startedAt DESC") List<ExecutionEntity> findRecentExecutions(org.springframework.data.domain.Pageable pageable)
      Find recent executions.
      Parameters:
      pageable - pagination information
      Returns:
      list of recent execution entities ordered by start time descending
    • findByTimeRange

      @Query("SELECT e FROM ExecutionEntity e WHERE e.startedAt BETWEEN :start AND :end ORDER BY e.startedAt DESC") List<ExecutionEntity> findByTimeRange(@Param("start") Instant start, @Param("end") Instant end)
      Find executions within a time range.
      Parameters:
      start - the start time
      end - the end time
      Returns:
      list of execution entities within the time range ordered by start time descending
    • countByWorkflowIdAndStatus

      @Query("SELECT COUNT(e) FROM ExecutionEntity e WHERE e.workflowId = :workflowId AND e.status = :status") long countByWorkflowIdAndStatus(@Param("workflowId") Long workflowId, @Param("status") ai.nervemind.common.enums.ExecutionStatus status)
      Count executions by status for a workflow.
      Parameters:
      workflowId - the workflow ID
      status - the execution status
      Returns:
      count of executions with the specified status for the workflow
    • countSuccessfulByWorkflowId

      @Query("SELECT COUNT(e) FROM ExecutionEntity e WHERE e.workflowId = :workflowId AND e.status = 'SUCCESS'") long countSuccessfulByWorkflowId(@Param("workflowId") Long workflowId)
      Count successful executions for a workflow.
      Parameters:
      workflowId - the workflow ID
      Returns:
      count of successful executions for the workflow
    • countFailedByWorkflowId

      @Query("SELECT COUNT(e) FROM ExecutionEntity e WHERE e.workflowId = :workflowId AND e.status = 'FAILED'") long countFailedByWorkflowId(@Param("workflowId") Long workflowId)
      Count failed executions for a workflow.
      Parameters:
      workflowId - the workflow ID
      Returns:
      count of failed executions for the workflow
    • deleteOlderThan

      @Query("DELETE FROM ExecutionEntity e WHERE e.finishedAt < :cutoff") void deleteOlderThan(@Param("cutoff") Instant cutoff)
      Delete old executions (cleanup).
      Parameters:
      cutoff - the cutoff timestamp