Interface WorkflowRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<WorkflowEntity, Long>, org.springframework.data.jpa.repository.JpaRepository<WorkflowEntity, Long>, org.springframework.data.repository.ListCrudRepository<WorkflowEntity, Long>, org.springframework.data.repository.ListPagingAndSortingRepository<WorkflowEntity, Long>, org.springframework.data.repository.PagingAndSortingRepository<WorkflowEntity, Long>, org.springframework.data.repository.query.QueryByExampleExecutor<WorkflowEntity>, org.springframework.data.repository.Repository<WorkflowEntity, Long>
@Repository
public interface WorkflowRepository
extends org.springframework.data.jpa.repository.JpaRepository<WorkflowEntity, Long>
Repository for Workflow entities.
-
Method Summary
Modifier and TypeMethodDescriptionlongCount active workflows.longCount total workflows.Find all active scheduled workflows.Find all active webhook workflows.Find all active workflows.findByName(String name) Find workflow by exact name.Find all workflows by name (case-insensitive).findByTriggerType(ai.nervemind.common.enums.TriggerType triggerType) Find all workflows by trigger type.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByName
Find workflow by exact name.- Parameters:
name- the exact name to search for- Returns:
- an Optional containing the workflow if found
-
findByNameContainingIgnoreCase
Find all workflows by name (case-insensitive).- Parameters:
name- the name to search for (partial match, case-insensitive)- Returns:
- a list of workflows matching the name
-
findByIsActiveTrue
List<WorkflowEntity> findByIsActiveTrue()Find all active workflows.- Returns:
- a list of all active workflows
-
findByTriggerType
Find all workflows by trigger type.- Parameters:
triggerType- the trigger type to filter by- Returns:
- a list of workflows with the specified trigger type
-
findActiveScheduledWorkflows
@Query("SELECT w FROM WorkflowEntity w WHERE w.isActive = true AND w.triggerType = 'SCHEDULE'") List<WorkflowEntity> findActiveScheduledWorkflows()Find all active scheduled workflows.- Returns:
- a list of active workflows with SCHEDULE trigger type
-
findActiveWebhookWorkflows
@Query("SELECT w FROM WorkflowEntity w WHERE w.isActive = true AND w.triggerType = 'WEBHOOK'") List<WorkflowEntity> findActiveWebhookWorkflows()Find all active webhook workflows.- Returns:
- a list of active workflows with WEBHOOK trigger type
-
countWorkflows
@Query("SELECT COUNT(w) FROM WorkflowEntity w") long countWorkflows()Count total workflows.- Returns:
- the total number of workflows
-
countActiveWorkflows
@Query("SELECT COUNT(w) FROM WorkflowEntity w WHERE w.isActive = true") long countActiveWorkflows()Count active workflows.- Returns:
- the number of active workflows
-