Class TopBuildDependencyGraphImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.dependency.TopBuildDependencyGraphImpl
-
- All Implemented Interfaces:
BuildDependencyGraph
,DependencyGraph<BuildPromotion>
,DependencyGraphEstimate
,TopBuildDependencyGraph
public class TopBuildDependencyGraphImpl extends Object implements TopBuildDependencyGraph
Represents the topmost graph. All operations on this graph are performed under the system access rights and on the whole set of nodes.
-
-
Constructor Summary
Constructors Constructor Description TopBuildDependencyGraphImpl(BuildPromotionEx topPromotion, BuildPromotionChangesCollector changesCollector, SecurityContextEx securityContext, BuildPromotionReplacementLog buildPromotionReplacementLog)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
collectChangesForGraph(CancelableTaskHolder cancelableTaskHolder)
Collects changes for the whole graph.boolean
contains(BuildPromotion promo)
Returns true if node is part of this graph.Collection<SBuildType>
getBuildTypes()
Get all buildTypes in the graphint
getCompletedPercent(boolean includeTopBuild)
Returns string representing progress in percents.long
getDurationOvertime(boolean includeTopBuild)
Returns current overtime for builds graph, or -1 if there is no overtime or estimate is not available.long
getEstimationForTimeLeft(boolean includeTopBuild)
Returns server estimate for all builds in graph to finishCollection<BuildPromotion>
getNodes()
Map<String,BuildPromotion>
getNodesMap()
int
getNumberOfNodes()
Returns number of nodes in this graph.Date
getStartedDate()
Get date of first build in chain started.Status
getStatus()
long
getTimePassed()
Get number of millis passed since start of the chainBuildPromotionEx
getTop()
Returns top node of the graph.boolean
inaccessibleNodesExist()
Returns true if there are inaccessible (by current user permissions) nodes that were not included into this graph.boolean
isChangeCollectingNeeded()
Returns true if changes collecting is not performed for this graphboolean
isEquivalentPartOf(BuildDependencyGraph otherGraph)
Returns true if this graph is equivalent to a part of the specified graphvoid
replaceNode(BuildPromotionEx original, BuildPromotionEx newNode)
Replaces a node in the graph with specified new node.void
traverseBottomUp(ItemProcessor<BuildPromotion> promotionProcessor)
Traverse dependency graph from bottom to topvoid
traverseTopDown(ItemProcessor<BuildPromotion> promotionProcessor)
Traverse dependency graph from top to bottom
-
-
-
Constructor Detail
-
TopBuildDependencyGraphImpl
public TopBuildDependencyGraphImpl(@NotNull BuildPromotionEx topPromotion, @NotNull BuildPromotionChangesCollector changesCollector, @NotNull SecurityContextEx securityContext, @NotNull BuildPromotionReplacementLog buildPromotionReplacementLog)
UseBuildDependencyGraphFactory.createGraph(jetbrains.buildServer.serverSide.BuildPromotionEx)
to create graph.- Parameters:
topPromotion
- top build promotionchangesCollector
- default changes collectorsecurityContext
- security context
-
-
Method Detail
-
isChangeCollectingNeeded
public boolean isChangeCollectingNeeded()
Description copied from interface:TopBuildDependencyGraph
Returns true if changes collecting is not performed for this graph- Specified by:
isChangeCollectingNeeded
in interfaceTopBuildDependencyGraph
- Returns:
- see above
-
collectChangesForGraph
public boolean collectChangesForGraph(@NotNull CancelableTaskHolder cancelableTaskHolder)
Description copied from interface:TopBuildDependencyGraph
Collects changes for the whole graph.- Specified by:
collectChangesForGraph
in interfaceTopBuildDependencyGraph
- Parameters:
cancelableTaskHolder
- task holder (allows to interrupt changes collecting)- Returns:
- true if changes were successfully collected
-
traverseBottomUp
public void traverseBottomUp(@NotNull ItemProcessor<BuildPromotion> promotionProcessor)
Description copied from interface:DependencyGraph
Traverse dependency graph from bottom to top- Specified by:
traverseBottomUp
in interfaceDependencyGraph<BuildPromotion>
- Parameters:
promotionProcessor
- item processor
-
traverseTopDown
public void traverseTopDown(@NotNull ItemProcessor<BuildPromotion> promotionProcessor)
Description copied from interface:DependencyGraph
Traverse dependency graph from top to bottom- Specified by:
traverseTopDown
in interfaceDependencyGraph<BuildPromotion>
- Parameters:
promotionProcessor
- item processor
-
getNumberOfNodes
public int getNumberOfNodes()
Description copied from interface:DependencyGraph
Returns number of nodes in this graph.- Specified by:
getNumberOfNodes
in interfaceDependencyGraph<BuildPromotion>
- Returns:
- number of nodes in this graph.
-
getTop
public BuildPromotionEx getTop()
Description copied from interface:BuildDependencyGraph
Returns top node of the graph.- Specified by:
getTop
in interfaceBuildDependencyGraph
- Specified by:
getTop
in interfaceDependencyGraph<BuildPromotion>
- Returns:
- the graph top node.
-
getStatus
@NotNull public Status getStatus()
- Specified by:
getStatus
in interfaceBuildDependencyGraph
- Returns:
- current status of the top build promotion computed by taking into account all build promotions participating in dependency graph.
If there are no builds associated with graph build promotions, the status is unknown.
If there are failing dependencies, then status of the top promotion is determined by dependency options.
For instance if dependency fails, but dependent build has continuation option:
DependencyOptions.BuildContinuationMode.RUN
then dependent build won't be considered as failing.
-
inaccessibleNodesExist
public boolean inaccessibleNodesExist()
Description copied from interface:BuildDependencyGraph
Returns true if there are inaccessible (by current user permissions) nodes that were not included into this graph.- Specified by:
inaccessibleNodesExist
in interfaceBuildDependencyGraph
- Returns:
- see above
-
contains
public boolean contains(@NotNull BuildPromotion promo)
Description copied from interface:DependencyGraph
Returns true if node is part of this graph.- Specified by:
contains
in interfaceDependencyGraph<BuildPromotion>
- Parameters:
promo
- graph node- Returns:
- see above
-
getNodes
@NotNull public Collection<BuildPromotion> getNodes()
- Specified by:
getNodes
in interfaceDependencyGraph<BuildPromotion>
- Returns:
- all of the graph nodes, including the top node itself
-
getNodesMap
@NotNull public Map<String,BuildPromotion> getNodesMap()
- Specified by:
getNodesMap
in interfaceDependencyGraph<BuildPromotion>
- Returns:
- map of all of the graph nodes, where key is id of build configuration
-
isEquivalentPartOf
public boolean isEquivalentPartOf(@NotNull BuildDependencyGraph otherGraph)
Description copied from interface:TopBuildDependencyGraph
Returns true if this graph is equivalent to a part of the specified graph- Specified by:
isEquivalentPartOf
in interfaceTopBuildDependencyGraph
- Parameters:
otherGraph
- other graph- Returns:
- see above
-
replaceNode
public void replaceNode(@NotNull BuildPromotionEx original, @NotNull BuildPromotionEx newNode)
Description copied from interface:TopBuildDependencyGraph
Replaces a node in the graph with specified new node.- Specified by:
replaceNode
in interfaceTopBuildDependencyGraph
- Parameters:
original
- old nodenewNode
- new node
-
getBuildTypes
@NotNull public Collection<SBuildType> getBuildTypes()
Description copied from interface:TopBuildDependencyGraph
Get all buildTypes in the graph- Specified by:
getBuildTypes
in interfaceTopBuildDependencyGraph
- Returns:
- see above
-
getEstimationForTimeLeft
public long getEstimationForTimeLeft(boolean includeTopBuild)
Description copied from interface:DependencyGraphEstimate
Returns server estimate for all builds in graph to finish- Specified by:
getEstimationForTimeLeft
in interfaceDependencyGraphEstimate
- Parameters:
includeTopBuild
- - if false, do not include build time of the top build- Returns:
- estimation for time left to finish all builds in graph in milliseconds or -1 if estimate is not available.
-
getDurationOvertime
public long getDurationOvertime(boolean includeTopBuild)
Description copied from interface:DependencyGraphEstimate
Returns current overtime for builds graph, or -1 if there is no overtime or estimate is not available.- Specified by:
getDurationOvertime
in interfaceDependencyGraphEstimate
- Parameters:
includeTopBuild
- - if false, do not include overtime of the top build- Returns:
- see above
-
getCompletedPercent
public int getCompletedPercent(boolean includeTopBuild)
Description copied from interface:DependencyGraphEstimate
Returns string representing progress in percents.- Specified by:
getCompletedPercent
in interfaceDependencyGraphEstimate
- Parameters:
includeTopBuild
- - if false, do not include build time of top build- Returns:
- Returns progress in percents
-
getStartedDate
@Nullable public Date getStartedDate()
Description copied from interface:DependencyGraphEstimate
Get date of first build in chain started. Does not include builds, substituded by chain optimizer- Specified by:
getStartedDate
in interfaceDependencyGraphEstimate
- Returns:
- null if chain has not been started yet, otherwise see above
-
getTimePassed
public long getTimePassed()
Description copied from interface:DependencyGraphEstimate
Get number of millis passed since start of the chain- Specified by:
getTimePassed
in interfaceDependencyGraphEstimate
- Returns:
- number of milliseconds since chain start
-
-