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 theFlowNode.getId()
rather than theFlowNode
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
Constructors Constructor Description StandardGraphLookupView()
Create a lookup view for an execution
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCache()
List<BlockStartNode>
findAllEnclosingBlockStarts(FlowNode node)
Return all enclosing block start nodes, as withGraphLookupView.findEnclosingBlockStart(FlowNode)
.BlockStartNode
findEnclosingBlockStart(FlowNode node)
Find the immediately enclosingBlockStartNode
around aFlowNode
BlockEndNode
getEndNode(BlockStartNode startNode)
Find the end node corresponding to a start node, and can be used to tell if the block is completed.boolean
isActive(FlowNode node)
Tests if the node is a currently running head, or the start of a block that has not completed executingIterable<BlockStartNode>
iterateEnclosingBlocks(FlowNode node)
Provide anIterable
over all enclosing blocks, which can be used similarly toGraphLookupView.findAllEnclosingBlockStarts(FlowNode)
but does lazy fetches rather than materializing a full result.void
onNewHead(FlowNode newHead)
Update with a new node added to the flowgraph
-
-
-
Method Detail
-
clearCache
public void clearCache()
-
onNewHead
public void onNewHead(@NonNull FlowNode newHead)
Update with a new node added to the flowgraph- Specified by:
onNewHead
in interfaceGraphListener
-
isActive
public boolean isActive(@NonNull FlowNode node)
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
@CheckForNull public BlockEndNode getEndNode(@NonNull BlockStartNode startNode)
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
@CheckForNull public BlockStartNode findEnclosingBlockStart(@NonNull FlowNode node)
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
public Iterable<BlockStartNode> iterateEnclosingBlocks(@NonNull FlowNode node)
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
@NonNull public List<BlockStartNode> findAllEnclosingBlockStarts(@NonNull FlowNode node)
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
-
-