Package com.yworkflow.instance.model
Class StateInstance
java.lang.Object
com.yworkflow.instance.model.StateInstance
Represents an instance of a state within a workflow execution. StateInstance tracks the runtime
information for a specific state in a workflow instance, including its status, timing, ownership,
and execution history.
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionStateInstance(StateInstanceId id, WorkflowInstanceId workflowInstanceId, StateId state, TransitionId transitionId, List<String> owners, Instant startedAt, Instant dueAt, Instant completedAt, ResultStatus status, List<StateInstanceId> previousStateIds, WorkflowCaller caller, boolean active) Creates a new StateInstance with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic StateInstanceempty()Creates an empty StateInstance with default empty values.Gets the caller who initiated this state instance.Gets the completion date for this state instance.getDueAt()Gets the due date for this state instance.getId()Gets the unique identifier for this state instance.Gets the list of owners responsible for this state instance.Gets the list of previous state instance IDs.Gets the start date for this state instance.Gets the state ID that this instance represents.Gets the current status of this state instance.Gets the transition ID that led to this state instance.Gets the workflow instance ID that this state instance belongs to.booleanisActive()Checks whether this state instance is currently active.voidsetActive(boolean active) Sets whether this state instance is currently active.voidsetCaller(WorkflowCaller caller) Sets the caller who initiated this state instance.voidsetCompletedAt(Instant completedAt) Sets the completion date for this state instance.voidSets the due date for this state instance.voidSets the list of owners responsible for this state instance.voidsetPreviousStateIds(List<StateInstanceId> previousStateIds) Sets the list of previous state instance IDs.voidsetStartedAt(Instant startedAt) Sets the start date for this state instance.voidsetStateId(StateId stateId) Sets the state ID that this instance represents.voidsetStatus(ResultStatus status) Sets the current status of this state instance.voidsetTransitionId(TransitionId transitionId) Sets the transition ID that led to this state instance.toString()
-
Constructor Details
-
StateInstance
public StateInstance(StateInstanceId id, WorkflowInstanceId workflowInstanceId, StateId state, TransitionId transitionId, List<String> owners, Instant startedAt, Instant dueAt, Instant completedAt, ResultStatus status, List<StateInstanceId> previousStateIds, WorkflowCaller caller, boolean active) Creates a new StateInstance with the specified parameters.- Parameters:
id- the unique identifier for this state instanceworkflowInstanceId- the ID of the workflow instance this state belongs tostate- the state ID this instance representstransitionId- the transition that led to this stateowners- the list of users responsible for this statestartedAt- when this state instance was starteddueAt- when this state instance is duecompletedAt- when this state instance was completed (null if not completed)status- the current status of this state instancepreviousStateIds- the list of previous state instance IDscaller- the caller who initiated this stateactive- whether this state instance is currently active
-
-
Method Details
-
toString
-
getDueAt
Gets the due date for this state instance.- Returns:
- the due date, or null if not set
-
setDueAt
Sets the due date for this state instance.- Parameters:
dueAt- the due date to set
-
getCompletedAt
Gets the completion date for this state instance.- Returns:
- the completion date, or null if not completed
-
setCompletedAt
Sets the completion date for this state instance.- Parameters:
completedAt- the completion date to set
-
getStartedAt
Gets the start date for this state instance.- Returns:
- the start date, or null if not set
-
setStartedAt
Sets the start date for this state instance.- Parameters:
startedAt- the start date to set
-
getCaller
Gets the caller who initiated this state instance.- Returns:
- the caller, or null if not set
-
setCaller
Sets the caller who initiated this state instance.- Parameters:
caller- the caller to set
-
getOwners
Gets the list of owners responsible for this state instance.- Returns:
- the list of owners, or null if not set
-
setOwners
Sets the list of owners responsible for this state instance.- Parameters:
owners- the list of owners to set
-
getStatus
Gets the current status of this state instance.- Returns:
- the status, or null if not set
-
setStatus
Sets the current status of this state instance.- Parameters:
status- the status to set
-
getPreviousStateIds
Gets the list of previous state instance IDs.- Returns:
- the list of previous state instance IDs, or null if not set
-
setPreviousStateIds
Sets the list of previous state instance IDs.- Parameters:
previousStateIds- the list of previous state instance IDs to set
-
getTransitionId
Gets the transition ID that led to this state instance.- Returns:
- the transition ID, or null if not set
-
setTransitionId
Sets the transition ID that led to this state instance.- Parameters:
transitionId- the transition ID to set
-
getStateId
Gets the state ID that this instance represents.- Returns:
- the state ID, or null if not set
-
setStateId
Sets the state ID that this instance represents.- Parameters:
stateId- the state ID to set
-
getId
Gets the unique identifier for this state instance.- Returns:
- the state instance ID
-
getWorkflowInstanceId
Gets the workflow instance ID that this state instance belongs to.- Returns:
- the workflow instance ID
-
setActive
public void setActive(boolean active) Sets whether this state instance is currently active.- Parameters:
active- true if the state instance is active, false otherwise
-
isActive
public boolean isActive()Checks whether this state instance is currently active.- Returns:
- true if the state instance is active, false otherwise
-
empty
Creates an empty StateInstance with default empty values.- Returns:
- a new StateInstance with empty/default values
-