Class WorkflowStateQuery

java.lang.Object
io.axoniq.framework.workflow.query.api.WorkflowStateQuery

public final class WorkflowStateQuery extends Object
Immutable value-based criteria for selecting workflow states.

Start with the by... factory for the first restriction, then add restrictions using the instance methods. Each restriction is combined with the existing restrictions using logical AND. For example:


 WorkflowStateQuery query = WorkflowStateQuery.byWorkflowId(orderId)
                                            .workflowStatus(WorkflowStatus.STARTED)
                                            .stepStatus("reserve-funds", StepStatus.COMPLETED);
 
Use all() only for an unrestricted search. Queries contain data only; they intentionally do not accept predicates or other executable filters. The same query can be supplied to workflow-management finders and workflow-state repositories, which interpret the criteria in their own storage model.
Since:
5.4.0
Author:
Simon Zambrovski
  • Method Details

    • all

      public static WorkflowStateQuery all()
      Creates a query without restrictions.
      Returns:
      an unrestricted workflow state query
    • byWorkflowId

      public static WorkflowStateQuery byWorkflowId(String workflowId)
      Creates a query restricted to a workflow identifier.
      Parameters:
      workflowId - workflow identifier to match
      Returns:
      a query with the workflow identifier restriction
    • byWorkflowDefinitionId

      public static WorkflowStateQuery byWorkflowDefinitionId(VersionedType workflowDefinitionId)
      Creates a query restricted to a workflow definition identity.
      Parameters:
      workflowDefinitionId - workflow definition identity to match
      Returns:
      a query with the workflow definition identity restriction
    • byWorkflowStatus

      public static WorkflowStateQuery byWorkflowStatus(WorkflowStatus workflowStatus)
      Creates a query restricted to a workflow status.
      Parameters:
      workflowStatus - workflow status to match
      Returns:
      a query with the workflow status restriction
    • byStep

      public static WorkflowStateQuery byStep(String stepName)
      Creates a query restricted to workflows containing a step.
      Parameters:
      stepName - step name that must exist
      Returns:
      a query with the step existence restriction
    • byStepStatus

      public static WorkflowStateQuery byStepStatus(String stepName, StepStatus stepStatus)
      Creates a query restricted to a status of a named step.
      Parameters:
      stepName - step name to inspect
      stepStatus - step status to match
      Returns:
      a query with the step status restriction
    • byPayloadValue

      public static WorkflowStateQuery byPayloadValue(String key, @Nullable Object value)
      Creates a query restricted to an exact payload value.
      Parameters:
      key - payload entry name to inspect
      value - payload value to match, which may be null
      Returns:
      a query with the payload value restriction
    • byVersion

      public static WorkflowStateQuery byVersion(String changeId, String version)
      Creates a query restricted to an effective version recorded for a change identifier.
      Parameters:
      changeId - change identifier to inspect
      version - effective version to match
      Returns:
      a query with the effective-version restriction
    • byVersionMigration

      public static WorkflowStateQuery byVersionMigration(String changeId)
      Creates a query restricted to workflows with a recorded version migration.
      Parameters:
      changeId - change identifier that must have a recorded migration
      Returns:
      a query with the version-migration restriction
    • workflowId

      public WorkflowStateQuery workflowId(String workflowId)
      Restricts this query to a workflow identifier.
      Parameters:
      workflowId - workflow identifier to match
      Returns:
      query with the workflow identifier restriction
    • workflowDefinitionId

      public WorkflowStateQuery workflowDefinitionId(VersionedType workflowDefinitionId)
      Restricts this query to a workflow definition identity.
      Parameters:
      workflowDefinitionId - workflow definition identity to match
      Returns:
      query with the workflow definition identity restriction
    • workflowStatus

      public WorkflowStateQuery workflowStatus(WorkflowStatus workflowStatus)
      Restricts this query to a workflow status.
      Parameters:
      workflowStatus - workflow status to match
      Returns:
      query with the workflow status restriction
    • step

      public WorkflowStateQuery step(String stepName)
      Restricts this query to workflows containing a step.
      Parameters:
      stepName - step name that must exist
      Returns:
      query with the step existence restriction
    • stepStatus

      public WorkflowStateQuery stepStatus(String stepName, StepStatus stepStatus)
      Restricts this query to a status of a named step.
      Parameters:
      stepName - step name to inspect
      stepStatus - step status to match
      Returns:
      query with the step status restriction
    • payloadValue

      public WorkflowStateQuery payloadValue(String key, @Nullable Object value)
      Restricts this query to a payload value.
      Parameters:
      key - payload entry name to inspect
      value - payload value to match, which may be null
      Returns:
      query with the payload value restriction
    • version

      public WorkflowStateQuery version(String changeId, String version)
      Restricts this query to an effective version recorded for a change identifier.
      Parameters:
      changeId - change identifier to inspect
      version - effective version to match
      Returns:
      query with the effective version restriction
    • versionMigration

      public WorkflowStateQuery versionMigration(String changeId)
      Restricts this query to a recorded version migration.
      Parameters:
      changeId - change identifier that must have a recorded migration
      Returns:
      query with the version migration restriction
    • criteria

      public List<WorkflowStateQuery.Criterion> criteria()
      Returns the value-based criteria in this query.
      Returns:
      immutable criteria in their declaration order