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.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)
           
 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.
 ResultsSummary getLatestResultsSummary()
          Get the summary from the latest completed plan
 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 currenlty being executed?
 void removeStage(ChainStage chainStage)
           
 void setAllStages(java.util.List<ChainStage> allStages)
           
 void setChainExecutionManager(ChainExecutionManager chainExecutionManager)
           
 void setResultsSummaryManager(ResultsSummaryManager resultsSummaryManager)
           
 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, getLastBuildNumber, getLastVcsRevisionKey, getName, getNextBuildNumber, getNotificationSet, getPlanKey, getProject, getRelatedLabellings, getSourceCodeDirectory, getTestClasses, hashCode, isBusy, isMarkedForDeletion, isSuspendedFromBuilding, setBuildDefinitionManager, setBuildDefinitionXml, setBuildKey, setBuildLoggerManager, setBuildName, setDescription, setDiscriminator, setFirstBuildNumber, setKey, setLabellings, setLastBuildNumber, setLastVcsRevisionKey, setMarkedForDeletion, setName, setNextBuildNumber, setNotificationSet, setPlanExecutionManager, setProject, setSuspendedFromBuilding, 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, getLastBuildNumber, getLastVcsRevisionKey, getName, getNextBuildNumber, getPlanKey, getProject, getRelatedLabellings, getSourceCodeDirectory, isBusy, isSuspendedFromBuilding, setBuildDefinitionXml, setBuildKey, setBuildName, setFirstBuildNumber, setKey, setLabellings, setLastBuildNumber, setLastVcsRevisionKey, setNextBuildNumber, 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)
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

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 currenlty being executed?

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

getLatestResultsSummary

@Nullable
public ResultsSummary getLatestResultsSummary()
Description copied from interface: Plan
Get the summary from the latest completed plan

Specified by:
getLatestResultsSummary in interface Plan
Returns:
The summary info for the last completed plan. Returns null if there are no build results for this plan

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

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)

setResultsSummaryManager

public void setResultsSummaryManager(ResultsSummaryManager resultsSummaryManager)


Copyright © 2010 Atlassian. All Rights Reserved.