Package com.yworkflow.instance.model
Enum Class WorkflowInstanceStatus
- All Implemented Interfaces:
Serializable,Comparable<WorkflowInstanceStatus>,Constable
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe workflow instance has completed successfully.The workflow instance has been created but not yet started.The workflow instance has been terminated abnormally.The workflow instance is actively processing a transition.The workflow instance is actively running and executing.The workflow instance has been temporarily stopped. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if this status can transition to the specified target status.booleanChecks if this status represents a finished workflow instance.booleanChecks if this status represents a started workflow instance.static WorkflowInstanceStatusReturns the enum constant of this class with the specified name.static WorkflowInstanceStatus[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CREATED
The workflow instance has been created but not yet started. This is the initial status for new workflow instances. -
STARTED
The workflow instance is actively running and executing. This is the normal operational status for workflow instances. -
PROCESSING
The workflow instance is actively processing a transition. -
STOPPED
The workflow instance has been temporarily stopped. It can be restarted from this status. -
KILLED
The workflow instance has been terminated abnormally. This is a final status that cannot be changed. -
COMPLETED
The workflow instance has completed successfully. This is a final status that cannot be changed.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
canTransitionTo
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:
CREATED→STARTED,KILLEDPROCESSING→STARTEDSTARTED→STOPPED,COMPLETED,KILLED,PROCESSINGSTOPPED→STARTED,KILLEDCOMPLETED→ (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
-