Package com.atlassian.bamboo.plan
Class AbstractChain
java.lang.Object
com.atlassian.core.bean.EntityObject
- All Implemented Interfaces:
Chain
,BambooIdProvider
,BambooObject
,BambooObjectWithOid
,EntityWithOid
,ImmutableEntityWithOid
,Deletable
,Describable
,ImmutableChain
,ImmutableDeletable
,ImmutablePlan
,Plan
,PlanIdentifier
,PlanKeyProvider
,Triggerable
,DescriptionProvider
,NameProvider
,Versionable
,Cloneable
,Comparable<Plan>
- Direct Known Subclasses:
ChainBranchImpl
,DefaultChain
-
Field Summary
Fields inherited from class com.atlassian.bamboo.plan.AbstractPlan
internalResultsSummaryAccessor
Fields inherited from interface com.atlassian.bamboo.plan.cache.ImmutablePlan
MAX_PREVIOUS_BUILD_FOR_AVE, STATUS_CURRENTLY_BUILDING, STATUS_FAIL, STATUS_NO_BUILDS, STATUS_NOT_RUN, STATUS_SUCCESS
Fields inherited from interface com.atlassian.bamboo.plan.PlanIdentifier
NAME_DELIMITER
Fields inherited from interface com.atlassian.bamboo.plan.PlanKeyProvider
getPlanKey
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddNewStage
(@NotNull String name, @NotNull String description, boolean manual) Adds a new stage and returns the stagevoid
addStage
(int index, @NotNull ChainStage chainStage) Add stage at given index.void
addStage
(@NotNull ChainStage chainStage) boolean
containsStage
(@Nullable String stageName) Checks whether or not a stage exists in this chain by stage name.Note: Does not include Jobs that are marked for deletion.@NotNull List<ChainStage>
Get Stages of the Chainlong
Returns an average duration of the recent builds@NotNull String
int
Note: Does not include Jobs that are marked for deletion.Get the latest result key including active (not finished) resultsReturn the master plan if one exists.Get notifications defined for this plan.final NotificationSet
Raw access to notification set field used in import/export, upgrade tasks and Hibernate.@NotNull List<PlanRepositoryDefinition>
Return list of repositories available to the chain.@NotNull List<ChainStage>
Get Stages of the chain.@NotNull List<TriggerDefinition>
@Nullable VcsBambooSpecsSource
boolean
isActive()
Needed for Dependency Blocking for Chains.boolean
Is the build currently being executed?boolean
void
removeStage
(long chainStageId) void
removeStagesIf
(@NotNull Predicate<ChainStage> predicate) Remove all stages matching a predicate.void
setAllStages
(@NotNull List<ChainStage> allStages) void
setBambooSpecsManager
(BambooSpecsManager bambooSpecsManager) void
setChainExecutionManager
(ChainExecutionManager chainExecutionManager) void
setNotificationSet
(NotificationSet notificationSet) void
setRepositoryDefinitionManager
(RepositoryDefinitionManager repositoryDefinitionManager) void
setStorageTag
(ChainStorageTag storageTag) void
setVcsBambooSpecsSource
(@NotNull VcsBambooSpecsSource newValue) Internal use only.Methods inherited from class com.atlassian.bamboo.plan.AbstractPlan
compareTo, equals, getBuildDefinition, getBuildDefinitionXml, getBuildKey, getBuildLogger, getBuildName, getDatabaseId, getDescription, getDiscriminator, getEffectiveVariables, getFirstBuildNumber, getKey, getLabellings, getLabelNames, getLastBuildNumber, getLatestResultsSummary, getMasterId, getMasterIdIfExists, getName, getPlanKey, getProject, getRelatedLabellings, getType, getVariables, getVersion, hashCode, hasMaster, isBusy, isMarkedForDeletion, isSuspendedFromBuilding, setBuildDefinitionManager, setBuildDefinitionXml, setBuildKey, setBuildLoggerManager, setBuildName, setDescription, setDiscriminator, setInternalResultsSummaryAccessor, setKey, setLabellings, setLabelManager, setMarkedForDeletion, setName, setPlanExecutionManager, setPlanKey, setProject, setSuspendedFromBuilding, setVariableDefinitionManager, setVersion
Methods inherited from class com.atlassian.bamboo.hibernate.HibernateBambooEntityWithOid
getId, getOid, setId, setOid
Methods inherited from class com.atlassian.core.bean.EntityObject
clone, getCreationDate, getCurrentDate, getLastModificationDate, setClock, setCreationDate, setLastModificationDate
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.bamboo.core.BambooObject
setId
Methods inherited from interface com.atlassian.bamboo.deletion.Deletable
setMarkedForDeletion
Methods inherited from interface com.atlassian.bamboo.Describable
setDescription, setName
Methods inherited from interface com.atlassian.bamboo.utils.DescriptionProvider
getDescription
Methods inherited from interface com.atlassian.bamboo.core.EntityWithOid
setOid
Methods inherited from interface com.atlassian.bamboo.plan.cache.ImmutableChain
getCreationDate, getEntityType
Methods inherited from interface com.atlassian.bamboo.core.ImmutableEntityWithOid
getOid
Methods inherited from interface com.atlassian.bamboo.plan.cache.ImmutablePlan
getBuildDefinition, getBuildLogger, getEffectiveVariables, getFirstBuildNumber, getKey, getLabelNames, getLastBuildNumber, getProject, getType, getVariables, hasMaster, isBusy, isMarkedForDeletion
Methods inherited from interface com.atlassian.bamboo.plan.Plan
getBuildDefinitionXml, getLabellings, getLatestResultsSummary, getRelatedLabellings, setBuildDefinitionXml, setBuildKey, setBuildName, setKey, setLabellings, setMaster, setPlanKey, setProject, setSuspendedFromBuilding
Methods inherited from interface com.atlassian.bamboo.plan.PlanIdentifier
getBuildKey, getBuildName, getDatabaseId, getId, getMasterId, getMasterIdIfExists, getName, getPlanKey, getPlanType, isSuspendedFromBuilding
Methods inherited from interface com.atlassian.bamboo.versioning.Versionable
getVersion
-
Field Details
-
NUMBER_OF_RESULTS
public static final int NUMBER_OF_RESULTS- See Also:
-
master
-
-
Constructor Details
-
AbstractChain
public AbstractChain()
-
-
Method Details
-
getStorageTag
- Specified by:
getStorageTag
in interfaceImmutableChain
-
setStorageTag
- Specified by:
setStorageTag
in interfaceChain
-
getStages
Description copied from interface:ImmutableChain
Get Stages of the chain.Note that this excludes
ChainStage
s that have been marked for deletion- Specified by:
getStages
in interfaceChain
- Specified by:
getStages
in interfaceImmutableChain
- Returns:
- stages
-
addNewStage
public ChainStage addNewStage(@NotNull @NotNull String name, @NotNull @NotNull String description, boolean manual) Description copied from interface:Chain
Adds a new stage and returns the stage- Specified by:
addNewStage
in interfaceChain
- Returns:
-
addStage
-
addStage
Description copied from interface:Chain
Add stage at given index. -
removeStage
public void removeStage(long chainStageId) - Specified by:
removeStage
in interfaceChain
-
removeStagesIf
Description copied from interface:Chain
Remove all stages matching a predicate.- Specified by:
removeStagesIf
in interfaceChain
-
getJobCount
public int getJobCount()Description copied from interface:ImmutableChain
Note: Does not include Jobs that are marked for deletion.- Specified by:
getJobCount
in interfaceImmutableChain
- Returns:
- how many Jobs are currently contained within this chain
-
getAllJobs
Description copied from interface:Chain
Note: Does not include Jobs that are marked for deletion.- Specified by:
getAllJobs
in interfaceChain
- Specified by:
getAllJobs
in interfaceImmutableChain
- Returns:
- a list of all Jobs that are currently contained within this chain - no order guaranteed.
-
containsStage
Description copied from interface:ImmutableChain
Checks whether or not a stage exists in this chain by stage name.- Specified by:
containsStage
in interfaceImmutableChain
- Parameters:
stageName
- to check for- Returns:
- true if a stage with the given name exists, otherwise false
-
getCurrentStatus
- Specified by:
getCurrentStatus
in interfaceImmutablePlan
- Returns:
- a string key as to what the status is. Can be "success", "failure", "current", "none" or "notRun". Mainly used for UI purposes.
-
isExecuting
public boolean isExecuting()Description copied from interface:ImmutablePlan
Is the build currently being executed?- Specified by:
isExecuting
in interfaceImmutablePlan
- Returns:
- true if chain is currently being executed
-
isActive
public boolean isActive()Needed for Dependency Blocking for Chains.- Specified by:
isActive
in interfaceImmutablePlan
- Returns:
- true if chain is currently being queued or executed
-
getLastResultKey
Description copied from interface:ImmutableChain
Get the latest result key including active (not finished) results- Specified by:
getLastResultKey
in interfaceImmutableChain
- Returns:
- The key of the last build. Returns null if there are no build results for this plan
-
getAverageBuildDuration
public long getAverageBuildDuration()Description copied from interface:ImmutablePlan
Returns an average duration of the recent builds- Specified by:
getAverageBuildDuration
in interfaceImmutablePlan
- Returns:
- The duration in milliseconds
-
getPlanRepositoryDefinitions
Description copied from interface:ImmutableChain
Return list of repositories available to the chain. In case of non-master object it will return list of master's repository definitions with default repository overridden by a private copy of default repository.- Specified by:
getPlanRepositoryDefinitions
in interfaceImmutableChain
- Returns:
- ordered
List
of repositories available to this plan
-
getNotificationSet
Description copied from interface:ImmutableChain
Get notifications defined for this plan.- Specified by:
getNotificationSet
in interfaceImmutableChain
- Returns:
NotificationSet
containing notifications for this plan.
-
setNotificationSet
- Specified by:
setNotificationSet
in interfaceChain
-
getNotificationSetField
Raw access to notification set field used in import/export, upgrade tasks and Hibernate.- Since:
- 4.2
-
getMaster
Description copied from interface:ImmutablePlan
Return the master plan if one exists. The master is the plan which this one is derived from. Configuration is pulled from the master if one exists.- Specified by:
getMaster
in interfaceChain
- Specified by:
getMaster
in interfaceImmutableChain
- Specified by:
getMaster
in interfaceImmutablePlan
- Returns:
- the master
Plan
if one exists.
-
isSuspended
public boolean isSuspended()- Specified by:
isSuspended
in interfaceTriggerable
- Returns:
- true if automatic triggering is switched off for this object
-
getTriggerDefinitions
- Specified by:
getTriggerDefinitions
in interfaceTriggerable
- Returns:
- immutable list of all triggers defined for this object
-
getAllStages
Description copied from interface:Chain
Get Stages of the ChainNote that this includes
ChainStage
s that have been marked for deletion- Specified by:
getAllStages
in interfaceChain
- Specified by:
getAllStages
in interfaceImmutableChain
- Returns:
- unmodifiable list of all stages
-
setAllStages
-
setChainExecutionManager
-
setRepositoryDefinitionManager
-
setBambooSpecsManager
-
setVcsBambooSpecsSource
Internal use only. This method doesn't modify any DB records, but can be used in order to avoid reloading the value by lazy reference. -
getVcsBambooSpecsSource
- Specified by:
getVcsBambooSpecsSource
in interfaceImmutableChain
- Returns:
- specs source used to manage this plan, or null if plan is not managed by RSS
-