Class Vertex

java.lang.Object
com.scivicslab.pojoactor.workflow.Vertex

public class Vertex extends Object
Represents a single vertex in the workflow graph.

Each vertex defines a state transition 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, JSON, or XML workflow definitions using deserialization frameworks like SnakeYAML or Jackson.

Author:
devteam@scivics-lab.com
  • Constructor Details

    • Vertex

      public Vertex()
  • Method Details

    • getActions

      public List<Action> getActions()
      Returns the list of Action objects for this vertex.
      Returns:
      a list of Action objects
    • getStates

      public List<String> getStates()
      Returns the list of states for this vertex.

      Typically contains two elements: [currentState, nextState]

      Returns:
      a list of state identifiers
    • setActions

      public void setActions(List<Action> actions)
      Sets the list of actions for this vertex.
      Parameters:
      actions - a list of Action objects
    • setStates

      public void setStates(List<String> list)
      Sets the list of states for this vertex.
      Parameters:
      list - a list of state identifiers
    • getVertexName

      public String getVertexName()
      Returns the vertex name.

      The vertex name is used as a stable identifier for overlay matching. When applying patches, vertices are matched by this name rather than by states or array index.

      Returns:
      the vertex name, or null if not set
      Since:
      2.9.0
    • setVertexName

      public void setVertexName(String vertexName)
      Sets the vertex name.
      Parameters:
      vertexName - the vertex name identifier
      Since:
      2.9.0
    • toYamlString

      public String toYamlString(int maxLines)
      Returns a YAML-formatted string representation of this vertex.

      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 vertex 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
      Since:
      2.9.0