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
@MappedSuperclass public abstract class AbstractChain extends AbstractPlan implements Plan, Chain
-
-
Field Summary
Fields Modifier and Type Field Description protected Chainmasterstatic intNUMBER_OF_RESULTS-
Fields inherited from class com.atlassian.bamboo.plan.AbstractPlan
resultsSummaryManager
-
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
Constructors Constructor Description AbstractChain()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChainStageaddNewStage(@NotNull String name, @NotNull String description, boolean manual)Adds a new stage and returns the stagevoidaddStage(int index, @NotNull ChainStage chainStage)Add stage at given index.voidaddStage(@NotNull ChainStage chainStage)booleancontainsStage(@Nullable String stageName)Checks whether or not a stage exists in this chain by stage name.@NotNull List<Job>getAllJobs()Note: Does not include Jobs that are marked for deletion.@NotNull List<ChainStage>getAllStages()Get Stages of the ChainlonggetAverageBuildDuration()Returns an average duration of the recent builds@NotNull StringgetCurrentStatus()@NotNull List<RepositoryDefinition>getEffectiveRepositoryDefinitions()Return list of repositories available to the chain.intgetJobCount()Note: Does not include Jobs that are marked for deletion.PlanResultKeygetLastResultKey()Get the latest result key including active (not finished) resultsChaingetMaster()Return the master plan if one exists.NotificationSetgetNotificationSet()Get notifications defined for this plan.NotificationSetgetNotificationSetField()Raw access to notification set field used in import/export, upgrade tasks and Hibernate.@NotNull List<PlanRepositoryDefinition>getPlanRepositoryDefinitions()Return list of repositories available to the chain.@NotNull List<ChainStage>getStages()Get Stages of the chain.ChainStorageTaggetStorageTag()@NotNull List<TriggerDefinition>getTriggerDefinitions()@Nullable VcsBambooSpecsSourcegetVcsBambooSpecsSource()booleanisActive()Needed for Dependency Blocking for Chains.booleanisExecuting()Is the build currently being executed?booleanisSuspended()voidremoveStage(long chainStageId)voidremoveStagesIf(@NotNull Predicate<ChainStage> predicate)Remove all stages matching a predicate.voidsetAllStages(@NotNull List<ChainStage> allStages)voidsetBambooSpecsManager(BambooSpecsManager bambooSpecsManager)voidsetChainExecutionManager(ChainExecutionManager chainExecutionManager)voidsetNotificationSet(NotificationSet notificationSet)voidsetRepositoryDefinitionManager(RepositoryDefinitionManager repositoryDefinitionManager)voidsetStorageTag(ChainStorageTag storageTag)voidsetVcsBambooSpecsSource(@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, setKey, setLabellings, setLabelManager, setMarkedForDeletion, setName, setPlanExecutionManager, setPlanKey, setProject, setResultsSummaryManager, 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 Detail
-
NUMBER_OF_RESULTS
public static final int NUMBER_OF_RESULTS
- See Also:
- Constant Field Values
-
master
protected Chain master
-
-
Method Detail
-
getStorageTag
public ChainStorageTag getStorageTag()
- Specified by:
getStorageTagin interfaceImmutableChain
-
setStorageTag
public void setStorageTag(ChainStorageTag storageTag)
- Specified by:
setStorageTagin interfaceChain
-
getStages
@NotNull public @NotNull List<ChainStage> getStages()
Description copied from interface:ImmutableChainGet Stages of the chain.Note that this excludes
ChainStages that have been marked for deletion- Specified by:
getStagesin interfaceChain- Specified by:
getStagesin interfaceImmutableChain- Returns:
- stages
-
addNewStage
public ChainStage addNewStage(@NotNull @NotNull String name, @NotNull @NotNull String description, boolean manual)
Description copied from interface:ChainAdds a new stage and returns the stage- Specified by:
addNewStagein interfaceChain- Returns:
-
addStage
public void addStage(@NotNull @NotNull ChainStage chainStage)
-
addStage
public void addStage(int index, @NotNull @NotNull ChainStage chainStage)Description copied from interface:ChainAdd stage at given index.
-
removeStage
public void removeStage(long chainStageId)
- Specified by:
removeStagein interfaceChain
-
removeStagesIf
public void removeStagesIf(@NotNull @NotNull Predicate<ChainStage> predicate)Description copied from interface:ChainRemove all stages matching a predicate.- Specified by:
removeStagesIfin interfaceChain
-
getJobCount
public int getJobCount()
Description copied from interface:ImmutableChainNote: Does not include Jobs that are marked for deletion.- Specified by:
getJobCountin interfaceImmutableChain- Returns:
- how many Jobs are currently contained within this chain
-
getAllJobs
@NotNull public @NotNull List<Job> getAllJobs()
Description copied from interface:ChainNote: Does not include Jobs that are marked for deletion.- Specified by:
getAllJobsin interfaceChain- Specified by:
getAllJobsin interfaceImmutableChain- Returns:
- a list of all Jobs that are currently contained within this chain - no order guaranteed.
-
containsStage
public boolean containsStage(@Nullable @Nullable String stageName)Description copied from interface:ImmutableChainChecks whether or not a stage exists in this chain by stage name.- Specified by:
containsStagein interfaceImmutableChain- Parameters:
stageName- to check for- Returns:
- true if a stage with the given name exists, otherwise false
-
getCurrentStatus
@NotNull public @NotNull String getCurrentStatus()
- Specified by:
getCurrentStatusin 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:ImmutablePlanIs the build currently being executed?- Specified by:
isExecutingin interfaceImmutablePlan- Returns:
- true if chain is currently being executed
-
isActive
public boolean isActive()
Needed for Dependency Blocking for Chains.- Specified by:
isActivein interfaceImmutablePlan- Returns:
- true if chain is currently being queued or executed
-
getLastResultKey
public PlanResultKey getLastResultKey()
Description copied from interface:ImmutableChainGet the latest result key including active (not finished) results- Specified by:
getLastResultKeyin 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:ImmutablePlanReturns an average duration of the recent builds- Specified by:
getAverageBuildDurationin interfaceImmutablePlan- Returns:
- The duration in milliseconds
-
getEffectiveRepositoryDefinitions
@NotNull public @NotNull List<RepositoryDefinition> getEffectiveRepositoryDefinitions()
Description copied from interface:ImmutableChainReturn 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:
getEffectiveRepositoryDefinitionsin interfaceImmutableChain- Returns:
- ordered
Listof repositories available to this plan
-
getPlanRepositoryDefinitions
@NotNull public @NotNull List<PlanRepositoryDefinition> getPlanRepositoryDefinitions()
Description copied from interface:ImmutableChainReturn 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:
getPlanRepositoryDefinitionsin interfaceImmutableChain- Returns:
- ordered
Listof repositories available to this plan
-
getNotificationSet
public NotificationSet getNotificationSet()
Description copied from interface:ImmutableChainGet notifications defined for this plan.- Specified by:
getNotificationSetin interfaceImmutableChain- Returns:
NotificationSetcontaining notifications for this plan.
-
setNotificationSet
public void setNotificationSet(NotificationSet notificationSet)
- Specified by:
setNotificationSetin interfaceChain
-
getNotificationSetField
public final NotificationSet getNotificationSetField()
Raw access to notification set field used in import/export, upgrade tasks and Hibernate.- Since:
- 4.2
-
getMaster
public Chain getMaster()
Description copied from interface:ImmutablePlanReturn 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:
getMasterin interfaceChain- Specified by:
getMasterin interfaceImmutableChain- Specified by:
getMasterin interfaceImmutablePlan- Returns:
- the master
Planif one exists.
-
isSuspended
public boolean isSuspended()
- Specified by:
isSuspendedin interfaceTriggerable- Returns:
- true if automatic triggering is switched off for this object
-
getTriggerDefinitions
@NotNull public @NotNull List<TriggerDefinition> getTriggerDefinitions()
- Specified by:
getTriggerDefinitionsin interfaceTriggerable- Returns:
- immutable list of all triggers defined for this object
-
getAllStages
@NotNull public @NotNull List<ChainStage> getAllStages()
Description copied from interface:ChainGet Stages of the ChainNote that this includes
ChainStages that have been marked for deletion- Specified by:
getAllStagesin interfaceChain- Specified by:
getAllStagesin interfaceImmutableChain- Returns:
- unmodifiable list of all stages
-
setAllStages
public void setAllStages(@NotNull @NotNull List<ChainStage> allStages)
-
setChainExecutionManager
public void setChainExecutionManager(ChainExecutionManager chainExecutionManager)
-
setRepositoryDefinitionManager
public void setRepositoryDefinitionManager(RepositoryDefinitionManager repositoryDefinitionManager)
-
setBambooSpecsManager
public void setBambooSpecsManager(BambooSpecsManager bambooSpecsManager)
-
setVcsBambooSpecsSource
@Internal public void setVcsBambooSpecsSource(@NotNull @NotNull VcsBambooSpecsSource newValue)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
@Nullable public @Nullable VcsBambooSpecsSource getVcsBambooSpecsSource()
- Specified by:
getVcsBambooSpecsSourcein interfaceImmutableChain- Returns:
- specs source used to manage this plan, or null if plan is not managed by RSS
-
-