Class StandardGraphLookupView
java.lang.Object
org.jenkinsci.plugins.workflow.graph.StandardGraphLookupView
- All Implemented Interfaces:
ExtensionPoint
,GraphListener
,GraphListener.Synchronous
,GraphLookupView
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public final class StandardGraphLookupView
extends Object
implements GraphLookupView, GraphListener, GraphListener.Synchronous
Provides overall insight into the structure of a flow graph... but with limited visibility so we can change implementation.
Designed to work entirely on the basis of the
FlowNode.getId()
rather than the FlowNode
s themselves.-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
Nested classes/interfaces inherited from interface org.jenkinsci.plugins.workflow.flow.GraphListener
GraphListener.Synchronous
Nested classes/interfaces inherited from interface org.jenkinsci.plugins.workflow.graph.GraphLookupView
GraphLookupView.EnclosingBlocksIterable
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Return all enclosing block start nodes, as withGraphLookupView.findEnclosingBlockStart(FlowNode)
.Find the immediately enclosingBlockStartNode
around aFlowNode
getEndNode
(BlockStartNode startNode) Find the end node corresponding to a start node, and can be used to tell if the block is completed.boolean
Tests if the node is a currently running head, or the start of a block that has not completed executingProvide anIterable
over all enclosing blocks, which can be used similarly toGraphLookupView.findAllEnclosingBlockStarts(FlowNode)
but does lazy fetches rather than materializing a full result.void
Update with a new node added to the flowgraph
-
Constructor Details
-
StandardGraphLookupView
public StandardGraphLookupView()Create a lookup view for an execution
-
-
Method Details
-
clearCache
public void clearCache() -
onNewHead
Update with a new node added to the flowgraph- Specified by:
onNewHead
in interfaceGraphListener
-
isActive
Description copied from interface:GraphLookupView
Tests if the node is a currently running head, or the start of a block that has not completed executing- Specified by:
isActive
in interfaceGraphLookupView
-
getEndNode
Description copied from interface:GraphLookupView
Find the end node corresponding to a start node, and can be used to tell if the block is completed.- Specified by:
getEndNode
in interfaceGraphLookupView
- Returns:
BlockEndNode
matching the given start node, or null if block hasn't completed
-
findEnclosingBlockStart
Description copied from interface:GraphLookupView
Find the immediately enclosingBlockStartNode
around aFlowNode
- Specified by:
findEnclosingBlockStart
in interfaceGraphLookupView
- Parameters:
node
- Node to find block enclosing it - note that it this is a BlockStartNode, you will return the start of the block enclosing this one.- Returns:
- Null if node is a
FlowStartNode
orFlowEndNode
-
iterateEnclosingBlocks
Description copied from interface:GraphLookupView
Provide anIterable
over all enclosing blocks, which can be used similarly toGraphLookupView.findAllEnclosingBlockStarts(FlowNode)
but does lazy fetches rather than materializing a full result. Handy for for-each loops.Usage note:Prefer this to
GraphLookupView.findAllEnclosingBlockStarts(FlowNode)
in most cases since it can evaluate lazily, unless you know you need all enclosing blocks.- Specified by:
iterateEnclosingBlocks
in interfaceGraphLookupView
- Parameters:
node
- Node to find enclosing blocks for- Returns:
- Iterable over enclosing blocks, from the nearest-enclosing outward ("inside-out" order)
-
findAllEnclosingBlockStarts
Description copied from interface:GraphLookupView
Return all enclosing block start nodes, as withGraphLookupView.findEnclosingBlockStart(FlowNode)
.Usage note:Prefer using
GraphLookupView.iterateEnclosingBlocks(FlowNode)
unless you know you need ALL blocks, since that can lazy-load.- Specified by:
findAllEnclosingBlockStarts
in interfaceGraphLookupView
- Parameters:
node
- Node to find enclosing blocks for- Returns:
- All enclosing block starts from the nearest-enclosing outward ("inside-out" order), or EMPTY_LIST if this is a start or end node
-