Class WorkflowStateUtils
java.lang.Object
io.axoniq.framework.workflow.runtime.util.WorkflowStateUtils
Utility functions for inspecting
WorkflowState.- Since:
- 5.4.0
- Author:
- Simon Zambrovski
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisStepActive(WorkflowState state, String stepName) Checks if a step with the given name exists in the workflow state and has not reached a terminal status.static booleanisStepStatus(WorkflowState state, String stepName, StepStatus status) Checks if a step with the given name exists in the workflow state and has the specified status.static booleanisStepTerminal(WorkflowState state, String stepName) Checks if a step with the given name exists in the workflow state and has reached a terminal status.static booleanmatchesStep(WorkflowState state, String stepName, Predicate<WorkflowStep> predicate) Safely inspects a step in state if it exists.static Predicate<WorkflowState> stepActive(String stepName) Creates a predicate that matches when a step in the workflow state exists and is not terminal.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.static Predicate<WorkflowState> stepTerminal(String stepName) Creates a predicate that matches when a step in the workflow state has reached a terminal status.
-
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 inspectstepName- name of the steppredicate- condition to test on the step- Returns:
trueif the step exists and matches the predicate,falseotherwise
-
isStepTerminal
Checks if a step with the given name exists in the workflow state and has reached a terminal status.- Parameters:
state- workflow state to inspectstepName- name of the step- Returns:
trueif the step exists and is terminal,falseotherwise
-
isStepActive
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 inspectstepName- name of the step- Returns:
trueif the step exists and is not terminal,falseotherwise
-
isStepStatus
Checks if a step with the given name exists in the workflow state and has the specified status.- Parameters:
state- workflow state to inspectstepName- name of the stepstatus- expected step status- Returns:
trueif the step exists and matches the given status,falseotherwise
-
stepTerminal
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
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
Creates a predicate that matches when a step in the workflow state exists and has the specified status.- Parameters:
stepName- name of the stepstatus- expected step status- Returns:
- predicate testing if the step exists and matches the given status
-