com.atlassian.bamboo.build
Class HibernateBuildManager

java.lang.Object
  extended by com.atlassian.bamboo.build.HibernateBuildManager
All Implemented Interfaces:
BuildManager

public class HibernateBuildManager
extends java.lang.Object
implements BuildManager


Constructor Summary
HibernateBuildManager()
           
 
Method Summary
 void addBuildResults(Buildable buildable, BuildResults buildResults)
           
 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)
           
 BuildExecutionManager getBuildExecutionManager()
           
 BuildResults getBuildResults(Buildable build, java.lang.Integer buildNumber)
          Return BuildResults for the given Build and buildNumber
 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> 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 isExistingBuildKey(java.lang.String givenKey)
          Is there an existing build with the same key?
 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 buildName)
           
 boolean isExistingBuildName(java.lang.String projectKey, java.lang.String buildName)
          Returns true if the build name already exists within the given project key
 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 setAclService(org.acegisecurity.acls.MutableAclService aclService)
           
 void setAdminErrorHandler(AdminErrorHandler adminErrorHandler)
           
 void setBambooLicenseManager(BambooLicenseManager bambooLicenseManager)
           
 void setBuildDao(BuildDao buildDao)
           
 void setBuildDefinitionManager(BuildDefinitionManager buildDefinitionManager)
           
 void setBuildExecutionManager(BuildExecutionManager buildExecutionManager)
           
 void setBuildResultsSummaryManager(BuildResultsSummaryManager buildResultsSummaryManager)
           
 void setBuildSuspensionCheckBean(BuildSuspensionCheckBean buildSuspensionCheckBean)
           
 void setEventManager(com.atlassian.event.EventManager eventManager)
           
 void setLabelManager(LabelManager labelManager)
           
 void setPlanDependencyManager(PlanDependencyManager planDependencyManager)
           
 void setPlanManager(PlanManager planManager)
           
 void setPlanParticleManager(PlanParticleManager planParticleManager)
           
 void setPlanScheduler(PlanScheduler planScheduler)
           
 void setProjectManager(ProjectManager projectManager)
           
 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, Buildable buildable)
          Updates project and plan names and plan description.
 java.lang.String updateVcsRevisionKey(BuildContext buildContext)
          Updates lastVcsRevisionKey in build based on revision contained in BuildContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateBuildManager

public HibernateBuildManager()
Method Detail

getBuildByKey

@Nullable
public Build getBuildByKey(java.lang.String key)
Description copied from interface: BuildManager
Returns the build given a key

Specified by:
getBuildByKey in interface BuildManager
Parameters:
key - - full key of the build. eg. BAM-MAIN null safe
Returns:
A Build if the key matches. Otherwise null

getBuildById

public Build getBuildById(long id)
Description copied from interface: BuildManager
Returns the build given the id

Specified by:
getBuildById in interface BuildManager
Returns:
A Build. null if not found.

getAllBuilds

public java.util.Collection<Build> getAllBuilds()
Description copied from interface: BuildManager
Returns a collection of all Build objects

Specified by:
getAllBuilds in interface BuildManager
Returns:
all builds in the system, Collections.emptyList() if none exists

getAllBuildsForRead

public java.util.Collection<Build> getAllBuildsForRead()
Specified by:
getAllBuildsForRead in interface BuildManager

retreiveAllBuilds

public java.util.Collection<Build> retreiveAllBuilds()
Specified by:
retreiveAllBuilds in interface BuildManager

getAllBuildsForEdit

public java.util.Collection<Build> getAllBuildsForEdit()
Specified by:
getAllBuildsForEdit in interface BuildManager

getAllBuildsForClone

public java.util.Collection<Build> getAllBuildsForClone()
Specified by:
getAllBuildsForClone in interface BuildManager

getBuildsForDeletion

public java.util.Collection<Build> getBuildsForDeletion()
Specified by:
getBuildsForDeletion in interface BuildManager

getBuildsByProjectForRead

public java.util.Collection<Build> getBuildsByProjectForRead(Project project)
Description copied from interface: BuildManager
This is the manager equivalent of a project.getBuilds. However, this is permission filtered.

Specified by:
getBuildsByProjectForRead in interface BuildManager
Returns:

getFavouriteBuildsForRead

public java.util.Collection<Build> getFavouriteBuildsForRead(com.atlassian.user.User user)
Specified by:
getFavouriteBuildsForRead in interface BuildManager
Returns:

filterFavouritedBuilds

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

Specified by:
filterFavouritedBuilds in interface BuildManager
Returns:
favoritedBuilds

isExistingBuildName

public boolean isExistingBuildName(java.lang.String buildName)

isExistingBuildKey

public boolean isExistingBuildKey(java.lang.String givenKey)
Is there an existing build with the same key?

Parameters:
givenKey -
Returns:
true if another build exists with the givenKey

isExistingBuildName

public boolean isExistingBuildName(java.lang.String projectKey,
                                   java.lang.String buildName)
Description copied from interface: BuildManager
Returns true if the build name already exists within the given project key

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

isExistingBuildKey

public boolean isExistingBuildKey(java.lang.String projectKey,
                                  java.lang.String buildKey)
Description copied from interface: BuildManager
Returns true if the build key already exists within the given project key

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

exists

public boolean exists(java.lang.String key)
Description copied from interface: BuildManager
Returns true if build exists with the provided key (eg. BAM-BOO)

Specified by:
exists in interface BuildManager
Returns:
exists

getPlanCount

public int getPlanCount()
How many plans currently exist

Specified by:
getPlanCount in interface BuildManager
Returns:
number of plans found in the database

saveBuild

public void saveBuild(Build build)
Description copied from interface: BuildManager
Persists a build

Specified by:
saveBuild in interface BuildManager
Parameters:
build - cannot be null

saveSuspendBuild

public void saveSuspendBuild(java.lang.String buildKey,
                             boolean setSuspendBuild)
Description copied from interface: BuildManager
Persists a build for enable/disable

Specified by:
saveSuspendBuild in interface BuildManager
Parameters:
buildKey - of the build to be suspended/resumed
setSuspendBuild - true if the build should be suspended, false if resumed

getBuildByProjectAndName

public Build getBuildByProjectAndName(java.lang.String projectKey,
                                      java.lang.String buildName)
Specified by:
getBuildByProjectAndName in interface BuildManager

updateNames

public void updateNames(java.lang.String projectName,
                        java.lang.String buildName,
                        Build build)
Description copied from interface: BuildManager
Updates project and plan names.

Specified by:
updateNames in interface BuildManager
Parameters:
projectName - new name of the project
buildName - new name of the plan
build - build object to be modified and stored.

updateNamesAndDescription

public void updateNamesAndDescription(java.lang.String projectName,
                                      java.lang.String buildName,
                                      @Nullable
                                      java.lang.String description,
                                      Buildable buildable)
Updates project and plan names and plan description.

Specified by:
updateNamesAndDescription in interface BuildManager
Parameters:
projectName - new name of the project
buildName - new name of the plan
description - new plan description
buildable - build object to be modified and stored.

isAllowBuilding

public boolean isAllowBuilding(@NotNull
                               java.lang.String planKey)
Description copied from interface: BuildManager
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

Specified by:
isAllowBuilding in interface BuildManager
Returns:
true if the planKey is a valid build that is allowed to be built

getProjectBuilds

@NotNull
public java.util.Map<Project,java.util.Collection<Build>> getProjectBuilds(boolean includeEmptyProjects)
Description copied from interface: BuildManager
Return a map of Build collections which belong to a Project

Specified by:
getProjectBuilds in interface BuildManager
Parameters:
includeEmptyProjects - set to true if you want all of the projects regardless if they have any builds
Returns:
build collection map

updateVcsRevisionKey

public java.lang.String updateVcsRevisionKey(@NotNull
                                             BuildContext buildContext)
Description copied from interface: BuildManager
Updates lastVcsRevisionKey in build based on revision contained in BuildContext

Specified by:
updateVcsRevisionKey in interface BuildManager
Returns:
updated lastVcsRevisionKey

revertVcsRevisionKey

public java.lang.String revertVcsRevisionKey(@NotNull
                                             java.lang.String buildKey,
                                             @NotNull
                                             java.lang.String revisionForBuild,
                                             @Nullable
                                             java.lang.String previousRevision)
Description copied from interface: BuildManager
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

Specified by:
revertVcsRevisionKey in interface BuildManager
Returns:

addBuildResults

public void addBuildResults(Buildable buildable,
                            BuildResults buildResults)
Specified by:
addBuildResults in interface BuildManager

getBuildResults

@Nullable
public BuildResults getBuildResults(Buildable build,
                                             java.lang.Integer buildNumber)
Description copied from interface: BuildManager
Return BuildResults for the given Build and buildNumber

Specified by:
getBuildResults in interface BuildManager
Returns:
buildResults

getBuildResults

@NotNull
public BuildResults getBuildResults(Build build,
                                            java.lang.Integer buildNumber)
Description copied from interface: BuildManager
Return BuildResults for the given Build and buildNumber

Specified by:
getBuildResults in interface BuildManager
Returns:
buildResults

getBuildResults

public BuildResults getBuildResults(java.lang.String planKey,
                                    java.lang.Integer buildNumber)
Description copied from interface: BuildManager
Return BuildResults for the given planKey and buildNumber

Specified by:
getBuildResults in interface BuildManager
Returns:
buildResults

setBuildDao

public void setBuildDao(BuildDao buildDao)

setProjectManager

public void setProjectManager(ProjectManager projectManager)

setBuildDefinitionManager

public void setBuildDefinitionManager(BuildDefinitionManager buildDefinitionManager)

setBuildResultsSummaryManager

public void setBuildResultsSummaryManager(BuildResultsSummaryManager buildResultsSummaryManager)

setAclService

public void setAclService(org.acegisecurity.acls.MutableAclService aclService)

setEventManager

public void setEventManager(com.atlassian.event.EventManager eventManager)

setLabelManager

public void setLabelManager(LabelManager labelManager)

setBambooLicenseManager

public void setBambooLicenseManager(BambooLicenseManager bambooLicenseManager)

setAdminErrorHandler

public void setAdminErrorHandler(AdminErrorHandler adminErrorHandler)

setPlanDependencyManager

public void setPlanDependencyManager(PlanDependencyManager planDependencyManager)

setPlanParticleManager

public void setPlanParticleManager(PlanParticleManager planParticleManager)

setPlanScheduler

public void setPlanScheduler(PlanScheduler planScheduler)

getBuildExecutionManager

public BuildExecutionManager getBuildExecutionManager()

setBuildExecutionManager

public void setBuildExecutionManager(BuildExecutionManager buildExecutionManager)

setPlanManager

public void setPlanManager(PlanManager planManager)

setBuildSuspensionCheckBean

public void setBuildSuspensionCheckBean(BuildSuspensionCheckBean buildSuspensionCheckBean)


Copyright © 2010 Atlassian. All Rights Reserved.