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.bamboo.persistence3.BambooHibernateObjectDao<ResultsSummary>
              extended by com.atlassian.bamboo.resultsummary.BuildResultsSummaryHibernateDao
All Implemented Interfaces:
BambooObjectDao<ResultsSummary>, BuildResultsSummaryDao, org.springframework.beans.factory.InitializingBean

public class BuildResultsSummaryHibernateDao
extends BambooHibernateObjectDao<ResultsSummary>
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_STATE
           
protected static java.lang.String CREATION_DATE
           
protected static java.lang.String LIFE_CYCLE_STATE
           
protected static java.lang.String PLAN_KEY
           
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Fields inherited from interface com.atlassian.bamboo.resultsummary.BuildResultsSummaryDao
NUMBER_OF_DAYS_TO_FILTER
 
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)
           
 int countResultsWithState(PlanKey planKey, int lowerBuildNumber, int upperBuildNumber, BuildState buildState)
          Counts results with a given state in a given build number range for plan.
<T extends BuildResultsSummary>
java.util.List<T>
findBuildResultsSummaries(BuildResultsSummaryCriteria criteria)
          Searches for BuildResultsSummary objects given a BuildResultsSummaryCriteria
 java.util.List<ResultsSummary> findBuildResultsSummariesByJiraIssues(java.util.List<java.lang.String> issueKeys)
          Get a list of results summaries associated with the list of issue keys.
 java.util.List<ResultsSummary> findBuildResultsSummariesByProjectKey(java.lang.String projectKey)
          Retrieve a list of results summaries associeted with given JIRA project key
 java.util.List<Pair<ArtifactLink,BuildResultsSummary>> findBuildResultsWithArtifacts(java.lang.String planKey)
          Find all build results which have matching artifacts.
 java.util.List<BuildResultsSummary> findBuildsForImageConfiguration(java.lang.String planKey, ElasticImageConfiguration elasticImage, BuildState buildState, int maxResults)
          Searcher for builds of an image
<E extends ResultsSummary>
E
findById(long id, java.lang.Class<E> aClass)
          Find an entity by its id
 java.util.List<ChainResultsSummary> findChainResultsWithJobLabelled(ResultsSummaryCriteria queryCriteria, java.util.List<Label> labels)
          Searches through all chains to find any that have jobs which match the given labels.
 java.lang.Integer findFirstBuildNumberAfter(java.lang.String planKey, int buildNumber)
          Returns the build number of next existing build results.
 ResultsSummary findFirstBuildResultWithBuildStateAfter(java.lang.String buildKey, int buildNumber, BuildState buildState)
          Finds the last successful BuildResultsSummary after buildNumber
 ResultsSummary 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
<T extends ResultsSummary>
T
findFirstResultAfter(java.lang.String planKey, int buildNumber, java.lang.Class<T> aClass)
          Finds the first successful or failed BuildResultsSummary after buildNumber
 java.lang.Integer findLastBuildNumberBefore(java.lang.String planKey, int buildNumber)
          Returns the build number of previous existing build results.
 ResultsSummary findLastBuildResultBefore(java.lang.String buildKey, int buildNumber)
          Finds the last successful or failed BuildResultsSummary before buildNumber
 ResultsSummary findLastBuildResultWithBuildStateBefore(java.lang.String buildKey, int buildNumber, BuildState buildState)
          Finds the last BuildResultsSummary before buildNumber with BuildState
<T extends ResultsSummary>
T
findLastResultBefore(java.lang.String planKey, int buildNumber, java.lang.Class<T> aClass)
          Finds the last successful or failed ResultsSummary before buildNumber
<T extends ResultsSummary>
T
findLastResultSummaryWithState(PlanKey planKey, BuildState buildState, java.lang.Class<T> aClass)
           
 java.util.List<ResultsSummary> findLatestFailedResultSummaries()
          Find the failed result summaries for all TopLevelPlans in Bamboo that have occurred in the last X days, where x is the constant NUMBER_OF_DAYS_TO_FILTER
 java.util.List<ResultsSummary> findLatestResultsSummaries()
          Find the result summaries for all TopLevelPlans in Bamboo that have occurred in the last X days, where x is the constant NUMBER_OF_DAYS_TO_FILTER
<T extends ResultsSummary>
java.util.List<T>
findResultsSummaries(ResultsSummaryCriteria criteria)
          Searches for ResultsSummary objects given a ResultsSummaryCriteria
<T extends ResultsSummary>
java.util.Collection<T>
getAllActiveResultSummariesForPlan(PlanKey planKey, java.lang.Class<T> aClass)
          Returns all the ResultsSummary in a LifeCycleState.PENDING, LifeCycleState.QUEUED, LifeCycleState.IN_PROGRESS state with the given Class See also LifeCycleState.isActive(LifeCycleState) and ResultsSummary.isActive()
<T extends ResultsSummary>
java.util.Collection<T>
getAllBuildResultSummariesInBuildState(BuildState state, java.lang.Class<T> aClass)
          Returns all the BuildResultsSummary in requested state
<T extends ResultsSummary>
java.util.Collection<T>
getAllBuildResultSummariesInLifeCycleState(LifeCycleState state, java.lang.Class<T> aClass)
           
<T extends ResultsSummary>
java.util.Collection<T>
getAllBuildResultSummariesInUnknownState(java.lang.Class<T> aClass)
          Returns all the BuildResultsSummary in a BuildState.UNKNOWN state
 java.util.Collection<BuildResultsSummary> getAllInProgressBuildResultSummaries()
          Returns all the BuildResultsSummary in a LifeCycleState.IN_PROGRESS state
<T extends ResultsSummary>
java.util.Collection<T>
getAllInProgressResultSummaries(java.lang.Class<T> aClass)
          Returns all the ResultsSummary in a LifeCycleState.IN_PROGRESS state with the given Class
<T extends ResultsSummary>
java.util.Collection<T>
getAllPendingResultSummaries(java.lang.Class<T> aClass)
          Returns all the ResultsSummary in a LifeCycleState.PENDING state with the given Class
<T extends ResultsSummary>
java.util.Collection<T>
getAllQueuedResultSummaries(java.lang.Class<T> aClass)
          Returns all the ResultsSummary in a LifeCycleState.QUEUED state with the given Class
<T extends ResultsSummary>
java.util.List<T>
getAllResultSummariesForPlan(Plan plan)
          Get all the ResultsSummarys for the given Plan
 ResultsSummary getBreakingBuild(ResultsSummary summary)
           
 BuildResultsSummary getBuildResultsSummaryByBuildKeyAndBuildNumber(java.lang.String buildKey, int buildNumber)
          Lookup BuildResultsSummary by buildKey and buildNumber
 ChainStageResult getChainStageResultById(long id)
          Returns a ChainStageResult by its id
<T extends ResultsSummary>
java.util.List<T>
getFinalizedResultSummariesForPlan(PlanKey planKey, java.lang.Class<T> aClass, int firstResult, int maxResults)
          Returns all the ResultsSummary in a LifeCycleState.FINISHED or LifeCycleState.NOT_BUILT state with the given Class.
 BuildResultsSummary getFirstBuildSummary(Plan plan)
          Returns the first available BuildResultsSummary for the given Build
 ResultsSummary getFixingBuild(ResultsSummary summary)
          Returns the first successful BuildResultsSummary for given BuildResultsSummary.
 java.util.List<LinkedJiraIssue> getJiraIssuesForBuild(Plan plan)
          Retrieves a list of LinkedJiraIssue that are linked to the given build.
 java.util.List<LinkedJiraIssue> getJiraIssuesForBuildResults(java.util.List<ResultsSummary> buildResults)
          Retrieves a list of LinkedJiraIssue linked to the given build result summaries
<T extends ResultsSummary>
T
getLastResultSummary(java.lang.String planKey, java.lang.Class<T> aClass)
          Returns the latest completed ResultsSummary for the plan represented by planKey
 java.util.List<ResultsSummary> getNeighbouringSummaries(Plan plan, int currentBuildNumber)
          Returns build results "around" given build number
 int getNumberOfConcurrentlyRunningBuilds(PlanKey planKey)
          Get the number of concurrently running builds for planKey
 long getNumberOfFinalizedResults(Plan plan)
          Get number of the ResultsSummarys or LifeCycleState.NOT_BUILT state for the given Plan
 long getNumberOfFinishedResults(Plan plan)
          Returns the number of finished results available for the given Build
 ChainResultsSummary getParentResultSummary(ResultsSummary summary)
          Get (@link ChainResultsSummary} containing given ResultsSummary
<T extends ResultsSummary>
T
getResultsSummary(PlanResultKey planResultKey, java.lang.Class<T> aClass)
          Lookup ResultsSummary by PlanResultKey and expected type
<T extends ResultsSummary>
T
getResultsSummary(PlanResultKey planResultKey, java.lang.Class<T> aClass, ResultDataRead dataRead)
          Lookup ResultsSummary by PlanResultKey and expected type, all lazy initialized collections can be eagerly read
<T extends ResultsSummary>
java.util.List<T>
getResultSummariesForPlan(Plan plan, int firstResult, int maxResults)
          Get the ResultsSummarys for the given Plan.
<T extends ResultsSummary>
java.util.List<T>
getResultSummariesForPlanByLifeCycleState(Plan plan, LifeCycleState lifeCycleState, int firstResult, int maxResults)
          Get the ResultsSummarys for the given Plan in give LifeCycleState that are Results are sorted by build number (descending).
 ChainStageResult getStageForResult(ResultsSummary summary)
          Get (@link ChainStageResult} containing given ResultsSummary
 int removeAllOrphanedResultSummaries()
          Removes all the ResultsSummary objects in the database that do not have a matching Plan
 void removeBuildResultsSummary(BuildResultsSummary buildResultsSummary)
          Deprecated. 
 int removeResultsSummariesForPlan(PlanKey planKey)
          Remove all resultSummary objects for the given plan.
 void removeResultsSummary(ResultsSummary resultsSummary)
          Removes the passed result summary
 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.
 long scrollResultSummaries(java.lang.String buildKey, com.google.common.base.Function<ResultsSummary,java.lang.Void> function)
          Scroll through and execute function for each of BuildResultsSummary Objects passed to function are not fully initialized.
 void setPlanDiscriminatorRegistry(PlanDiscriminatorRegistry planDiscriminatorRegistry)
           
 void setResultsSummaryDiscriminatorRegistry(ResultsSummaryDiscriminatorRegistry resultsSummaryDiscriminatorRegistry)
           
 
Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateObjectDao
delete, deleteAll, executeReturnLong, findAll, save, saveAll
 
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.persistence3.BambooObjectDao
delete, deleteAll, executeReturnLong, findAll, save, saveAll
 

Field Detail

CREATION_DATE

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

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

PLAN_KEY

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

BUILD_STATE

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

LIFE_CYCLE_STATE

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

BuildResultsSummaryHibernateDao

public BuildResultsSummaryHibernateDao()
Method Detail

getResultsSummary

@Nullable
public <T extends ResultsSummary> T getResultsSummary(@NotNull
                                                               PlanResultKey planResultKey,
                                                               @NotNull
                                                               java.lang.Class<T> aClass)
Description copied from interface: BuildResultsSummaryDao
Lookup ResultsSummary by PlanResultKey and expected type

Specified by:
getResultsSummary in interface BuildResultsSummaryDao
Returns:
resultSummary

getResultsSummary

@Nullable
public <T extends ResultsSummary> T getResultsSummary(@NotNull
                                                               PlanResultKey planResultKey,
                                                               @NotNull
                                                               java.lang.Class<T> aClass,
                                                               ResultDataRead dataRead)
Description copied from interface: BuildResultsSummaryDao
Lookup ResultsSummary by PlanResultKey and expected type, all lazy initialized collections can be eagerly read

Specified by:
getResultsSummary in interface BuildResultsSummaryDao
Returns:
resultSummary

findById

public <E extends ResultsSummary> E findById(long id,
                                             java.lang.Class<E> aClass)
Description copied from interface: BambooObjectDao
Find an entity by its id

Specified by:
findById in interface BambooObjectDao<ResultsSummary>
Overrides:
findById in class BambooHibernateObjectDao<ResultsSummary>
Parameters:
id - id of entity
aClass - class of entity
Returns:
entity

getAllBuildResultSummariesInBuildState

@NotNull
public <T extends ResultsSummary> java.util.Collection<T> getAllBuildResultSummariesInBuildState(@NotNull
                                                                                                         BuildState state,
                                                                                                         @NotNull
                                                                                                         java.lang.Class<T> aClass)
Description copied from interface: BuildResultsSummaryDao
Returns all the BuildResultsSummary in requested state

Specified by:
getAllBuildResultSummariesInBuildState in interface BuildResultsSummaryDao
Returns:
summaries

getAllBuildResultSummariesInLifeCycleState

@NotNull
public <T extends ResultsSummary> java.util.Collection<T> getAllBuildResultSummariesInLifeCycleState(@NotNull
                                                                                                             LifeCycleState state,
                                                                                                             @NotNull
                                                                                                             java.lang.Class<T> aClass)
Specified by:
getAllBuildResultSummariesInLifeCycleState in interface BuildResultsSummaryDao

getAllBuildResultSummariesInUnknownState

public <T extends ResultsSummary> java.util.Collection<T> getAllBuildResultSummariesInUnknownState(java.lang.Class<T> aClass)
Description copied from interface: BuildResultsSummaryDao
Returns all the BuildResultsSummary in a BuildState.UNKNOWN state

Specified by:
getAllBuildResultSummariesInUnknownState in interface BuildResultsSummaryDao
Returns:
summaries

getAllPendingResultSummaries

@NotNull
public <T extends ResultsSummary> java.util.Collection<T> getAllPendingResultSummaries(java.lang.Class<T> aClass)
Description copied from interface: BuildResultsSummaryDao
Returns all the ResultsSummary in a LifeCycleState.PENDING state with the given Class

Specified by:
getAllPendingResultSummaries in interface BuildResultsSummaryDao
Returns:
summaries

getAllQueuedResultSummaries

@NotNull
public <T extends ResultsSummary> java.util.Collection<T> getAllQueuedResultSummaries(java.lang.Class<T> aClass)
Description copied from interface: BuildResultsSummaryDao
Returns all the ResultsSummary in a LifeCycleState.QUEUED state with the given Class

Specified by:
getAllQueuedResultSummaries in interface BuildResultsSummaryDao
Returns:
summaries

getAllInProgressResultSummaries

@NotNull
public <T extends ResultsSummary> java.util.Collection<T> getAllInProgressResultSummaries(java.lang.Class<T> aClass)
Description copied from interface: BuildResultsSummaryDao
Returns all the ResultsSummary in a LifeCycleState.IN_PROGRESS state with the given Class

Specified by:
getAllInProgressResultSummaries in interface BuildResultsSummaryDao
Returns:
summaries

getAllActiveResultSummariesForPlan

@NotNull
public <T extends ResultsSummary> java.util.Collection<T> getAllActiveResultSummariesForPlan(PlanKey planKey,
                                                                                                     java.lang.Class<T> aClass)
Description copied from interface: BuildResultsSummaryDao
Returns all the ResultsSummary in a LifeCycleState.PENDING, LifeCycleState.QUEUED, LifeCycleState.IN_PROGRESS state with the given Class See also LifeCycleState.isActive(LifeCycleState) and ResultsSummary.isActive()

Specified by:
getAllActiveResultSummariesForPlan in interface BuildResultsSummaryDao
Returns:
summaries

getFinalizedResultSummariesForPlan

@NotNull
public <T extends ResultsSummary> java.util.List<T> getFinalizedResultSummariesForPlan(PlanKey planKey,
                                                                                               java.lang.Class<T> aClass,
                                                                                               int firstResult,
                                                                                               int maxResults)
Description copied from interface: BuildResultsSummaryDao
Returns all the ResultsSummary in a LifeCycleState.FINISHED or LifeCycleState.NOT_BUILT state with the given Class. Result are sorted descending by build number.

Specified by:
getFinalizedResultSummariesForPlan in interface BuildResultsSummaryDao
firstResult - - specifies the first result to be included in the list.
maxResults - - specifies the length of the result; 0 for all results;
Returns:

getNumberOfConcurrentlyRunningBuilds

public int getNumberOfConcurrentlyRunningBuilds(PlanKey planKey)
Description copied from interface: BuildResultsSummaryDao
Get the number of concurrently running builds for planKey

Specified by:
getNumberOfConcurrentlyRunningBuilds in interface BuildResultsSummaryDao
Returns:

getAllInProgressBuildResultSummaries

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

Specified by:
getAllInProgressBuildResultSummaries in interface BuildResultsSummaryDao
Returns:
summaries

getBuildResultsSummaryByBuildKeyAndBuildNumber

@Nullable
public BuildResultsSummary getBuildResultsSummaryByBuildKeyAndBuildNumber(java.lang.String buildKey,
                                                                                   int buildNumber)
Description copied from interface: BuildResultsSummaryDao
Lookup BuildResultsSummary by buildKey and buildNumber

Specified by:
getBuildResultsSummaryByBuildKeyAndBuildNumber in interface BuildResultsSummaryDao
Returns:
summary

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 BuildResultsSummary

findResultsSummaries

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

Specified by:
findResultsSummaries in interface BuildResultsSummaryDao
Parameters:
criteria - @NotNull
Returns:
List of BuildResultsSummary

removeResultsSummariesForPlan

public int removeResultsSummariesForPlan(@NotNull
                                         PlanKey planKey)
Description copied from interface: BuildResultsSummaryDao
Remove all resultSummary objects for the given plan. Time-cost of this method might be significant if there are thousands of ResultsSummary objects to be deleted in such case #scheduleResultsSummariesForDelayedDeletion(PlanKey) should be considered.

Specified by:
removeResultsSummariesForPlan in interface BuildResultsSummaryDao
Parameters:
planKey - identifier of plan to remove results for.
Returns:
number of deleted ResultsSummary objects

removeAllOrphanedResultSummaries

public int removeAllOrphanedResultSummaries()
Description copied from interface: BuildResultsSummaryDao
Removes all the ResultsSummary objects in the database that do not have a matching Plan

Specified by:
removeAllOrphanedResultSummaries in interface BuildResultsSummaryDao
Returns:
number of ResultsSummarys removed

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

@NotNull
public java.util.List<BuildResultsSummary> 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<ResultsSummary> findBuildResultsSummariesByJiraIssues(@Nullable
                                                                                    java.util.List<java.lang.String> issueKeys)
Description copied from interface: BuildResultsSummaryDao
Get a list of results summaries associated with the list of issue keys.

Specified by:
findBuildResultsSummariesByJiraIssues in interface BuildResultsSummaryDao
Returns:
list of result summaries

findBuildResultsSummariesByProjectKey

@NotNull
public java.util.List<ResultsSummary> findBuildResultsSummariesByProjectKey(@Nullable
                                                                                    java.lang.String projectKey)
Description copied from interface: BuildResultsSummaryDao
Retrieve a list of results summaries associeted with given JIRA project key

Specified by:
findBuildResultsSummariesByProjectKey in interface BuildResultsSummaryDao
Parameters:
projectKey - - Jira project key (prefix of the jira issues e.g. 'BAM')
Returns:
a list of results summaries associeted with given JIRA project key

removeResultsSummary

public void removeResultsSummary(@NotNull
                                 ResultsSummary resultsSummary)
Description copied from interface: BuildResultsSummaryDao
Removes the passed result summary

Specified by:
removeResultsSummary in interface BuildResultsSummaryDao
Parameters:
resultsSummary - - @NotNull

removeBuildResultsSummary

@Deprecated
public void removeBuildResultsSummary(BuildResultsSummary buildResultsSummary)
Deprecated. 

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(Plan plan)
Description copied from interface: BuildResultsSummaryDao
Returns the first available BuildResultsSummary for the given Build

Specified by:
getFirstBuildSummary in interface BuildResultsSummaryDao
Returns:
buildResult

getLastResultSummary

public <T extends ResultsSummary> T getLastResultSummary(java.lang.String planKey,
                                                         java.lang.Class<T> aClass)
Description copied from interface: BuildResultsSummaryDao
Returns the latest completed ResultsSummary for the plan represented by planKey

Specified by:
getLastResultSummary in interface BuildResultsSummaryDao
Returns:
buildResult

findFirstBuildNumberAfter

public java.lang.Integer findFirstBuildNumberAfter(@NotNull
                                                   java.lang.String planKey,
                                                   int buildNumber)
Description copied from interface: BuildResultsSummaryDao
Returns the build number of next existing build results.

Specified by:
findFirstBuildNumberAfter in interface BuildResultsSummaryDao
Returns:
null if no build result summary with higher number exists

findLastBuildNumberBefore

public java.lang.Integer findLastBuildNumberBefore(@NotNull
                                                   java.lang.String planKey,
                                                   int buildNumber)
Description copied from interface: BuildResultsSummaryDao
Returns the build number of previous existing build results.

Specified by:
findLastBuildNumberBefore in interface BuildResultsSummaryDao
Returns:
null if no build result summary with lower number exists

getNumberOfFinishedResults

public long getNumberOfFinishedResults(Plan plan)
Description copied from interface: BuildResultsSummaryDao
Returns the number of finished results available for the given Build

Specified by:
getNumberOfFinishedResults in interface BuildResultsSummaryDao
Returns:
numberOfResults

getNumberOfFinalizedResults

public long getNumberOfFinalizedResults(@NotNull
                                        Plan plan)
Get number of the ResultsSummarys or LifeCycleState.NOT_BUILT state for the given Plan

Specified by:
getNumberOfFinalizedResults in interface BuildResultsSummaryDao
Parameters:
plan -
Returns:
number of summaries

getNeighbouringSummaries

@NotNull
public java.util.List<ResultsSummary> getNeighbouringSummaries(Plan plan,
                                                                       int currentBuildNumber)
Description copied from interface: BuildResultsSummaryDao
Returns build results "around" given build number

Specified by:
getNeighbouringSummaries in interface BuildResultsSummaryDao
currentBuildNumber - @return

getBreakingBuild

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

getFixingBuild

@Nullable
public ResultsSummary getFixingBuild(ResultsSummary 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<ResultsSummary> 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
                                                                     Plan plan)
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

findFirstResultAfter

@Nullable
public <T extends ResultsSummary> T findFirstResultAfter(@NotNull
                                                                  java.lang.String planKey,
                                                                  int buildNumber,
                                                                  java.lang.Class<T> aClass)
Description copied from interface: BuildResultsSummaryDao
Finds the first successful or failed BuildResultsSummary after buildNumber

Specified by:
findFirstResultAfter in interface BuildResultsSummaryDao
Returns:
buildResult

findLastResultBefore

@Nullable
public <T extends ResultsSummary> T findLastResultBefore(@NotNull
                                                                  java.lang.String planKey,
                                                                  int buildNumber,
                                                                  java.lang.Class<T> aClass)
Description copied from interface: BuildResultsSummaryDao
Finds the last successful or failed ResultsSummary before buildNumber

Specified by:
findLastResultBefore in interface BuildResultsSummaryDao
Returns:
buildResult

findLastBuildResultBefore

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

Specified by:
findLastBuildResultBefore in interface BuildResultsSummaryDao
Returns:
buildResult

findFirstBuildResultWithBuildStateAfter

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

Specified by:
findFirstBuildResultWithBuildStateAfter in interface BuildResultsSummaryDao
Returns:
buildResult

findLastBuildResultWithBuildStateBefore

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

Specified by:
findLastBuildResultWithBuildStateBefore in interface BuildResultsSummaryDao
Returns:
buildResult

findFirstBuildResultWithBuildStateBetween

@Nullable
public ResultsSummary 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

scrollResultSummaries

public long scrollResultSummaries(@NotNull
                                  java.lang.String buildKey,
                                  @NotNull
                                  com.google.common.base.Function<ResultsSummary,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:
scrollResultSummaries in interface BuildResultsSummaryDao
Parameters:
buildKey - of the plan you want to scroll the result summaries for
function - function to be executed on each of the BuildResultSummary
Returns:
number of traversed rows

getChainStageResultById

public ChainStageResult getChainStageResultById(long id)
Description copied from interface: BuildResultsSummaryDao
Returns a ChainStageResult by its id

Specified by:
getChainStageResultById in interface BuildResultsSummaryDao
Returns:
chainStageResult

getAllResultSummariesForPlan

public <T extends ResultsSummary> java.util.List<T> getAllResultSummariesForPlan(@NotNull
                                                                                 Plan plan)
Description copied from interface: BuildResultsSummaryDao
Get all the ResultsSummarys for the given Plan

Specified by:
getAllResultSummariesForPlan in interface BuildResultsSummaryDao
Returns:
summaries

getResultSummariesForPlan

@NotNull
public <T extends ResultsSummary> java.util.List<T> getResultSummariesForPlan(@NotNull
                                                                                      Plan plan,
                                                                                      int firstResult,
                                                                                      int maxResults)
Description copied from interface: BuildResultsSummaryDao
Get the ResultsSummarys for the given Plan. Results are sorted by build number (descending). User can skip first n result and request maximum number of results. Note: fetching huge amount of data in single call should be avoided.

Specified by:
getResultSummariesForPlan in interface BuildResultsSummaryDao
firstResult - specifies the first item to be return (0 base index). Negative values treated as 0.
maxResults - specifies amount of the results to be returned. Value <= 0 returns everything.
Returns:
summaries

getResultSummariesForPlanByLifeCycleState

@NotNull
public <T extends ResultsSummary> java.util.List<T> getResultSummariesForPlanByLifeCycleState(@NotNull
                                                                                                      Plan plan,
                                                                                                      @NotNull
                                                                                                      LifeCycleState lifeCycleState,
                                                                                                      int firstResult,
                                                                                                      int maxResults)
Description copied from interface: BuildResultsSummaryDao
Get the ResultsSummarys for the given Plan in give LifeCycleState that are Results are sorted by build number (descending). User can skip first n result and request maximum number of results.

Specified by:
getResultSummariesForPlanByLifeCycleState in interface BuildResultsSummaryDao
firstResult - specifies the first item to be return (0 base index). Negative values treated as 0.
maxResults - specifies amount of the results to be returned. Value <= 0 returns everything.
Returns:
summaries

getParentResultSummary

@Nullable
public ChainResultsSummary getParentResultSummary(ResultsSummary summary)
Description copied from interface: BuildResultsSummaryDao
Get (@link ChainResultsSummary} containing given ResultsSummary

Specified by:
getParentResultSummary in interface BuildResultsSummaryDao
Returns:

getStageForResult

@Nullable
public ChainStageResult getStageForResult(ResultsSummary summary)
Description copied from interface: BuildResultsSummaryDao
Get (@link ChainStageResult} containing given ResultsSummary

Specified by:
getStageForResult in interface BuildResultsSummaryDao
Returns:

findLatestResultsSummaries

public java.util.List<ResultsSummary> findLatestResultsSummaries()
Description copied from interface: BuildResultsSummaryDao
Find the result summaries for all TopLevelPlans in Bamboo that have occurred in the last X days, where x is the constant NUMBER_OF_DAYS_TO_FILTER

Specified by:
findLatestResultsSummaries in interface BuildResultsSummaryDao
Returns:
list of latest results summaries

findLatestFailedResultSummaries

public java.util.List<ResultsSummary> findLatestFailedResultSummaries()
Description copied from interface: BuildResultsSummaryDao
Find the failed result summaries for all TopLevelPlans in Bamboo that have occurred in the last X days, where x is the constant NUMBER_OF_DAYS_TO_FILTER

Specified by:
findLatestFailedResultSummaries in interface BuildResultsSummaryDao
Returns:
list of latest results summaries

findChainResultsWithJobLabelled

public java.util.List<ChainResultsSummary> findChainResultsWithJobLabelled(ResultsSummaryCriteria queryCriteria,
                                                                           java.util.List<Label> labels)
Description copied from interface: BuildResultsSummaryDao
Searches through all chains to find any that have jobs which match the given labels. The list of chains is then filtered if required, using other criteria elements. Currently the only used criteria are:
  • buildKey
  • toBuildDate
  • toBuildNumber
  • This is to ensure performance is consistent and reduce the possibility of conflicts.

    Specified by:
    findChainResultsWithJobLabelled in interface BuildResultsSummaryDao
    Parameters:
    queryCriteria - containing the restrictions for the chains to be returned
    labels - that the jobs can be associated with
    Returns:
    list of ChainResultSummary that match the criteria and have jobs with any of the given labels

    findLastResultSummaryWithState

    public <T extends ResultsSummary> T findLastResultSummaryWithState(@NotNull
                                                                       PlanKey planKey,
                                                                       @NotNull
                                                                       BuildState buildState,
                                                                       @NotNull
                                                                       java.lang.Class<T> aClass)
    Specified by:
    findLastResultSummaryWithState in interface BuildResultsSummaryDao
    Returns:
    the last ResultsSummary with the provided BuildState

    countResultsWithState

    public int countResultsWithState(@NotNull
                                     PlanKey planKey,
                                     int lowerBuildNumber,
                                     int upperBuildNumber,
                                     @NotNull
                                     BuildState buildState)
    Description copied from interface: BuildResultsSummaryDao
    Counts results with a given state in a given build number range for plan.

    Specified by:
    countResultsWithState in interface BuildResultsSummaryDao
    Parameters:
    planKey - the key of plan to analyse
    lowerBuildNumber - the build number to start the count with
    upperBuildNumber - the build number to end the count with
    buildState - the state that will be counted
    Returns:
    the count

    setResultsSummaryDiscriminatorRegistry

    public void setResultsSummaryDiscriminatorRegistry(ResultsSummaryDiscriminatorRegistry resultsSummaryDiscriminatorRegistry)

    setPlanDiscriminatorRegistry

    public void setPlanDiscriminatorRegistry(PlanDiscriminatorRegistry planDiscriminatorRegistry)


    Copyright © 2011 Atlassian. All Rights Reserved.