com.atlassian.bamboo.build
Class DefaultBuild

java.lang.Object
  extended by EntityObject
      extended by com.atlassian.bamboo.core.BambooEntityObject
          extended by com.atlassian.bamboo.build.DefaultBuild
All Implemented Interfaces:
Build, BambooObject, Comparable

public class DefaultBuild
extends BambooEntityObject
implements Build, Comparable


Field Summary
 
Fields inherited from class com.atlassian.bamboo.core.BambooEntityObject
id
 
Fields inherited from interface com.atlassian.bamboo.build.Build
MAX_NUMBER_LOG_ENTRIES, MAX_PREVIOUS_BUILD_FOR_AVE, STATUS_CURRENTLY_BUILDING, STATUS_FAIL, STATUS_NO_BUILDS, STATUS_SUCCESS
 
Constructor Summary
DefaultBuild()
           
 
Method Summary
 String addBuildLogEntry(LogEntry logEntry)
          Add a new build log entry.
 void addBuildResultSummary(BuildResultsSummary buildResultsSummary)
          Add the given build results summary to the build.
 void clearBuildLog()
          Reset the build log, ready for the next build
 int compareTo(Object obj)
           
 boolean equals(Object o)
           
 long getAverageBuildDuration()
          Returns an average duration of the recent builds
 BuildDefinition getBuildDefinition()
          Returns the BuildDefinition that backs this buildd
 BuildDefinitionForBuild getBuildDefinitionXml()
           
 String getBuildKey()
          Thie returns the build portion of the build key
 List getBuildLog()
          Provide the latest build details.
 String getBuildName()
           
 BuildResultsSummaryManager getBuildResultsSummaryManager()
           
 List getBuildResultSummaries()
          Obtains the builds total collection of BuildResultsSummary objects (oldest first), one for each build.
 Set getChildBuilds()
           
 BuildStrategy getCurrentBuildStrategy()
          What is the builds current BuildStrategy?

It uses the value once and then reverts back to the default strategy.

 String getCurrentStatus()
          Retuns a string key as to what the status is.
 int getFirstBuildNumber()
          What the number of the first build we have? It may not be 1 as some may have been removed!
 BuildResultsSummary getFirstBuildSummary()
           
 String getKey()
          Obtain the build's unique key (uppercase alphanumeric).
 List getLabellings()
           
 int getLastBuildNumber()
          What was the number of the lastest build (may be being built)
 Date getLastBuildStartTime()
          When was the last time this build was built?
 BuildResultsSummary getLatestBuildSummary()
          Get the summary from the latest build
 String getName()
          Returns the full name for the build in the form of "projet name - build name" e.g.
 int getNextBuildNumber()
           
 BuildResults getNextBuildResults(int buildNumber)
           
 Set getParentBuilds()
           
 BuildResults getPreviousBuildResults(int buildNumber)
          Gets the first BuildResultsImpl before the passed number
 Project getProject()
          Returns the parent Project
 File getSourceCodeDirectory()
          Returns a file representing the source directory from the Repository
 boolean hasBuildResults()
          Has the build got any build results to display?
 int hashCode()
           
 boolean isInBuildQueue()
          Is the build currenlty being built?
 boolean isMarkedForDeletion()
          Whether or not the build has been marked for deletion
 boolean isMarkedForDependencyBuild()
          Has the build been marked for a build following a dependent build having completed?
 boolean isMarkedForEditBuild()
          Has the build been marked for a build following an edit?
 boolean isMarkedForManualBuild()
          Has the build been marked for a manual build?
 boolean isSuspendedFromBuilding()
          Checks if the build has been
 void markAsNeedingBuilding(ReasonForBuild reasonForBuild)
          Mark the build to force a build next time it's checked.
 void markForDeletion()
          Marks the build to be deleted.
 void removeBuildResultSummary(long buildNumber)
          Remove the given build summary from the build
 int retrieveNextBuildNumber()
           
 void setBuildDefinitionManager(BuildDefinitionManager buildDefinitionManager)
           
 void setBuildDefinitionXml(BuildDefinitionForBuild buildDefinitionXml)
           
 void setBuilderManager(BuilderManager builderManager)
           
 void setBuildExecutionManager(BuildExecutionManager buildExecutionManager)
           
 void setBuildKey(String buildKey)
          Define the build's unique key (uppercase alphanumeric)
 void setBuildManager(BuildManager buildManager)
           
 void setBuildName(String buildName)
           
 void setBuildResultsSummaryManager(BuildResultsSummaryManager buildResultsSummaryManager)
           
 void setChildBuilds(Set childBuilds)
           
 void setFirstBuildNumber(int firstBuildNumber)
           
 void setInBuildQueue(boolean isBuilding)
          Set the is-building flag.
 void setKey(String key)
           
 void setLabellings(List labellings)
           
 void setLastBuildNumber(int lastBuildNumber)
           
 void setLastBuildStartTime(Date lastBuildStartTime)
          Set the time of the last build
 void setMarkedForDeletion(boolean markedForDeletion)
           
 void setName(String name)
           
 void setNextBuildNumber(int nextBuildNumber)
           
 void setParentBuilds(Set parentBuilds)
           
 void setProject(Project project)
           
 void setSuspendedFromBuilding(boolean suspendedFromBuilding)
          Sets the build to suspend temporarily
 void unmarkBuild()
          Clear all the build flags.
 ErrorCollection validateBuild()
          Validates the build's builder and source code locations
 
Methods inherited from class com.atlassian.bamboo.core.BambooEntityObject
getId, setId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.bamboo.core.BambooObject
getId, setId
 

Constructor Detail

DefaultBuild

public DefaultBuild()
Method Detail

getKey

public String getKey()
Description copied from interface: Build
Obtain the build's unique key (uppercase alphanumeric). This includes the project prefix e.g. BAM-MAIN

Specified by:
getKey in interface Build
Returns:
The full key

setKey

public void setKey(String key)
Specified by:
setKey in interface Build

getBuildKey

public String getBuildKey()
Description copied from interface: Build
Thie returns the build portion of the build key

Specified by:
getBuildKey in interface Build
Returns:
String

setBuildKey

public void setBuildKey(String buildKey)
Description copied from interface: Build
Define the build's unique key (uppercase alphanumeric)

Specified by:
setBuildKey in interface Build
Parameters:
buildKey - The value of the key

getName

public String getName()
Description copied from interface: Build
Returns the full name for the build in the form of "projet name - build name" e.g. "Confluence - HEAD"

Specified by:
getName in interface Build
Returns:
String @NotNull

setName

public void setName(String name)

getBuildName

public String getBuildName()
Specified by:
getBuildName in interface Build

setBuildName

public void setBuildName(String buildName)
Specified by:
setBuildName in interface Build

validateBuild

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

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

getCurrentStatus

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

Specified by:
getCurrentStatus in interface Build
Returns:

getCurrentBuildStrategy

public BuildStrategy getCurrentBuildStrategy()
Description copied from interface: Build
What is the builds current BuildStrategy?

It uses the value once and then reverts back to the default strategy. This lets you override the strategy once and the system will revert to the default behaviour.

Specified by:
getCurrentBuildStrategy in interface Build
Returns:
The currect build strategy

getAverageBuildDuration

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

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

getSourceCodeDirectory

public File getSourceCodeDirectory()
Description copied from interface: Build
Returns a file representing the source directory from the Repository

Specified by:
getSourceCodeDirectory in interface Build
Returns:
file`representing the source directory. null iff an exception has been thrown

isInBuildQueue

public boolean isInBuildQueue()
Is the build currenlty being built?

Specified by:
isInBuildQueue in interface Build
Returns:
true iff is currently in the build pipleline

setInBuildQueue

public void setInBuildQueue(boolean isBuilding)
Description copied from interface: Build
Set the is-building flag.

Specified by:
setInBuildQueue in interface Build
Parameters:
isBuilding - Is the build currently in the build pipeline?

isMarkedForManualBuild

public boolean isMarkedForManualBuild()
Description copied from interface: Build
Has the build been marked for a manual build?

Specified by:
isMarkedForManualBuild in interface Build
Returns:
true iff it is has been marked for a manual build

isMarkedForEditBuild

public boolean isMarkedForEditBuild()
Description copied from interface: Build
Has the build been marked for a build following an edit?

Specified by:
isMarkedForEditBuild in interface Build
Returns:
true iff it is has been marked for an edit build

isMarkedForDependencyBuild

public boolean isMarkedForDependencyBuild()
Description copied from interface: Build
Has the build been marked for a build following a dependent build having completed?

Specified by:
isMarkedForDependencyBuild in interface Build
Returns:

markAsNeedingBuilding

public void markAsNeedingBuilding(ReasonForBuild reasonForBuild)
Description copied from interface: Build
Mark the build to force a build next time it's checked.

Specified by:
markAsNeedingBuilding in interface Build
Parameters:
reasonForBuild - The reason we want to build the build

unmarkBuild

public void unmarkBuild()
Description copied from interface: Build
Clear all the build flags.

Specified by:
unmarkBuild in interface Build

markForDeletion

public void markForDeletion()
Description copied from interface: Build
Marks the build to be deleted.

Specified by:
markForDeletion in interface Build

isMarkedForDeletion

public boolean isMarkedForDeletion()
Description copied from interface: Build
Whether or not the build has been marked for deletion

Specified by:
isMarkedForDeletion in interface Build
Returns:

setMarkedForDeletion

public void setMarkedForDeletion(boolean markedForDeletion)

setSuspendedFromBuilding

public void setSuspendedFromBuilding(boolean suspendedFromBuilding)
Description copied from interface: Build
Sets the build to suspend temporarily

Specified by:
setSuspendedFromBuilding in interface Build

isSuspendedFromBuilding

public boolean isSuspendedFromBuilding()
Description copied from interface: Build
Checks if the build has been

Specified by:
isSuspendedFromBuilding in interface Build
Returns:

getBuildLog

public List getBuildLog()
Description copied from interface: Build
Provide the latest build details. This is not persisted.

Specified by:
getBuildLog in interface Build
Returns:
The collection of SimpleLogEntrys. Never returns null.

addBuildLogEntry

public String addBuildLogEntry(LogEntry logEntry)
Description copied from interface: Build
Add a new build log entry. This will get appended to the end of the log.

Specified by:
addBuildLogEntry in interface Build
Parameters:
logEntry - The data being logged
Returns:
The line of text being logged. From LogEntry.getUnstyledLog().

clearBuildLog

public void clearBuildLog()
Description copied from interface: Build
Reset the build log, ready for the next build

Specified by:
clearBuildLog in interface Build

getBuildResultSummaries

public List getBuildResultSummaries()
Description copied from interface: Build
Obtains the builds total collection of BuildResultsSummary objects (oldest first), one for each build.

Specified by:
getBuildResultSummaries in interface Build
Returns:
The collection of build summary objects

getLatestBuildSummary

public BuildResultsSummary getLatestBuildSummary()
Description copied from interface: Build
Get the summary from the latest build

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

getLastBuildNumber

public int getLastBuildNumber()
Description copied from interface: Build
What was the number of the lastest build (may be being built)

Specified by:
getLastBuildNumber in interface Build
Returns:
the build number, zero if the build has not been built

getFirstBuildNumber

public int getFirstBuildNumber()
Description copied from interface: Build
What the number of the first build we have? It may not be 1 as some may have been removed!

Specified by:
getFirstBuildNumber in interface Build
Returns:
The number of the first build

setLastBuildNumber

public void setLastBuildNumber(int lastBuildNumber)
Specified by:
setLastBuildNumber in interface Build

setFirstBuildNumber

public void setFirstBuildNumber(int firstBuildNumber)
Specified by:
setFirstBuildNumber in interface Build

getFirstBuildSummary

public BuildResultsSummary getFirstBuildSummary()
Specified by:
getFirstBuildSummary in interface Build

getLastBuildStartTime

public Date getLastBuildStartTime()
Description copied from interface: Build
When was the last time this build was built?

Specified by:
getLastBuildStartTime in interface Build
Returns:
The date, null if it has not been build.

setLastBuildStartTime

public void setLastBuildStartTime(Date lastBuildStartTime)
Description copied from interface: Build
Set the time of the last build

Specified by:
setLastBuildStartTime in interface Build
Parameters:
lastBuildStartTime - the time

hasBuildResults

public boolean hasBuildResults()
Description copied from interface: Build
Has the build got any build results to display?

Specified by:
hasBuildResults in interface Build
Returns:
true if the build has been built, false otherwise

addBuildResultSummary

public void addBuildResultSummary(BuildResultsSummary buildResultsSummary)
Description copied from interface: Build
Add the given build results summary to the build.

Specified by:
addBuildResultSummary in interface Build
Parameters:
buildResultsSummary - The build summary

removeBuildResultSummary

public void removeBuildResultSummary(long buildNumber)
Description copied from interface: Build
Remove the given build summary from the build

Specified by:
removeBuildResultSummary in interface Build
Parameters:
buildNumber - the number of the build to delete

getPreviousBuildResults

public BuildResults getPreviousBuildResults(int buildNumber)
Description copied from interface: Build
Gets the first BuildResultsImpl before the passed number

Specified by:
getPreviousBuildResults in interface Build
Returns:
BuildResultsImpl. null if no build results can be found before that number

getNextBuildResults

public BuildResults getNextBuildResults(int buildNumber)
Specified by:
getNextBuildResults in interface Build

getParentBuilds

public Set getParentBuilds()
Specified by:
getParentBuilds in interface Build

setParentBuilds

public void setParentBuilds(Set parentBuilds)
Specified by:
setParentBuilds in interface Build

getChildBuilds

public Set getChildBuilds()
Specified by:
getChildBuilds in interface Build

setChildBuilds

public void setChildBuilds(Set childBuilds)
Specified by:
setChildBuilds in interface Build

setProject

public void setProject(Project project)
Specified by:
setProject in interface Build

retrieveNextBuildNumber

public int retrieveNextBuildNumber()
Specified by:
retrieveNextBuildNumber in interface Build

getNextBuildNumber

public int getNextBuildNumber()
Specified by:
getNextBuildNumber in interface Build

setNextBuildNumber

public void setNextBuildNumber(int nextBuildNumber)
Specified by:
setNextBuildNumber in interface Build

getBuildDefinition

public BuildDefinition getBuildDefinition()
Description copied from interface: Build
Returns the BuildDefinition that backs this buildd

Specified by:
getBuildDefinition in interface Build
Returns:
BuildDefinition object. Never null.

getProject

public Project getProject()
Description copied from interface: Build
Returns the parent Project

Specified by:
getProject in interface Build
Returns:
Project. Never null

getBuildResultsSummaryManager

public BuildResultsSummaryManager getBuildResultsSummaryManager()

setBuildResultsSummaryManager

public void setBuildResultsSummaryManager(BuildResultsSummaryManager buildResultsSummaryManager)

setBuildManager

public void setBuildManager(BuildManager buildManager)

setBuildExecutionManager

public void setBuildExecutionManager(BuildExecutionManager buildExecutionManager)

getBuildDefinitionXml

public BuildDefinitionForBuild getBuildDefinitionXml()
Specified by:
getBuildDefinitionXml in interface Build

setBuildDefinitionXml

public void setBuildDefinitionXml(BuildDefinitionForBuild buildDefinitionXml)
Specified by:
setBuildDefinitionXml in interface Build

getLabellings

public List getLabellings()
Specified by:
getLabellings in interface Build

setLabellings

public void setLabellings(List labellings)
Specified by:
setLabellings in interface Build

setBuildDefinitionManager

public void setBuildDefinitionManager(BuildDefinitionManager buildDefinitionManager)

setBuilderManager

public void setBuilderManager(BuilderManager builderManager)

hashCode

public int hashCode()

equals

public boolean equals(Object o)

compareTo

public int compareTo(Object obj)
Specified by:
compareTo in interface Comparable


Copyright © 2006 Atlassian Software Systems. All Rights Reserved.