com.atlassian.bamboo.build
Interface BuildManager

All Known Implementing Classes:
HibernateBuildManager, MockBuildManager

public interface BuildManager

Manager to handle all build related activities


Method Summary
 void addBuildResults(Build build, BuildResults buildResults)
           
 void createBuild(Build build, BuildConfiguration buildConfiguration, HibernateAcl acl)
          Save a new build object with the passed buildConfiguration
 void deleteBuild(java.lang.String buildKey)
          Removes the build from system
 boolean exists(java.lang.String key)
          Returns true if build exists with the provided key (eg.
 java.util.Set<Build> filterFavouritedBuilds(java.util.Collection<Build> builds, com.atlassian.user.User user)
          Return a set of Builds that are a subset of the given Builds collection that are favourited by the User
 java.util.Collection<Build> getAllBuilds()
          Returns a collection of all Build objects
 java.util.Collection<Build> getAllBuildsForClone()
           
 java.util.Collection<Build> getAllBuildsForEdit()
           
 java.util.Collection<Build> getAllBuildsForRead()
           
 Build getBuildById(long id)
          Returns the build given the id
 Build getBuildByKey(java.lang.String key)
          Returns the build given a key
 Build getBuildByProjectAndName(java.lang.String projectKey, java.lang.String buildName)
           
 BuildResults getBuildResults(Build build, java.lang.Integer buildNumber)
          Return BuildResults for the given Build and buildNumber
 BuildResults getBuildResults(java.lang.String planKey, java.lang.Integer buildNumber)
          Return BuildResults for the given planKey and buildNumber
 java.util.Collection<Build> getBuildsByProjectForRead(Project project)
          This is the manager equivalent of a project.getBuilds.
 java.util.Collection<Build> getBuildsForDeletion()
           
 java.util.Collection<Build> getFavouriteBuildsByProjectForRead(Project project, com.atlassian.user.User user)
          Deprecated.  
 java.util.Collection<Build> getFavouriteBuildsForRead(com.atlassian.user.User user)
           
 int getPlanCount()
          How many plans currently exist
 java.util.Map<Project,java.util.Collection<Build>> getProjectBuilds(boolean includeEmptyProjects)
          Return a map of Build collections which belong to a Project
 boolean isAllowBuilding(java.lang.String planKey)
          Checks if a particular build is allowed to be built.
 boolean isBuildingSuspended()
          Checks whether or not bamboo is currently suspended from building due to license reasons.
 boolean isExistingBuildKey(java.lang.String projectKey, java.lang.String buildKey)
          Returns true if the build key already exists within the given project key
 boolean isExistingBuildName(java.lang.String projectKey, java.lang.String buildName)
          Returns true if the build name already exists within the given project key
 boolean isPlanCreationAllowed()
          Check whether or not a plan can be created or not (based on licensing etc) USE SPARINGLY!
 boolean recheckBuildingSuspended()
          Force the build manager to double check if building should be suspended or not.
 java.util.Collection<Build> retreiveAllBuilds()
           
 java.lang.String revertVcsRevisionKey(java.lang.String buildKey, java.lang.String revisionForBuild, java.lang.String previousRevision)
          Revert lastVcsRevisionKey in build based on previous build revision contained in BuildContext.
 void saveBuild(Build build)
          Persists a build
 void saveSuspendBuild(java.lang.String buildKey, boolean setSuspendBuild)
          Persists a build for enable/disable
 void updateNames(java.lang.String projectName, java.lang.String buildName, Build build)
          Updates project and plan names.
 void updateNamesAndDescription(java.lang.String projectName, java.lang.String buildName, java.lang.String description, Build build)
          Updates project and plan names and plan description.
 java.lang.String updateVcsRevisionKey(BuildContext buildContext)
          Updates lastVcsRevisionKey in build based on revision contained in BuildContext
 

Method Detail

getBuildByKey

@Nullable
Build getBuildByKey(java.lang.String key)
Returns the build given a key

Parameters:
key - - full key of the build. eg. BAM-MAIN null safe
Returns:
A Build if the key matches. Otherwise null

getBuildById

Build getBuildById(long id)
Returns the build given the id

Parameters:
id -
Returns:
A Build. null if not found.

getAllBuilds

java.util.Collection<Build> getAllBuilds()
Returns a collection of all Build objects

Returns:
all builds in the system, Collections.emptyList() if none exists

getAllBuildsForRead

java.util.Collection<Build> getAllBuildsForRead()

retreiveAllBuilds

java.util.Collection<Build> retreiveAllBuilds()

getAllBuildsForEdit

java.util.Collection<Build> getAllBuildsForEdit()

getAllBuildsForClone

java.util.Collection<Build> getAllBuildsForClone()

getBuildsForDeletion

java.util.Collection<Build> getBuildsForDeletion()

getFavouriteBuildsForRead

java.util.Collection<Build> getFavouriteBuildsForRead(com.atlassian.user.User user)

filterFavouritedBuilds

@NotNull
java.util.Set<Build> filterFavouritedBuilds(@NotNull
                                                    java.util.Collection<Build> builds,
                                                    @NotNull
                                                    com.atlassian.user.User user)
Return a set of Builds that are a subset of the given Builds collection that are favourited by the User

Parameters:
builds -
user -
Returns:
favoritedBuilds

getFavouriteBuildsByProjectForRead

@NotNull
java.util.Collection<Build> getFavouriteBuildsByProjectForRead(Project project,
                                                                       com.atlassian.user.User user)
Deprecated. 

Return a set of favourited builds Builds that belong to Project and @{link User}

Parameters:
project -
user -
Returns:
favoritedBuilds

getBuildsByProjectForRead

java.util.Collection<Build> getBuildsByProjectForRead(Project project)
This is the manager equivalent of a project.getBuilds. However, this is permission filtered.

Parameters:
project -
Returns:

isExistingBuildName

boolean isExistingBuildName(java.lang.String projectKey,
                            java.lang.String buildName)
Returns true if the build name already exists within the given project key

Parameters:
projectKey - (doesn't have to exist for this check)
buildName - to check
Returns:
true if build name already exists in that project

isExistingBuildKey

boolean isExistingBuildKey(java.lang.String projectKey,
                           java.lang.String buildKey)
Returns true if the build key already exists within the given project key

Parameters:
projectKey - (doesn't have to exist for this check)
buildKey - to check
Returns:
true if build name already exists in that project

exists

boolean exists(java.lang.String key)
Returns true if build exists with the provided key (eg. BAM-BOO)

Parameters:
key -
Returns:
exists

isPlanCreationAllowed

boolean isPlanCreationAllowed()
Check whether or not a plan can be created or not (based on licensing etc) USE SPARINGLY!

Returns:
true if a plan can be created otherwise false;

isBuildingSuspended

boolean isBuildingSuspended()
Checks whether or not bamboo is currently suspended from building due to license reasons. This value is cached.

Returns:
true if building is suspended.

recheckBuildingSuspended

boolean recheckBuildingSuspended()
Force the build manager to double check if building should be suspended or not. USE SPARINGLY!

Returns:
the new value

getPlanCount

int getPlanCount()
How many plans currently exist

Returns:
how many plans exist in the datbase

createBuild

void createBuild(Build build,
                 BuildConfiguration buildConfiguration,
                 HibernateAcl acl)
                 throws PlanCreationDeniedException
Save a new build object with the passed buildConfiguration

Parameters:
build - @NotNull
buildConfiguration - @NotNull
acl -
Throws:
PlanCreationDeniedException - if the plan can not be created due to licensing.

saveBuild

void saveBuild(Build build)
Persists a build

Parameters:
build - cannot be null

saveSuspendBuild

void saveSuspendBuild(java.lang.String buildKey,
                      boolean setSuspendBuild)
Persists a build for enable/disable

Parameters:
buildKey - of the build to be suspended/resumed
setSuspendBuild - true if the build should be suspended, false if resumed

deleteBuild

void deleteBuild(@NotNull
                 java.lang.String buildKey)
Removes the build from system

Parameters:
buildKey - String name for build

addBuildResults

void addBuildResults(Build build,
                     BuildResults buildResults)

getBuildResults

@Nullable
BuildResults getBuildResults(Build build,
                                      java.lang.Integer buildNumber)
Return BuildResults for the given Build and buildNumber

Parameters:
build -
buildNumber -
Returns:
buildResults

getBuildResults

BuildResults getBuildResults(java.lang.String planKey,
                             java.lang.Integer buildNumber)
Return BuildResults for the given planKey and buildNumber

Parameters:
planKey -
buildNumber -
Returns:
buildResults

getBuildByProjectAndName

Build getBuildByProjectAndName(java.lang.String projectKey,
                               java.lang.String buildName)

updateNames

void updateNames(java.lang.String projectName,
                 java.lang.String buildName,
                 Build build)
Updates project and plan names.

Parameters:
projectName - new name of the project
buildName - new name of the plan
build - build object to be modified and stored.

updateNamesAndDescription

void updateNamesAndDescription(java.lang.String projectName,
                               java.lang.String buildName,
                               @Nullable
                               java.lang.String description,
                               Build build)
Updates project and plan names and plan description.

Parameters:
projectName - new name of the project
buildName - new name of the plan
description - new plan description
build - build object to be modified and stored.

isAllowBuilding

boolean isAllowBuilding(@NotNull
                        java.lang.String planKey)
Checks if a particular build is allowed to be built. It checks if it exists, not suspened, and that there is no global flag that has stopped building

Parameters:
planKey -
Returns:
true if the planKey is a valid build that is allowed to be built

getProjectBuilds

@NotNull
java.util.Map<Project,java.util.Collection<Build>> getProjectBuilds(boolean includeEmptyProjects)
Return a map of Build collections which belong to a Project

Parameters:
includeEmptyProjects - set to true if you want all of the projects regardless if they have any builds
Returns:
build collection map

updateVcsRevisionKey

java.lang.String updateVcsRevisionKey(@NotNull
                                      BuildContext buildContext)
Updates lastVcsRevisionKey in build based on revision contained in BuildContext

Parameters:
buildContext -
Returns:
updated lastVcsRevisionKey

revertVcsRevisionKey

@Nullable
java.lang.String revertVcsRevisionKey(@NotNull
                                               java.lang.String buildKey,
                                               @NotNull
                                               java.lang.String revisionForBuild,
                                               @Nullable
                                               java.lang.String previousRevision)
Revert lastVcsRevisionKey in build based on previous build revision contained in BuildContext. The only reason to revert revision is for the situation, when build is abandoned and no subsequent build has been started. If subsequent build has been already started, there is no effect of reverting vcsRevisionKey

Parameters:
buildKey -
revisionForBuild -
previousRevision -
Returns:


Copyright © 2010 Atlassian. All Rights Reserved.