com.atlassian.bamboo.plan
Class AbstractChain

java.lang.Object
  extended by com.atlassian.core.bean.EntityObject
      extended by com.atlassian.bamboo.core.BambooEntityObject
          extended by com.atlassian.bamboo.plan.AbstractPlan
              extended by com.atlassian.bamboo.plan.AbstractChain
All Implemented Interfaces:
Chain, BambooIdProvider, BambooObject, Deletable, Describable, ImmutableChain, ImmutableDeletable, ImmutablePlan, Plan, PlanIdentifier, PlanKeyProvider, Triggerable, DescriptionProvider, NameProvider, Cloneable, Comparable<Plan>
Direct Known Subclasses:
ChainBranchImpl, DefaultChain

public abstract class AbstractChain
extends AbstractPlan
implements Chain


Field Summary
protected  Chain master
           
static int NUMBER_OF_RESULTS
           
 
Fields inherited from class com.atlassian.bamboo.plan.AbstractPlan
resultsSummaryManager
 
Fields inherited from class com.atlassian.bamboo.core.BambooEntityObject
id
 
Fields inherited from interface com.atlassian.bamboo.plan.cache.ImmutablePlan
MAX_NUMBER_LOG_ENTRIES, 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
getPlanKeyFunction
 
Fields inherited from interface com.atlassian.bamboo.plan.PlanKeyProvider
getPlanKey
 
Constructor Summary
AbstractChain()
           
 
Method Summary
 ChainStage addNewStage(String name, String description, boolean manual)
          Adds a new stage and returns the stage
 void addStage(ChainStage chainStage)
           
 boolean containsStage(String stageName)
          Checks whether or not a stage exists in this chain by stage name.
 List<Job> getAllJobs()
          Note: Does not include Jobs that are marked for deletion.
 List<ChainStage> getAllStages()
          Get Stages of the Chain

Note that this includes ChainStages that have been marked for deletion

 long getAverageBuildDuration()
          Returns an average duration of the recent builds
 String getCurrentStatus()
          Retuns a string key as to what the status is.
 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) results
 Chain 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.
 List<ChainStage> getStages()
          Get Stages of the chain.
 List<TriggerDefinition> getTriggerDefinitions()
           
 List<BuildStrategy> getTriggers()
          Returns triggers defined for this object as BuildStrategies.
 boolean isActive()
          Needed for Dependency Blocking for Chains.
 boolean isExecuting()
          Is the build currently being executed?
 boolean isSuspended()
           
 void removeStage(long chainStage)
           
 void setAllStages(List<ChainStage> allStages)
           
 void setChainExecutionManager(ChainExecutionManager chainExecutionManager)
           
 void setNotificationSet(NotificationSet notificationSet)
           
 void setRepositoryDefinitionManager(RepositoryDefinitionManager repositoryDefinitionManager)
           
 
Methods inherited from class com.atlassian.bamboo.plan.AbstractPlan
compareTo, equals, getBuildDefinition, getBuildDefinitionXml, getBuildKey, getBuildLogger, getBuildName, getDescription, getDiscriminator, getEffectiveVariables, getFirstBuildNumber, getKey, getLabellings, getLabelNames, getLastBuildNumber, getLatestResultsSummary, getMasterId, getName, getNextBuildNumber, getPlanKey, getProject, getRelatedLabellings, getTestClasses, getType, getVariables, hashCode, hasMaster, isBusy, isMarkedForDeletion, isSuspendedFromBuilding, setBuildDefinitionManager, setBuildDefinitionXml, setBuildKey, setBuildLoggerManager, setBuildName, setDescription, setDiscriminator, setFirstBuildNumber, setKey, setLabellings, setLabelManager, setLastBuildNumber, setMarkedForDeletion, setName, setNextBuildNumber, setPlanExecutionManager, setPlanKey, setProject, setResultsSummaryManager, setSuspendedFromBuilding, setTaskManager, setTestClasses, setVariableDefinitionManager
 
Methods inherited from class com.atlassian.bamboo.core.BambooEntityObject
getId, setId
 
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.plan.Plan
getBuildDefinitionXml, getLabellings, getLatestResultsSummary, getRelatedLabellings, setBuildDefinitionXml, setBuildKey, setBuildName, setFirstBuildNumber, setKey, setLabellings, setLastBuildNumber, setMaster, setNextBuildNumber, setPlanKey, setProject, setSuspendedFromBuilding
 
Methods inherited from interface com.atlassian.bamboo.Describable
setDescription, setName
 
Methods inherited from interface com.atlassian.bamboo.deletion.Deletable
setMarkedForDeletion
 
Methods inherited from interface com.atlassian.bamboo.core.BambooObject
setId
 
Methods inherited from interface com.atlassian.bamboo.plan.cache.ImmutableDeletable
isMarkedForDeletion
 
Methods inherited from interface com.atlassian.bamboo.plan.cache.ImmutablePlan
getBuildDefinition, getBuildLogger, getEffectiveVariables, getFirstBuildNumber, getKey, getLabelNames, getLastBuildNumber, getNextBuildNumber, getProject, getType, getVariables, hasMaster, isBusy, isMarkedForDeletion
 
Methods inherited from interface com.atlassian.bamboo.plan.PlanIdentifier
getBuildKey, getBuildName, getId, getMasterId, getName, getPlanKey, getPlanType, isSuspendedFromBuilding
 

Field Detail

NUMBER_OF_RESULTS

public static final int NUMBER_OF_RESULTS
See Also:
Constant Field Values

master

protected Chain master
Constructor Detail

AbstractChain

public AbstractChain()
Method Detail

getStages

@NotNull
public List<ChainStage> getStages()
Description copied from interface: ImmutableChain
Get Stages of the chain.

Note that this excludes ChainStages that have been marked for deletion

Specified by:
getStages in interface Chain
Specified by:
getStages in interface ImmutableChain
Returns:
stages

addNewStage

@NotNull
public ChainStage addNewStage(@NotNull
                                      String name,
                                      @NotNull
                                      String description,
                                      boolean manual)
Description copied from interface: Chain
Adds a new stage and returns the stage

Specified by:
addNewStage in interface Chain
Returns:

addStage

public void addStage(@NotNull
                     ChainStage chainStage)
Specified by:
addStage in interface Chain

removeStage

public void removeStage(long chainStage)
Specified by:
removeStage in interface Chain

getJobCount

public int getJobCount()
Description copied from interface: ImmutableChain
Note: Does not include Jobs that are marked for deletion.

Specified by:
getJobCount in interface ImmutableChain
Returns:
how many Jobs are currently contained within this chain

getAllJobs

@NotNull
public List<Job> getAllJobs()
Description copied from interface: Chain
Note: Does not include Jobs that are marked for deletion.

Specified by:
getAllJobs in interface Chain
Specified by:
getAllJobs in interface ImmutableChain
Returns:
a list of all Jobs that are currently contained within this chain - no order guaranteed.

containsStage

public boolean containsStage(@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 interface ImmutableChain
Parameters:
stageName - to check for
Returns:
true if a stage with the given name exists, otherwise false

getCurrentStatus

@NotNull
public String getCurrentStatus()
Description copied from interface: ImmutablePlan
Retuns a string key as to what the status is. Can be "success", "failure", "current", "none" or "notRun". Mainly used for UI purposes.

Specified by:
getCurrentStatus in interface ImmutablePlan
Returns:

isExecuting

public boolean isExecuting()
Description copied from interface: ImmutablePlan
Is the build currently being executed?

Specified by:
isExecuting in interface ImmutablePlan
Returns:
true if chain is currently being executed

isActive

public boolean isActive()
Needed for Dependency Blocking for Chains.

Specified by:
isActive in interface ImmutablePlan
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 interface ImmutableChain
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 interface ImmutablePlan
Returns:
The duration in milliseconds

getEffectiveRepositoryDefinitions

@NotNull
public 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 interface ImmutableChain
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 interface ImmutableChain
Returns:
NotificationSet containing notifications for this plan.

setNotificationSet

public final void setNotificationSet(NotificationSet notificationSet)
Specified by:
setNotificationSet in interface Chain

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 interface Chain
Specified by:
getMaster in interface ImmutableChain
Specified by:
getMaster in interface ImmutablePlan
Returns:
the master Plan if one exists.

isSuspended

public boolean isSuspended()
Specified by:
isSuspended in interface Triggerable
Returns:
true iff automatic triggering is switched off for this object

getTriggerDefinitions

@NotNull
public List<TriggerDefinition> getTriggerDefinitions()
Specified by:
getTriggerDefinitions in interface Triggerable
Returns:
immutable list of all triggers defined for this object

getTriggers

@NotNull
public List<BuildStrategy> getTriggers()
Description copied from interface: Triggerable
Returns triggers defined for this object as BuildStrategies. The result of this function is produced by calling Triggerable.getTriggerDefinitions() and converting its results. Note that this conversion can be lossy, as not all trigger types are convertible to BuildStrategies. Items that cannot be converted are skipped.

Specified by:
getTriggers in interface Triggerable
Returns:
triggers defined for this object.

getAllStages

@NotNull
public List<ChainStage> getAllStages()
Description copied from interface: Chain
Get Stages of the Chain

Note that this includes ChainStages that have been marked for deletion

Specified by:
getAllStages in interface Chain
Specified by:
getAllStages in interface ImmutableChain
Returns:
stages

setAllStages

public void setAllStages(@NotNull
                         List<ChainStage> allStages)

setChainExecutionManager

public void setChainExecutionManager(ChainExecutionManager chainExecutionManager)

setRepositoryDefinitionManager

public void setRepositoryDefinitionManager(RepositoryDefinitionManager repositoryDefinitionManager)


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.