Class JpaWorkflowStateProvider

java.lang.Object
org.keycloak.models.workflow.JpaWorkflowStateProvider
All Implemented Interfaces:
WorkflowStateProvider, Provider

public class JpaWorkflowStateProvider extends Object implements WorkflowStateProvider
  • Constructor Details

    • JpaWorkflowStateProvider

      public JpaWorkflowStateProvider(KeycloakSession session)
  • Method Details

    • getScheduledStep

      public WorkflowStateProvider.ScheduledStep getScheduledStep(String workflowId, String resourceId)
      Description copied from interface: WorkflowStateProvider
      Retrieves the scheduled step for a specific workflow and resource combination.
      Specified by:
      getScheduledStep in interface WorkflowStateProvider
      Parameters:
      workflowId - the ID of the workflow
      resourceId - the ID of the resource
      Returns:
      the scheduled step, or null if no step is scheduled for this combination
    • scheduleStep

      public WorkflowStateProvider.ScheduleResult scheduleStep(Workflow workflow, WorkflowStep step, String resourceId, String executionId)
      Description copied from interface: WorkflowStateProvider
      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).
      Specified by:
      scheduleStep in interface WorkflowStateProvider
      Parameters:
      workflow - the workflow containing the step
      step - the workflow step to schedule
      resourceId - the ID of the resource associated with this scheduled step
      executionId - the ID of the workflow execution
      Returns:
      CREATED if the execution was created (when the workflow first activates for a resource), {@code UPDATED) if it was just updated.
    • getDueScheduledSteps

      public Stream<WorkflowStateProvider.ScheduledStep> getDueScheduledSteps(Workflow workflow)
      Description copied from interface: WorkflowStateProvider
      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.
      Specified by:
      getDueScheduledSteps in interface WorkflowStateProvider
      Parameters:
      workflow - the workflow to check for due steps
      Returns:
      a stream of scheduled steps that are due for execution
    • getScheduledStepsByWorkflow

      public Stream<WorkflowStateProvider.ScheduledStep> getScheduledStepsByWorkflow(String workflowId)
      Description copied from interface: WorkflowStateProvider
      Retrieves all scheduled steps associated with the specified workflow.
      Specified by:
      getScheduledStepsByWorkflow in interface WorkflowStateProvider
      Parameters:
      workflowId - the ID of the workflow
      Returns:
      a stream of scheduled steps for the given workflow
    • getScheduledStepsByStep

      public Stream<WorkflowStateProvider.ScheduledStep> getScheduledStepsByStep(String workflowId, String stepId)
      Description copied from interface: WorkflowStateProvider
      Retrieves all scheduled steps for a specific step within a workflow.
      Specified by:
      getScheduledStepsByStep in interface WorkflowStateProvider
      Parameters:
      workflowId - the ID of the workflow
      stepId - the ID of the step
      Returns:
      a stream of scheduled steps matching the workflow and step IDs
    • getScheduledStepsByResource

      public Stream<WorkflowStateProvider.ScheduledStep> getScheduledStepsByResource(String resourceId)
      Description copied from interface: WorkflowStateProvider
      Retrieves all scheduled steps associated with the specified resource.
      Specified by:
      getScheduledStepsByResource in interface WorkflowStateProvider
      Parameters:
      resourceId - the ID of the resource
      Returns:
      a stream of scheduled steps for the given resource
    • removeByResource

      public void removeByResource(String resourceId)
      Description copied from interface: WorkflowStateProvider
      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.
      Specified by:
      removeByResource in interface WorkflowStateProvider
      Parameters:
      resourceId - the ID of the resource whose state records should be deleted
    • removeByWorkflowAndResource

      public void removeByWorkflowAndResource(String workflowId, String resourceId)
      Description copied from interface: WorkflowStateProvider
      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.
      Specified by:
      removeByWorkflowAndResource in interface WorkflowStateProvider
      Parameters:
      workflowId - the ID of the workflow
      resourceId - the ID of the resource
    • removeByWorkflow

      public void removeByWorkflow(String workflowId)
      Description copied from interface: WorkflowStateProvider
      Removes all state records associated with the specified workflow.

      This method deletes all state information for the given workflow across all resources.
      Specified by:
      removeByWorkflow in interface WorkflowStateProvider
      Parameters:
      workflowId - the ID of the workflow whose state records should be deleted
    • remove

      public void remove(String executionId)
      Description copied from interface: WorkflowStateProvider
      Removes the state record identified by the specified execution ID.

      This method deletes a specific workflow execution state record.
      Specified by:
      remove in interface WorkflowStateProvider
      Parameters:
      executionId - the ID of the execution whose state record should be deleted
    • removeAll

      public void removeAll()
      Description copied from interface: WorkflowStateProvider
      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.
      Specified by:
      removeAll in interface WorkflowStateProvider
    • hasScheduledSteps

      public boolean hasScheduledSteps(String workflowId)
      Description copied from interface: WorkflowStateProvider
      Checks whether there are any scheduled steps for the given workflow.
      Specified by:
      hasScheduledSteps in interface WorkflowStateProvider
      Parameters:
      workflowId - the ID of the workflow to check
      Returns:
      true if there are scheduled steps for this workflow, false otherwise
    • close

      public void close()
      Specified by:
      close in interface Provider