Enum Class WorkflowInstanceStatus

java.lang.Object
java.lang.Enum<WorkflowInstanceStatus>
com.yworkflow.instance.model.WorkflowInstanceStatus
All Implemented Interfaces:
Serializable, Comparable<WorkflowInstanceStatus>, Constable

public enum WorkflowInstanceStatus extends Enum<WorkflowInstanceStatus>
Represents the current status of a workflow instance. The status indicates the current state of execution and determines what operations are allowed on the instance.

Status transitions are controlled by the canTransitionTo(WorkflowInstanceStatus) method, which enforces the valid state transitions.

Since:
1.0
  • Enum Constant Details

    • CREATED

      public static final WorkflowInstanceStatus CREATED
      The workflow instance has been created but not yet started. This is the initial status for new workflow instances.
    • STARTED

      public static final WorkflowInstanceStatus STARTED
      The workflow instance is actively running and executing. This is the normal operational status for workflow instances.
    • PROCESSING

      public static final WorkflowInstanceStatus PROCESSING
      The workflow instance is actively processing a transition.
    • STOPPED

      public static final WorkflowInstanceStatus STOPPED
      The workflow instance has been temporarily stopped. It can be restarted from this status.
    • KILLED

      public static final WorkflowInstanceStatus KILLED
      The workflow instance has been terminated abnormally. This is a final status that cannot be changed.
    • COMPLETED

      public static final WorkflowInstanceStatus COMPLETED
      The workflow instance has completed successfully. This is a final status that cannot be changed.
  • Method Details

    • values

      public static WorkflowInstanceStatus[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static WorkflowInstanceStatus valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • canTransitionTo

      public boolean canTransitionTo(WorkflowInstanceStatus to)
      Checks if this status can transition to the specified target status. The method enforces the valid state transitions in the workflow instance lifecycle.

      Valid transitions are:

      • CREATEDSTARTED, KILLED
      • PROCESSING STARTED
      • STARTEDSTOPPED, COMPLETED, KILLED, PROCESSING
      • STOPPEDSTARTED, KILLED
      • COMPLETED → (no transitions allowed)
      • KILLED → (no transitions allowed)
      Parameters:
      to - the target status to transition to
      Returns:
      true if the transition is allowed, false otherwise
    • isFinished

      public boolean isFinished()
      Checks if this status represents a finished workflow instance. A workflow instance is considered finished if it is either completed or killed.
      Returns:
      true if the instance is finished, false otherwise
    • isStarted

      public boolean isStarted()
      Checks if this status represents a started workflow instance. A workflow instance is considered started if it is in the STARTED status.
      Returns:
      true if the instance is started, false otherwise