com.atlassian.bamboo.chains
Class DefaultChain

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.chains.DefaultChain
All Implemented Interfaces:
Chain, BambooObject, Deletable, Describable, Plan, TopLevelPlan, DescriptionProvider, NameProvider, java.lang.Cloneable, java.lang.Comparable<Plan>

public class DefaultChain
extends AbstractPlan
implements Chain


Field Summary
 
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.Plan
MAX_NUMBER_LOG_ENTRIES, MAX_PREVIOUS_BUILD_FOR_AVE, STATUS_CURRENTLY_BUILDING, STATUS_FAIL, STATUS_NO_BUILDS, STATUS_NOT_RUN, STATUS_SUCCESS
 
Constructor Summary
DefaultChain()
           
 
Method Summary
 ChainStage addNewStage(java.lang.String name, java.lang.String description, boolean manual)
           
 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.
 int getJobCount()
          Note: Does not include Jobs that are marked for deletion.
 java.util.Map<java.lang.Long,RepositoryDefinition> getRepositoryDefinitionMap()
           
 java.util.List<RepositoryDefinition> getRepositoryDefinitions()
           
 java.util.List<ChainStage> getStages()
          Get Stages of the chain.
 java.lang.String getType()
           
 boolean hasTests()
          Helper method checking if plan has tests defined
 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 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, getFirstBuildNumber, getKey, getLabellings, getLabelNames, getLastBuildNumber, getLatestResultsSummary, getName, getNextBuildNumber, getNotificationSet, getPlanKey, getProject, getRelatedLabellings, getTestClasses, hashCode, isBusy, isMarkedForDeletion, isSuspendedFromBuilding, setBuildDefinitionManager, setBuildDefinitionXml, setBuildKey, setBuildLoggerManager, setBuildName, setDescription, setDiscriminator, setFirstBuildNumber, setKey, setLabellings, setLastBuildNumber, setMarkedForDeletion, setName, setNextBuildNumber, setNotificationSet, setPlanExecutionManager, setPlanKey, setProject, setResultsSummaryManager, setSuspendedFromBuilding, setTaskManager, setTestClasses
 
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.TopLevelPlan
getNotificationSet, setNotificationSet
 
Methods inherited from interface com.atlassian.bamboo.plan.Plan
getBuildDefinition, getBuildDefinitionXml, getBuildKey, getBuildLogger, getBuildName, getFirstBuildNumber, getKey, getLabellings, getLabelNames, getLastBuildNumber, getLatestResultsSummary, getName, getNextBuildNumber, getPlanKey, getProject, getRelatedLabellings, isBusy, isSuspendedFromBuilding, setBuildDefinitionXml, setBuildKey, setBuildName, setFirstBuildNumber, setKey, setLabellings, setLastBuildNumber, setNextBuildNumber, setPlanKey, setProject, setSuspendedFromBuilding
 
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.deletion.Deletable
isMarkedForDeletion, setMarkedForDeletion
 
Methods inherited from interface com.atlassian.bamboo.core.BambooObject
getId, setId
 

Constructor Detail

DefaultChain

public DefaultChain()
Method Detail

getType

@NotNull
public java.lang.String getType()
Specified by:
getType in interface Plan
Returns:
a string representation of the implementation type. Used for freemarker.

getStages

@NotNull
public java.util.List<ChainStage> getStages()
Description copied from interface: Chain
Get Stages of the chain. Note that this excludes ChainStages that have been marked for deletion

Specified by:
getStages in interface Chain
Returns:
stages

addNewStage

@NotNull
public ChainStage addNewStage(@NotNull
                                      java.lang.String name,
                                      @NotNull
                                      java.lang.String description,
                                      boolean manual)
Specified by:
addNewStage in interface Chain

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

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

public java.lang.String getCurrentStatus()
Description copied from interface: Plan
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 Plan
Returns:

getJobCount

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

Specified by:
getJobCount in interface Chain
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
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: Chain
Checks whether or not a stage exists in this chain by stage name.

Specified by:
containsStage in interface Chain
Parameters:
stageName - to check for
Returns:
true if a stage with the given name exists, otherwise false

isExecuting

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

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

isActive

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

Specified by:
isActive in interface Plan
Returns:
true if chain is currently being queued or executed

getAverageBuildDuration

public long getAverageBuildDuration()
Description copied from interface: Plan
Returns an average duration of the recent builds

Specified by:
getAverageBuildDuration in interface Plan
Returns:
The duration in milliseconds

hasTests

public boolean hasTests()
Description copied from interface: Plan
Helper method checking if plan has tests defined

Specified by:
hasTests in interface Plan
Overrides:
hasTests in class AbstractPlan
Returns:
true iff plan produces test results

getRepositoryDefinitionMap

@NotNull
public java.util.Map<java.lang.Long,RepositoryDefinition> getRepositoryDefinitionMap()
Specified by:
getRepositoryDefinitionMap in interface Chain
Returns:
Map of repositories available to this plan

getRepositoryDefinitions

@NotNull
public java.util.List<RepositoryDefinition> getRepositoryDefinitions()
Specified by:
getRepositoryDefinitions in interface Chain
Returns:
ordered (see $RepositoryDefinitionManager.getRepositoryDefinitionMapForPlan(com.atlassian.bamboo.plan.Plan) for order) List of repositories available to this plan

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
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 © 2011 Atlassian. All Rights Reserved.