Class FlowNode

java.lang.Object
hudson.model.AbstractModelObject
hudson.model.Actionable
org.jenkinsci.plugins.workflow.graph.FlowNode
All Implemented Interfaces:
ModelObject, Saveable, SearchableModelObject, SearchItem, ModelObjectWithContextMenu
Direct Known Subclasses:
AtomNode, BlockEndNode, BlockStartNode

@ExportedBean public abstract class FlowNode extends Actionable implements Saveable
One node in a flow graph.
  • Constructor Details

  • Method Details

    • readResolve

      protected Object readResolve() throws ObjectStreamException
      Throws:
      ObjectStreamException
    • isRunning

      @Deprecated public final boolean isRunning()
      Deprecated.
      Usually isActive() is what you want. If you really wanted the original behavior, use FlowExecution.isCurrentHead(org.jenkinsci.plugins.workflow.graph.FlowNode).
      Transient flag that indicates if this node is currently actively executing something.

      It will be false for a node which still has active children, like a step with a running body. It will also be false for something that has finished but is pending child node creation, such as a completed fork branch which is waiting for the join node to be created.

      This can only go from true to false.

    • isActive

      @Exported(name="running") public final boolean isActive()
      Checks whether a node is still part of the active part of the graph. Unlike isRunning(), this behaves intuitively for a BlockStartNode: it will be considered active until the BlockEndNode is added.
    • getError

      @CheckForNull public final ErrorAction getError()
      If this node has terminated with an error, return an object that indicates that. This is just a convenience method.
    • getExecution

      @NonNull public FlowExecution getExecution()
    • getParents

      @NonNull public List<FlowNode> getParents()
      Returns a read-only view of parents.
    • getEnclosingId

      @CheckForNull public String getEnclosingId()
      Get the id of the enclosing BlockStartNodefor this node, or null if none. Only FlowStartNode and FlowEndNode should generally return null.
    • getEnclosingBlocks

      @NonNull public List<? extends BlockStartNode> getEnclosingBlocks()
      Get the list of enclosing BlockStartNodes, starting from innermost, for this node. May be empty if we are the FlowStartNode or FlowEndNode
    • iterateEnclosingBlocks

      @NonNull public Iterable<BlockStartNode> iterateEnclosingBlocks()
      Return an iterator over all enclosing blocks, from the nearest-enclosing outward ("inside-out" order). Prefer this to getEnclosingBlocks() unless you need ALL nodes, because it can evaluate lazily.
    • getAllEnclosingIds

      @NonNull public List<String> getAllEnclosingIds()
      Returns a read-only view of the IDs for enclosing blocks of this flow node, innermost first. May be empty.
    • getParentIds

      @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @Exported(name="parents") @NonNull public List<String> getParentIds()
    • getId

      @Exported public String getId()
      Has to be unique within a FlowExecution. Needs to remain stable across serialization and JVM restarts.
      See Also:
    • getSearchUrl

      public final String getSearchUrl()
      Reference from the parent SearchItem is through FlowExecution.getNode(String)
      Specified by:
      getSearchUrl in interface SearchItem
    • getDisplayName

      @Exported public String getDisplayName()
      Specified by:
      getDisplayName in interface ModelObject
    • getDisplayFunctionName

      public String getDisplayFunctionName()
    • getIconColor

      @Exported public BallColor getIconColor()
      Returns colored orb that represents the current state of this node.
    • getTypeDisplayName

      protected abstract String getTypeDisplayName()
      Gets a human readable name for this type of the node. This is used to implement getDisplayName() as a fallback in case LabelAction does not exist.
    • getTypeFunctionName

      protected String getTypeFunctionName()
      Gets a human readable text that may include a StepDescriptor.getFunctionName(). It would return "echo" for a flow node linked to an EchoStep or "ws {" for WorkspaceStep. For StepEndNode it would return "} // step.getFunctionName()". Note that this method should be abstract (supposed to be implemented in all subclasses), but keeping it non-abstract to avoid binary incompatibilities.
      Returns:
      the text human-readable representation of the step function name or getDisplayName() by default (if not overriden in subclasses)
    • getUrl

      @Exported public String getUrl() throws IOException
      Returns the URL of this FlowNode, relative to the context root of Jenkins.
      Returns:
      String like "job/foo/32/execution/node/abcde/" with no leading slash but trailing slash.
      Throws:
      IOException
    • setActions

      protected void setActions(List<Action> actions)
      SPI for subtypes to directly manipulate the actions field. When a brand new FlowNode is created, or when FlowNode and actions are stored in close proximity, it is convenient to be able to set the actions so as to eliminate the separate call to FlowActionStorage.loadActions(FlowNode). This method provides such an opportunity for subtypes.
    • getPersistentAction

      @CheckForNull public final <T extends Action> T getPersistentAction(@NonNull Class<T> type)
      Return the first nontransient Action on the FlowNode, without consulting TransientActionFactorys

      This is not restricted to just Actions implementing PersistentAction but usually they should. Used here because it is much faster than base getAction(Class) method.

      Type Parameters:
      T - Action type
      Parameters:
      type - Class of action
      Returns:
      First nontransient action or null if not found.
    • getAction

      @CheckForNull public <T extends Action> T getAction(Class<T> type)
      Overrides:
      getAction in class Actionable
    • getActions

      @Exported @NonNull public List<Action> getActions()
      Overrides:
      getActions in class Actionable
    • save

      public void save() throws IOException
      Explicitly save all the actions in this FlowNode. Useful when an existing Action gets updated.
      Specified by:
      save in interface Saveable
      Throws:
      IOException
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object