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 Chain
master
static int
NUMBER_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 ChainStage
addNewStage(@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.@NotNull List<Job>
getAllJobs()
Note: Does not include Jobs that are marked for deletion.@NotNull List<ChainStage>
getAllStages()
Get Stages of the Chainlong
getAverageBuildDuration()
Returns an average duration of the recent builds@NotNull String
getCurrentStatus()
@NotNull List<RepositoryDefinition>
getEffectiveRepositoryDefinitions()
Return list of repositories available to the chain.int
getJobCount()
Note: Does not include Jobs that are marked for deletion.PlanResultKey
getLastResultKey()
Get the latest result key including active (not finished) resultsChain
getMaster()
Return the master plan if one exists.NotificationSet
getNotificationSet()
Get notifications defined for this plan.NotificationSet
getNotificationSetField()
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.ChainStorageTag
getStorageTag()
@NotNull List<TriggerDefinition>
getTriggerDefinitions()
@Nullable VcsBambooSpecsSource
getVcsBambooSpecsSource()
boolean
isActive()
Needed for Dependency Blocking for Chains.boolean
isExecuting()
Is the build currently being executed?boolean
isSuspended()
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, 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:
getStorageTag
in interfaceImmutableChain
-
setStorageTag
public void setStorageTag(ChainStorageTag storageTag)
- Specified by:
setStorageTag
in interfaceChain
-
getStages
@NotNull public @NotNull List<ChainStage> 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
public void addStage(@NotNull @NotNull ChainStage chainStage)
-
addStage
public void addStage(int index, @NotNull @NotNull ChainStage chainStage)
Description copied from interface:Chain
Add stage at given index.
-
removeStage
public void removeStage(long chainStageId)
- Specified by:
removeStage
in interfaceChain
-
removeStagesIf
public void removeStagesIf(@NotNull @NotNull Predicate<ChainStage> predicate)
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
@NotNull public @NotNull List<Job> 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
public boolean containsStage(@Nullable @Nullable String stageName)
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
@NotNull public @NotNull String 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
public PlanResultKey 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
-
getEffectiveRepositoryDefinitions
@NotNull public @NotNull List<RepositoryDefinition> getEffectiveRepositoryDefinitions()
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:
getEffectiveRepositoryDefinitions
in interfaceImmutableChain
- Returns:
- ordered
List
of repositories available to this plan
-
getPlanRepositoryDefinitions
@NotNull public @NotNull List<PlanRepositoryDefinition> 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
public NotificationSet 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
public void setNotificationSet(NotificationSet notificationSet)
- Specified by:
setNotificationSet
in 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: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
@NotNull public @NotNull List<TriggerDefinition> getTriggerDefinitions()
- Specified by:
getTriggerDefinitions
in interfaceTriggerable
- Returns:
- immutable list of all triggers defined for this object
-
getAllStages
@NotNull public @NotNull List<ChainStage> 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
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:
getVcsBambooSpecsSource
in interfaceImmutableChain
- Returns:
- specs source used to manage this plan, or null if plan is not managed by RSS
-
-