Class WorkflowStateUtils

java.lang.Object
io.axoniq.framework.workflow.runtime.util.WorkflowStateUtils

@Internal public final class WorkflowStateUtils extends Object
Utility functions for inspecting WorkflowState.
Since:
5.4.0
Author:
Simon Zambrovski
  • Method Details

    • matchesStep

      public static boolean matchesStep(WorkflowState state, String stepName, Predicate<WorkflowStep> predicate)
      Safely inspects a step in state if it exists.
      Parameters:
      state - workflow state to inspect
      stepName - name of the step
      predicate - condition to test on the step
      Returns:
      true if the step exists and matches the predicate, false otherwise
    • isStepTerminal

      public static boolean isStepTerminal(WorkflowState state, String stepName)
      Checks if a step with the given name exists in the workflow state and has reached a terminal status.
      Parameters:
      state - workflow state to inspect
      stepName - name of the step
      Returns:
      true if the step exists and is terminal, false otherwise
    • isStepActive

      public static boolean isStepActive(WorkflowState state, String stepName)
      Checks if a step with the given name exists in the workflow state and has not reached a terminal status.
      Parameters:
      state - workflow state to inspect
      stepName - name of the step
      Returns:
      true if the step exists and is not terminal, false otherwise
    • isStepStatus

      public static boolean isStepStatus(WorkflowState state, String stepName, StepStatus status)
      Checks if a step with the given name exists in the workflow state and has the specified status.
      Parameters:
      state - workflow state to inspect
      stepName - name of the step
      status - expected step status
      Returns:
      true if the step exists and matches the given status, false otherwise
    • stepTerminal

      public static Predicate<WorkflowState> stepTerminal(String stepName)
      Creates a predicate that matches when a step in the workflow state has reached a terminal status.
      Parameters:
      stepName - name of the step
      Returns:
      predicate testing if the step exists and is terminal
    • stepActive

      public static Predicate<WorkflowState> stepActive(String stepName)
      Creates a predicate that matches when a step in the workflow state exists and is not terminal.
      Parameters:
      stepName - name of the step
      Returns:
      predicate testing if the step exists and is not terminal
    • stepStatus

      public static Predicate<WorkflowState> stepStatus(String stepName, StepStatus status)
      Creates a predicate that matches when a step in the workflow state exists and has the specified status.
      Parameters:
      stepName - name of the step
      status - expected step status
      Returns:
      predicate testing if the step exists and matches the given status