Class Transition
Each transition defines a state change with associated actions. The states list typically contains two elements: the current state and the next state. The actions can be represented in two ways:
- Legacy format: List of string lists [actorName, actionName, argument]
- New format: List of Action objects with execution mode support
This class is designed to be populated from YAML workflow definitions using deserialization frameworks like SnakeYAML or Jackson.
- Since:
- 2.12.0
- Author:
- devteam@scivicslab.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the list of Action objects for this transition.getLabel()Returns the label.getNote()Returns the note for this transition.Returns the list of states for this transition.voidsetActions(List<Action> actions) Sets the list of actions for this transition.voidSets the label.voidSets the note for this transition.voidSets the list of states for this transition.toYamlString(int maxLines) Returns a YAML-formatted string representation of this transition.
-
Constructor Details
-
Transition
public Transition()
-
-
Method Details
-
getActions
Returns the list of Action objects for this transition.- Returns:
- a list of Action objects
-
getStates
Returns the list of states for this transition.Typically contains two elements: [currentState, nextState]
- Returns:
- a list of state identifiers
-
setActions
Sets the list of actions for this transition.- Parameters:
actions- a list of Action objects
-
setStates
Sets the list of states for this transition.- Parameters:
list- a list of state identifiers
-
getLabel
Returns the label.The label is used as a stable identifier for overlay matching. When applying patches, transitions are matched by this label rather than by states or array index.
- Returns:
- the label, or null if not set
-
setLabel
Sets the label.- Parameters:
label- the label identifier
-
getNote
Returns the note for this transition.The note provides human-readable documentation about what this transition does. It is optional and not used at runtime.
- Returns:
- the note, or null if not set
-
setNote
Sets the note for this transition.- Parameters:
note- the human-readable note
-
toYamlString
Returns a YAML-formatted string representation of this transition.This method reconstructs a YAML-like format from the parsed data, useful for debugging and visualization. The output shows the first N lines of the transition definition.
Example output:
- states: ["0", "1"] actions: - actor: node method: executeCommand arguments: ["ls -la"]- Parameters:
maxLines- maximum number of lines to include (0 for unlimited)- Returns:
- YAML-formatted string representation
-