Package org.keycloak.models.workflow
Interface WorkflowStateProvider
- All Superinterfaces:
Provider
- All Known Implementing Classes:
JpaWorkflowStateProvider
Defines a provider interface for managing workflow execution state and scheduled steps.
Implementations of this interface are responsible for persisting and retrieving workflow
state information, including scheduled steps that need to be executed at specific times.
This provider acts as the state management layer for workflow executions within a realm.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordRepresents a scheduled workflow step with its associated metadata.static enum -
Method Summary
Modifier and TypeMethodDescriptiongetDueScheduledSteps(Workflow workflow) Retrieves all scheduled steps that are due for execution for the given workflow.getScheduledStep(String workflowId, String resourceId) Retrieves the scheduled step for a specific workflow and resource combination.getScheduledStepsByResource(String resourceId) Retrieves all scheduled steps associated with the specified resource.getScheduledStepsByStep(String workflowId, String stepId) Retrieves all scheduled steps for a specific step within a workflow.getScheduledStepsByWorkflow(String workflowId) Retrieves all scheduled steps associated with the specified workflow.booleanhasScheduledSteps(String workflowId) Checks whether there are any scheduled steps for the given workflow.voidRemoves the state record identified by the specified execution ID.voidDeletes all workflow state records associated with the current realm.voidremoveByResource(String resourceId) Deletes all state records associated with the given resource ID.voidremoveByWorkflow(String workflowId) Removes all state records associated with the specified workflow.voidremoveByWorkflowAndResource(String workflowId, String resourceId) Deletes the state record associated with a specific workflow and resource combination.scheduleStep(Workflow workflow, WorkflowStep step, String resourceId, String executionId) Schedules a workflow step for future execution.
-
Method Details
-
removeByResource
Deletes all state records associated with the given resource ID. This method removes all workflow state information for the specified resource, regardless of which workflows the resource is associated with.- Parameters:
resourceId- the ID of the resource whose state records should be deleted
-
removeByWorkflowAndResource
Deletes the state record associated with a specific workflow and resource combination. This method removes only the state information for the specified resource within the context of the specified workflow, leaving state records for other workflows intact.- Parameters:
workflowId- the ID of the workflowresourceId- the ID of the resource
-
removeByWorkflow
Removes all state records associated with the specified workflow. This method deletes all state information for the given workflow across all resources.- Parameters:
workflowId- the ID of the workflow whose state records should be deleted
-
remove
Removes the state record identified by the specified execution ID. This method deletes a specific workflow execution state record.- Parameters:
executionId- the ID of the execution whose state record should be deleted
-
removeAll
void removeAll()Deletes all workflow state records associated with the current realm. This method removes all workflow state information for the realm bound to the current session. -
hasScheduledSteps
Checks whether there are any scheduled steps for the given workflow.- Parameters:
workflowId- the ID of the workflow to check- Returns:
trueif there are scheduled steps for this workflow,falseotherwise
-
scheduleStep
WorkflowStateProvider.ScheduleResult scheduleStep(Workflow workflow, WorkflowStep step, String resourceId, String executionId) Schedules a workflow step for future execution. This method persists the scheduling information for a step that should be executed at a later time, typically based on the step's configuration (e.g., delay settings).- Parameters:
workflow- the workflow containing the stepstep- the workflow step to scheduleresourceId- the ID of the resource associated with this scheduled stepexecutionId- the ID of the workflow execution- Returns:
CREATEDif the execution was created (when the workflow first activates for a resource), {@code UPDATED) if it was just updated.
-
getScheduledStep
Retrieves the scheduled step for a specific workflow and resource combination.- Parameters:
workflowId- the ID of the workflowresourceId- the ID of the resource- Returns:
- the scheduled step, or
nullif no step is scheduled for this combination
-
getScheduledStepsByResource
Retrieves all scheduled steps associated with the specified resource.- Parameters:
resourceId- the ID of the resource- Returns:
- a stream of scheduled steps for the given resource
-
getScheduledStepsByWorkflow
Retrieves all scheduled steps associated with the specified workflow.- Parameters:
workflowId- the ID of the workflow- Returns:
- a stream of scheduled steps for the given workflow
-
getScheduledStepsByStep
Stream<WorkflowStateProvider.ScheduledStep> getScheduledStepsByStep(String workflowId, String stepId) Retrieves all scheduled steps for a specific step within a workflow.- Parameters:
workflowId- the ID of the workflowstepId- the ID of the step- Returns:
- a stream of scheduled steps matching the workflow and step IDs
-
getDueScheduledSteps
Retrieves all scheduled steps that are due for execution for the given workflow. This method returns steps whose scheduled execution time has been reached or passed.- Parameters:
workflow- the workflow to check for due steps- Returns:
- a stream of scheduled steps that are due for execution
-