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, DescriptionProvider, NameProvider, java.lang.Cloneable, java.lang.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
 
Constructor Summary
AbstractChain()
           
 
Method Summary
 ChainStage addNewStage(java.lang.String name, java.lang.String description, boolean manual)
          Adds a new stage and returns the stage
 void addStage(ChainStage chainStage)
           
 boolean containsStage(java.lang.String stageName)
          Checks whether or not a stage exists in this chain by stage name.
 java.util.List<Job> getAllJobs()
          Note: Does not include Jobs that are marked for deletion.
 java.util.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
 java.lang.String getCurrentStatus()
          Retuns a string key as to what the status is.
 java.util.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.
 java.util.List<ChainStage> getStages()
          Get Stages of the chain.
 boolean hasTests()
          Deprecated. since 4.0 without replacement. Typically, you'll want to query ResultSummary for tests, not the plan
 boolean isActive()
          Needed for Dependency Blocking for Chains.
 boolean isExecuting()
          Is the build currently being executed?
 void removeStage(ChainStage chainStage)
           
 void setAllStages(java.util.List<ChainStage> allStages)
           
 void setChainExecutionManager(ChainExecutionManager chainExecutionManager)
           
 void setNotificationSet(NotificationSet notificationSet)
           
 void setRepositoryDefinitionManager(RepositoryDefinitionManager repositoryDefinitionManager)
           
 ErrorCollection validateBuild()
          Validates the build's builder and source code locations
 
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, 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
getLabellings, 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, getBuildDefinitionXml, getBuildLogger, getEffectiveVariables, getFirstBuildNumber, getKey, getLabelNames, getLastBuildNumber, getLatestResultsSummary, getNextBuildNumber, getProject, getType, getVariables, hasMaster, isBusy, isMarkedForDeletion
 
Methods inherited from interface com.atlassian.bamboo.plan.PlanIdentifier
getBuildKey, getBuildName, getId, 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 java.util.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
                                      java.lang.String name,
                                      @NotNull
                                      java.lang.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(@NotNull
                        ChainStage 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 java.util.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
                             java.lang.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

validateBuild

public ErrorCollection validateBuild()
Description copied from interface: Plan
Validates the build's builder and source code locations

Specified by:
validateBuild in interface Plan
Returns:
and ErrorCollection with relevent error messages

getCurrentStatus

@NotNull
public java.lang.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

hasTests

@Deprecated
public boolean hasTests()
Deprecated. since 4.0 without replacement. Typically, you'll want to query ResultSummary for tests, not the plan

Description copied from interface: ImmutablePlan
Do any of TaskDefinition being used in the plan implement TaskTestResultsSupport

Specified by:
hasTests in interface ImmutablePlan
Overrides:
hasTests in class AbstractPlan

getEffectiveRepositoryDefinitions

@NotNull
public java.util.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 overriden 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 void setNotificationSet(NotificationSet notificationSet)
Specified by:
setNotificationSet in interface Chain

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 ImmutablePlan
Returns:
the master Plan if one exists.

getAllStages

@NotNull
public java.util.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
                         java.util.List<ChainStage> allStages)

setChainExecutionManager

public void setChainExecutionManager(ChainExecutionManager chainExecutionManager)

setRepositoryDefinitionManager

public void setRepositoryDefinitionManager(RepositoryDefinitionManager repositoryDefinitionManager)


Copyright © 2012 Atlassian. All Rights Reserved.