com.atlassian.bamboo.resultsummary
Class BuildResultsSummaryHibernateDao

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate.support.HibernateDaoSupport
          extended by com.atlassian.hibernate.HibernateObjectDao
              extended by com.atlassian.bamboo.persistence.BambooHibernateObjectDao
                  extended by com.atlassian.bamboo.resultsummary.BuildResultsSummaryHibernateDao
All Implemented Interfaces:
bucket.core.persistence.ObjectDao, BambooObjectDao, BuildResultsSummaryDao, org.springframework.beans.factory.InitializingBean

public class BuildResultsSummaryHibernateDao
extends BambooHibernateObjectDao
implements BuildResultsSummaryDao


Field Summary
protected static java.lang.String BUILD_AGENT_ID
           
protected static java.lang.String BUILD_COMPLETED_DATE
           
protected static java.lang.String BUILD_KEY
           
protected static java.lang.String BUILD_NUMBER
           
protected static java.lang.String BUILD_STARTED_DATE
           
protected static java.lang.String BUILD_STATE
           
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
BuildResultsSummaryHibernateDao()
           
 
Method Summary
 int countBuildResultsSummaries(long agentId, BuildState buildState)
          Count how many build results match the agent & optional build state
 int countBuildResultsSummaries(java.lang.String planKey)
           
<T extends BuildResultsSummary>
java.util.List<T>
findBuildResultsSummaries(BuildResultsSummaryCriteria criteria)
          Searches for BuildResultsSummary objects given a BuildResultsSummaryCriteria
 java.util.List<ExtendedBuildResultsSummary> findBuildResultsSummariesByJiraIssues(java.util.List<java.lang.String> issueKeys)
           
 java.util.List<ExtendedBuildResultsSummary> findBuildResultsSummariesByProjectKey(java.lang.String projectKey)
          This seems to be the Jira project key not the Bamboo Project key
 java.util.List<Pair<ArtifactLink,BuildResultsSummary>> findBuildResultsWithArtifacts(java.lang.String planKey)
          Find all build results which have matching artifacts.
 java.util.List<ExtendedBuildResultsSummary> findBuildsForImageConfiguration(java.lang.String planKey, ElasticImageConfiguration elasticImage, BuildState buildState, int maxResults)
          Searcher for builds of an image
 ExtendedBuildResultsSummary findFirstBuildResultWithBuildStateAfter(java.lang.String buildKey, int buildNumber, BuildState buildState)
          Finds the last successful ExtendedBuildResultsSummary after buildNumber
 ExtendedBuildResultsSummary findFirstBuildResultWithBuildStateBetween(java.lang.String buildKey, int lowerBuildNumber, int upperBuildNumber, BuildState buildState)
          Returns the first build that matches BuildState between the given build number range Note that this function is inclusive of the upper and lower bound
 ExtendedBuildResultsSummary findLastBuildResultBefore(java.lang.String buildKey, int buildNumber)
          Finds the last successful or failed ExtendedBuildResultsSummary before buildNumber
 ExtendedBuildResultsSummary findLastBuildResultWithBuildStateBefore(java.lang.String buildKey, int buildNumber, BuildState buildState)
          Finds the last ExtendedBuildResultsSummary before buildNumber with BuildState
 java.util.Collection<BuildResultsSummary> getAllPendingBuildResultSummaries()
          Returns all the BuildResultsSummary in a BuildState.PENDING state
 BuildResultsSummary getBreakingBuild(BuildResultsSummary summary)
           
 ExtendedBuildResultsSummary getBuildResultsSummary(PlanResultKey planResultKey)
           
 ExtendedBuildResultsSummary getBuildResultsSummaryByBuildKeyAndBuildNumber(java.lang.String buildKey, int buildNumber)
           
 BuildResultsSummary getFirstBuildSummary(Build build)
          Returns the first available BuildResultsSummary for the given Build
 BuildResultsSummary getFixingBuild(BuildResultsSummary summary)
          Returns the first successful BuildResultsSummary for given BuildResultsSummary.
 java.util.List<LinkedJiraIssue> getJiraIssuesForBuild(Build build)
          Retrieves a list of LinkedJiraIssue that are linked to the given build.
 java.util.List<LinkedJiraIssue> getJiraIssuesForBuildResults(java.util.List<BuildResultsSummary> buildResults)
          Retrieves a list of LinkedJiraIssue linked to the given build result summaries
 ExtendedBuildResultsSummary getLastBuildSummary(java.lang.String planKey)
          Returns the latest ExtendedBuildResultsSummary for the build represented by planKey
 java.util.List getNeighbouringSummaries(Build build, int currentBuildNumber)
           
 long getNumberOfResults(Build build)
          Returns the number of results available for the given Build
 java.lang.Class getPersistentClass()
           
 void removeBuildResultsSummary(BuildResultsSummary buildResultsSummary)
          Removes the passed build result summary
 long scrollBuildResultSummariesForExport(java.lang.String buildKey, com.google.common.base.Function<ExtendedBuildResultsSummary,java.lang.Void> function)
          Scroll through and execute function for each of BuildResultsSummary Objects passed to function are not fully initialized.
 long scrollJiraIssuesForExport(com.google.common.base.Function<LinkedJiraIssue,java.lang.Void> function)
          Scroll through and execute function for each of LinkedJiraIssue Objects passed to function are not fully initialized.
 
Methods inherited from class com.atlassian.bamboo.persistence.BambooHibernateObjectDao
executeCountQuery, executeReturnLong, findById, findById
 
Methods inherited from class com.atlassian.hibernate.HibernateObjectDao
findAll, findAllSorted, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getByClassId, index, refresh, reIndex, remove, replicate, save, saveRaw, setIndexer, unIndex, updateModificationData
 
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.bamboo.persistence.BambooObjectDao
findById
 
Methods inherited from interface bucket.core.persistence.ObjectDao
findAll, findAllSorted, refresh, remove, replicate, save, saveRaw
 

Field Detail

BUILD_COMPLETED_DATE

protected static final java.lang.String BUILD_COMPLETED_DATE
See Also:
Constant Field Values

BUILD_AGENT_ID

protected static final java.lang.String BUILD_AGENT_ID
See Also:
Constant Field Values

BUILD_NUMBER

protected static final java.lang.String BUILD_NUMBER
See Also:
Constant Field Values

BUILD_KEY

protected static final java.lang.String BUILD_KEY
See Also:
Constant Field Values

BUILD_STATE

protected static final java.lang.String BUILD_STATE
See Also:
Constant Field Values

BUILD_STARTED_DATE

protected static final java.lang.String BUILD_STARTED_DATE
See Also:
Constant Field Values
Constructor Detail

BuildResultsSummaryHibernateDao

public BuildResultsSummaryHibernateDao()
Method Detail

getPersistentClass

public java.lang.Class getPersistentClass()
Specified by:
getPersistentClass in interface bucket.core.persistence.ObjectDao

getAllPendingBuildResultSummaries

@NotNull
public java.util.Collection<BuildResultsSummary> getAllPendingBuildResultSummaries()
Description copied from interface: BuildResultsSummaryDao
Returns all the BuildResultsSummary in a BuildState.PENDING state

Specified by:
getAllPendingBuildResultSummaries in interface BuildResultsSummaryDao
Returns:
summaries

getBuildResultsSummaryByBuildKeyAndBuildNumber

@Nullable
public ExtendedBuildResultsSummary getBuildResultsSummaryByBuildKeyAndBuildNumber(java.lang.String buildKey,
                                                                                           int buildNumber)
Specified by:
getBuildResultsSummaryByBuildKeyAndBuildNumber in interface BuildResultsSummaryDao

getBuildResultsSummary

@Nullable
public ExtendedBuildResultsSummary getBuildResultsSummary(@NotNull
                                                                   PlanResultKey planResultKey)
Specified by:
getBuildResultsSummary in interface BuildResultsSummaryDao

findBuildResultsSummaries

@NotNull
public <T extends BuildResultsSummary> java.util.List<T> findBuildResultsSummaries(@NotNull
                                                                                           BuildResultsSummaryCriteria criteria)
Description copied from interface: BuildResultsSummaryDao
Searches for BuildResultsSummary objects given a BuildResultsSummaryCriteria

Specified by:
findBuildResultsSummaries in interface BuildResultsSummaryDao
Parameters:
criteria - @NotNull
Returns:
List of ExtendedBuildResultsSummary

countBuildResultsSummaries

public int countBuildResultsSummaries(long agentId,
                                      BuildState buildState)
Description copied from interface: BuildResultsSummaryDao
Count how many build results match the agent & optional build state

Specified by:
countBuildResultsSummaries in interface BuildResultsSummaryDao
buildState - - can be null.
Returns:
count

countBuildResultsSummaries

public int countBuildResultsSummaries(java.lang.String planKey)
Specified by:
countBuildResultsSummaries in interface BuildResultsSummaryDao

findBuildsForImageConfiguration

public java.util.List<ExtendedBuildResultsSummary> findBuildsForImageConfiguration(java.lang.String planKey,
                                                                                   ElasticImageConfiguration elasticImage,
                                                                                   @Nullable
                                                                                   BuildState buildState,
                                                                                   int maxResults)
Description copied from interface: BuildResultsSummaryDao
Searcher for builds of an image

Specified by:
findBuildsForImageConfiguration in interface BuildResultsSummaryDao
buildState - @Nullable
Returns:

findBuildResultsWithArtifacts

public java.util.List<Pair<ArtifactLink,BuildResultsSummary>> findBuildResultsWithArtifacts(java.lang.String planKey)
Description copied from interface: BuildResultsSummaryDao
Find all build results which have matching artifacts. Sorted by buildNumber, ascending

Specified by:
findBuildResultsWithArtifacts in interface BuildResultsSummaryDao
Returns:

findBuildResultsSummariesByJiraIssues

@NotNull
public java.util.List<ExtendedBuildResultsSummary> findBuildResultsSummariesByJiraIssues(@Nullable
                                                                                                 java.util.List<java.lang.String> issueKeys)
Specified by:
findBuildResultsSummariesByJiraIssues in interface BuildResultsSummaryDao

findBuildResultsSummariesByProjectKey

@NotNull
public java.util.List<ExtendedBuildResultsSummary> findBuildResultsSummariesByProjectKey(@Nullable
                                                                                                 java.lang.String projectKey)
Description copied from interface: BuildResultsSummaryDao
This seems to be the Jira project key not the Bamboo Project key

Specified by:
findBuildResultsSummariesByProjectKey in interface BuildResultsSummaryDao
Returns:

removeBuildResultsSummary

public void removeBuildResultsSummary(BuildResultsSummary buildResultsSummary)
Description copied from interface: BuildResultsSummaryDao
Removes the passed build result summary

Specified by:
removeBuildResultsSummary in interface BuildResultsSummaryDao
Parameters:
buildResultsSummary - - @NotNull

getFirstBuildSummary

@Nullable
public BuildResultsSummary getFirstBuildSummary(Build build)
Description copied from interface: BuildResultsSummaryDao
Returns the first available BuildResultsSummary for the given Build

Specified by:
getFirstBuildSummary in interface BuildResultsSummaryDao
Returns:
buildResult

getLastBuildSummary

@Nullable
public ExtendedBuildResultsSummary getLastBuildSummary(java.lang.String planKey)
Description copied from interface: BuildResultsSummaryDao
Returns the latest ExtendedBuildResultsSummary for the build represented by planKey

Specified by:
getLastBuildSummary in interface BuildResultsSummaryDao
Returns:
buildResult

getNumberOfResults

public long getNumberOfResults(Build build)
Description copied from interface: BuildResultsSummaryDao
Returns the number of results available for the given Build

Specified by:
getNumberOfResults in interface BuildResultsSummaryDao
Returns:
numberOfResults

getNeighbouringSummaries

@NotNull
public java.util.List getNeighbouringSummaries(Build build,
                                                       int currentBuildNumber)
Specified by:
getNeighbouringSummaries in interface BuildResultsSummaryDao

getBreakingBuild

@Nullable
public BuildResultsSummary getBreakingBuild(BuildResultsSummary summary)
Specified by:
getBreakingBuild in interface BuildResultsSummaryDao

getFixingBuild

@Nullable
public BuildResultsSummary getFixingBuild(BuildResultsSummary summary)
Description copied from interface: BuildResultsSummaryDao
Returns the first successful BuildResultsSummary for given BuildResultsSummary. The input build is returned if it is successful.

Specified by:
getFixingBuild in interface BuildResultsSummaryDao
Returns:
null if there is no fixing build.

getJiraIssuesForBuildResults

@NotNull
public java.util.List<LinkedJiraIssue> getJiraIssuesForBuildResults(@NotNull
                                                                            java.util.List<BuildResultsSummary> buildResults)
Description copied from interface: BuildResultsSummaryDao
Retrieves a list of LinkedJiraIssue linked to the given build result summaries

Specified by:
getJiraIssuesForBuildResults in interface BuildResultsSummaryDao
Returns:

getJiraIssuesForBuild

@NotNull
public java.util.List<LinkedJiraIssue> getJiraIssuesForBuild(@NotNull
                                                                     Build build)
Description copied from interface: BuildResultsSummaryDao
Retrieves a list of LinkedJiraIssue that are linked to the given build.

Specified by:
getJiraIssuesForBuild in interface BuildResultsSummaryDao
Returns:

scrollJiraIssuesForExport

public long scrollJiraIssuesForExport(@NotNull
                                      com.google.common.base.Function<LinkedJiraIssue,java.lang.Void> function)
Description copied from interface: BuildResultsSummaryDao
Scroll through and execute function for each of LinkedJiraIssue Objects passed to function are not fully initialized. Collections are empty and related objects have only id set.

Specified by:
scrollJiraIssuesForExport in interface BuildResultsSummaryDao
Parameters:
function - function to be executed on each of the LinkedJiraIssue
Returns:
number of traversed rows

findLastBuildResultBefore

public ExtendedBuildResultsSummary findLastBuildResultBefore(@NotNull
                                                             java.lang.String buildKey,
                                                             int buildNumber)
Description copied from interface: BuildResultsSummaryDao
Finds the last successful or failed ExtendedBuildResultsSummary before buildNumber

Specified by:
findLastBuildResultBefore in interface BuildResultsSummaryDao
Returns:
buildResult

findFirstBuildResultWithBuildStateAfter

public ExtendedBuildResultsSummary findFirstBuildResultWithBuildStateAfter(@NotNull
                                                                           java.lang.String buildKey,
                                                                           int buildNumber,
                                                                           @NotNull
                                                                           BuildState buildState)
Description copied from interface: BuildResultsSummaryDao
Finds the last successful ExtendedBuildResultsSummary after buildNumber

Specified by:
findFirstBuildResultWithBuildStateAfter in interface BuildResultsSummaryDao
Returns:
buildResult

findLastBuildResultWithBuildStateBefore

public ExtendedBuildResultsSummary findLastBuildResultWithBuildStateBefore(@NotNull
                                                                           java.lang.String buildKey,
                                                                           int buildNumber,
                                                                           @NotNull
                                                                           BuildState buildState)
Description copied from interface: BuildResultsSummaryDao
Finds the last ExtendedBuildResultsSummary before buildNumber with BuildState

Specified by:
findLastBuildResultWithBuildStateBefore in interface BuildResultsSummaryDao
Returns:
buildResult

findFirstBuildResultWithBuildStateBetween

@Nullable
public ExtendedBuildResultsSummary findFirstBuildResultWithBuildStateBetween(@NotNull
                                                                                      java.lang.String buildKey,
                                                                                      int lowerBuildNumber,
                                                                                      int upperBuildNumber,
                                                                                      @NotNull
                                                                                      BuildState buildState)
Description copied from interface: BuildResultsSummaryDao
Returns the first build that matches BuildState between the given build number range Note that this function is inclusive of the upper and lower bound

Specified by:
findFirstBuildResultWithBuildStateBetween in interface BuildResultsSummaryDao
Returns:
buildResult

scrollBuildResultSummariesForExport

public long scrollBuildResultSummariesForExport(@NotNull
                                                java.lang.String buildKey,
                                                @NotNull
                                                com.google.common.base.Function<ExtendedBuildResultsSummary,java.lang.Void> function)
Description copied from interface: BuildResultsSummaryDao
Scroll through and execute function for each of BuildResultsSummary Objects passed to function are not fully initialized. Collections are empty and related objects have only id set.

Specified by:
scrollBuildResultSummariesForExport in interface BuildResultsSummaryDao
function - function to be executed on each of the BuildResultSummary
Returns:
number of traversed rows


Copyright © 2010 Atlassian. All Rights Reserved.