com.atlassian.bamboo.resultsummary
Interface BuildResultsSummaryDao

All Superinterfaces:
BambooObjectDao<ResultsSummary>
All Known Implementing Classes:
BuildResultsSummaryHibernateDao

public interface BuildResultsSummaryDao
extends BambooObjectDao<ResultsSummary>


Field Summary
static int NUMBER_OF_DAYS_TO_FILTER
           
 
Method Summary
 int countBuildResultsSummaries()
          Count all result summaries records.
 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.
 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 jiraProjectKey)
          Retrieve a list of results summaries associated with given JIRA project key This will not return records marked for deletion.
 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 elasticImageConfiguration, BuildState buildState, int maxResults)
          Searcher for builds of an image
 java.util.List<ChainResultsSummary> findChainResultsWithJobLabelled(ResultsSummaryCriteria criteria, 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 planKey, int buildNumber, BuildState buildState)
          Finds the last successful BuildResultsSummary after buildNumber
 ResultsSummary findFirstBuildResultWithBuildStateBetween(java.lang.String planKey, 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.
<T extends ResultsSummary>
T
findLastBuildResultBeforeWithTests(PlanResultKey planResultKey, java.lang.Class<T> aClass, boolean includeOnceOffBuilds)
           
 ResultsSummary findLastBuildResultWithBuildStateBefore(java.lang.String planKey, 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, boolean includeOnceOffBuilds)
          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
 Pair<java.lang.Integer,java.lang.Iterable<PlanKey>> findPlanKeysFromAllOrphanedResultSummaries()
          Scans database for all the ResultsSummary objects in the database that do not have a matching Plan
<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 ImmutableResultsSummary.isActive()
<T extends ResultsSummary>
java.util.Collection<T>
getAllBuildResultSummariesInBuildState(BuildState state, java.lang.Class<T> aClass)
          Returns all the BuildResultsSummary in requested build state.
<T extends ResultsSummary>
java.util.Collection<T>
getAllBuildResultSummariesInLifeCycleState(LifeCycleState state, java.lang.Class<T> aClass)
          Returns all the BuildResultsSummary in requested lifecycle state.
<T extends ResultsSummary>
java.util.Collection<T>
getAllBuildResultSummariesInUnknownState(java.lang.Class<T> aClass)
          Returns all the BuildResultsSummary in a BuildState.UNKNOWN state This will not return records marked for deletion.
 java.util.Collection<BuildResultsSummary> getAllInProgressBuildResultSummaries()
          Returns all the BuildResultsSummary in a LifeCycleState.IN_PROGRESS state This will not return records marked for deletion.
<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 This will not return records marked for deletion.
<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 This will not return records marked for deletion.
<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 This will not return records marked for deletion.
<T extends ResultsSummary>
java.util.List<T>
getAllResultSummariesForPlan(Plan plan)
          Get all the ResultsSummarys for the given Plan
 ResultsSummary getBreakingBuild(ResultsSummary summary)
           
 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 Plan
 BuildResultsSummary getFirstBuildSummary(PlanKey planKey)
          Returns the first available BuildResultsSummary for the given PlanKey
 ResultsSummary getFixingBuild(ResultsSummary summary)
          Returns the first successful BuildResultsSummary for given BuildResultsSummary.
 java.util.List<LinkedJiraIssue> getJiraIssuesForBuild(ImmutablePlan 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(ImmutablePlan plan, int currentBuildNumber, int neighbouringSummariesMaxCount)
          Returns build results "around" given build number
 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(ImmutablePlan plan)
          Get number of the ResultsSummarys in a LifeCycleState.FINISHED or LifeCycleState.NOT_BUILT state for the given Plan
 long getNumberOfFinishedResults(Plan build)
          Returns the number of finished results available for the given Plan
 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
 java.lang.Long getResultsSummaryId(PlanResultKey planResultKey)
          Return ResultsSummary's database id.
<T extends ResultsSummary>
java.util.List<T>
getResultSummariesByChangeSetId(java.lang.String changeSetId, java.lang.Class<T> discriminator)
          Get a list of all build results containing a commit with the given change set ID.
<T extends ResultsSummary>
java.util.List<T>
getResultSummariesByChangeSetIds(java.util.List<java.lang.String> changeSetIds, java.lang.Class<T> discriminator)
          Get a list of all build results containing a commit with any of the given change set IDs.
<T extends ResultsSummary>
java.util.List<T>
getResultSummariesForPlan(ImmutablePlan 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 resultsSummary)
          Get (@link ChainStageResult} containing given ResultsSummary
 int markResultSummariesForDeletion(PlanKey planKey)
          Mass update of all ResultsSummary records in the database related to a Plan identified by planKey.
 int removeResultsSummariesForPlan(PlanKey planKey)
          Remove all resultSummary objects for the given plan.
 void removeResultsSummary(ResultsSummary buildResultsSummary)
          Removes the passed result summary
 long scrollResultSummaries(java.lang.String buildKey, ResultDataRead resultDataRead, 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.
 long scrollVariableSubstitutionForExport(com.google.common.base.Function<VariableSubstitution,java.lang.Void> function)
          Scroll through and execute function for each of VariableSubstitution Objects passed to function are not fully initialized.
 
Methods inherited from interface com.atlassian.bamboo.persistence3.BambooObjectDao
delete, deleteAll, executeReturnLong, findAll, findById, save, saveAll
 

Field Detail

NUMBER_OF_DAYS_TO_FILTER

static final int NUMBER_OF_DAYS_TO_FILTER
See Also:
Constant Field Values
Method Detail

getAllBuildResultSummariesInUnknownState

@NotNull
<T extends ResultsSummary> java.util.Collection<T> getAllBuildResultSummariesInUnknownState(java.lang.Class<T> aClass)
Returns all the BuildResultsSummary in a BuildState.UNKNOWN state This will not return records marked for deletion.

Returns:
summaries

getAllPendingResultSummaries

@NotNull
<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 This will not return records marked for deletion.

Returns:
summaries

getAllQueuedResultSummaries

@NotNull
<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 This will not return records marked for deletion.

Returns:
summaries

getAllInProgressResultSummaries

@NotNull
<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 This will not return records marked for deletion.

Returns:
summaries

getAllActiveResultSummariesForPlan

@NotNull
<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 ImmutableResultsSummary.isActive()

Returns:
summaries

getFinalizedResultSummariesForPlan

@NotNull
<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. Result are sorted descending by build number.

Type Parameters:
T -
Parameters:
planKey -
aClass -
firstResult - - specifies the first result to be included in the list.
maxResults - - specifies the length of the result; 0 for all results;
Returns:

getNumberOfConcurrentlyRunningBuilds

int getNumberOfConcurrentlyRunningBuilds(PlanKey planKey)
Get the number of concurrently running builds for planKey

Parameters:
planKey -
Returns:

getResultsSummaryId

@Nullable
java.lang.Long getResultsSummaryId(@NotNull
                                            PlanResultKey planResultKey)
Return ResultsSummary's database id. This method is intended for internal use (currently in importer)

Parameters:
planResultKey - plan result key of ResultsSummary to be found
Returns:
id of ResultsSummary or null if not found

getResultsSummary

@Nullable
<T extends ResultsSummary> T getResultsSummary(@NotNull
                                                        PlanResultKey planResultKey,
                                                        @NotNull
                                                        java.lang.Class<T> aClass)
Lookup ResultsSummary by PlanResultKey and expected type

Type Parameters:
T -
Parameters:
planResultKey -
aClass -
Returns:
resultSummary

getResultsSummary

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

Type Parameters:
T -
Parameters:
planResultKey -
aClass -
dataRead -
Returns:
resultSummary

getAllBuildResultSummariesInBuildState

@NotNull
<T extends ResultsSummary> java.util.Collection<T> getAllBuildResultSummariesInBuildState(@NotNull
                                                                                                  BuildState state,
                                                                                                  java.lang.Class<T> aClass)
Returns all the BuildResultsSummary in requested build state. This will not return records marked for deletion.

Parameters:
state -
aClass -
Returns:
summaries

getAllBuildResultSummariesInLifeCycleState

@NotNull
<T extends ResultsSummary> java.util.Collection<T> getAllBuildResultSummariesInLifeCycleState(@NotNull
                                                                                                      LifeCycleState state,
                                                                                                      java.lang.Class<T> aClass)
Returns all the BuildResultsSummary in requested lifecycle state. This will not return records marked for deletion.

Parameters:
state -
aClass -
Returns:
summaries

getAllInProgressBuildResultSummaries

@NotNull
java.util.Collection<BuildResultsSummary> getAllInProgressBuildResultSummaries()
Returns all the BuildResultsSummary in a LifeCycleState.IN_PROGRESS state This will not return records marked for deletion.

Returns:
summaries

getFirstBuildSummary

@Nullable
BuildResultsSummary getFirstBuildSummary(@NotNull
                                                  Plan plan)
Returns the first available BuildResultsSummary for the given Plan

Parameters:
plan -
Returns:
buildResult

getFirstBuildSummary

@Nullable
BuildResultsSummary getFirstBuildSummary(@NotNull
                                                  PlanKey planKey)
Returns the first available BuildResultsSummary for the given PlanKey

Parameters:
planKey -
Returns:
buildResult

getLastResultSummary

<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

Parameters:
planKey -
Returns:
buildResult

getNumberOfFinishedResults

long getNumberOfFinishedResults(Plan build)
Returns the number of finished results available for the given Plan

Parameters:
build -
Returns:
numberOfResults

getNumberOfFinalizedResults

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

Parameters:
plan -
Returns:
number of summaries

getNeighbouringSummaries

@NotNull
java.util.List<ResultsSummary> getNeighbouringSummaries(Plan plan,
                                                                int currentBuildNumber)
Returns build results "around" given build number

Parameters:
plan -
currentBuildNumber -
Returns:

getNeighbouringSummaries

@NotNull
java.util.List<ResultsSummary> getNeighbouringSummaries(ImmutablePlan plan,
                                                                int currentBuildNumber,
                                                                int neighbouringSummariesMaxCount)
Returns build results "around" given build number

Parameters:
plan -
currentBuildNumber -
neighbouringSummariesMaxCount -
Returns:

getBreakingBuild

@Nullable
ResultsSummary getBreakingBuild(ResultsSummary summary)

getFixingBuild

@Nullable
ResultsSummary getFixingBuild(ResultsSummary summary)
Returns the first successful BuildResultsSummary for given BuildResultsSummary. The input build is returned if it is successful.

Parameters:
summary -
Returns:
null if there is no fixing build.

findResultsSummaries

@NotNull
<T extends ResultsSummary> java.util.List<T> findResultsSummaries(@NotNull
                                                                          ResultsSummaryCriteria criteria)
Searches for ResultsSummary objects given a ResultsSummaryCriteria. Note that if criteria does not specify maxResults property, a hard cap of 10000 results is applied to search operation.

Parameters:
criteria - @NotNull
Returns:
List of BuildResultsSummary

removeResultsSummariesForPlan

int removeResultsSummariesForPlan(@NotNull
                                  PlanKey planKey)
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.

Parameters:
planKey - identifier of plan to remove results for.
Returns:
number of deleted ResultsSummary objects

findPlanKeysFromAllOrphanedResultSummaries

Pair<java.lang.Integer,java.lang.Iterable<PlanKey>> findPlanKeysFromAllOrphanedResultSummaries()
Scans database for all the ResultsSummary objects in the database that do not have a matching Plan

Returns:
number of orphaned ResultsSummarys and list of distinct PlanKeys they reference.

countBuildResultsSummaries

int countBuildResultsSummaries(long agentId,
                               @Nullable
                               BuildState buildState)
Count how many build results match the agent & optional build state. This will not count records marked for deletion.

Parameters:
agentId -
buildState - - can be null.
Returns:
count

countBuildResultsSummaries

int countBuildResultsSummaries(@NotNull
                               java.lang.String planKey)

countBuildResultsSummaries

int countBuildResultsSummaries()
Count all result summaries records. This will not count records marked for deletion.

Returns:

removeResultsSummary

void removeResultsSummary(@NotNull
                          ResultsSummary buildResultsSummary)
Removes the passed result summary

Parameters:
buildResultsSummary - - @NotNull

findBuildResultsSummariesByJiraIssues

@NotNull
java.util.List<ResultsSummary> findBuildResultsSummariesByJiraIssues(@Nullable
                                                                             java.util.List<java.lang.String> issueKeys)
Get a list of results summaries associated with the list of issue keys. This will not return records marked for deletion.

Parameters:
issueKeys -
Returns:
list of result summaries

findBuildResultsSummariesByProjectKey

@NotNull
java.util.List<ResultsSummary> findBuildResultsSummariesByProjectKey(@Nullable
                                                                             java.lang.String jiraProjectKey)
Retrieve a list of results summaries associated with given JIRA project key This will not return records marked for deletion.

Parameters:
jiraProjectKey - - JIRA project key (prefix of the jira issues e.g. 'BAM')
Returns:
a list of results summaries associated with given JIRA project key

getJiraIssuesForBuildResults

@NotNull
java.util.List<LinkedJiraIssue> getJiraIssuesForBuildResults(@NotNull
                                                                     java.util.List<ResultsSummary> buildResults)
Retrieves a list of LinkedJiraIssue linked to the given build result summaries

Parameters:
buildResults -
Returns:

getJiraIssuesForBuild

@NotNull
java.util.List<LinkedJiraIssue> getJiraIssuesForBuild(@NotNull
                                                              ImmutablePlan plan)
Retrieves a list of LinkedJiraIssue that are linked to the given build.

Parameters:
plan -
Returns:

findBuildsForImageConfiguration

@NotNull
java.util.List<BuildResultsSummary> findBuildsForImageConfiguration(java.lang.String planKey,
                                                                            ElasticImageConfiguration elasticImageConfiguration,
                                                                            @Nullable
                                                                            BuildState buildState,
                                                                            int maxResults)
Searcher for builds of an image

Parameters:
planKey -
elasticImageConfiguration -
buildState - @Nullable
maxResults -
Returns:

findLastBuildResultBeforeWithTests

@Nullable
<T extends ResultsSummary> T findLastBuildResultBeforeWithTests(@NotNull
                                                                         PlanResultKey planResultKey,
                                                                         @NotNull
                                                                         java.lang.Class<T> aClass,
                                                                         boolean includeOnceOffBuilds)
Type Parameters:
T - of result
Parameters:
planResultKey - of the result
includeOnceOffBuilds - tells whether we also consider 'once-off' builds (the ones with custom revision) or should we skip them in our calculations
aClass - of
Returns:
resultsSummary

findLastResultBefore

@Nullable
<T extends ResultsSummary> T findLastResultBefore(@NotNull
                                                           java.lang.String planKey,
                                                           int buildNumber,
                                                           java.lang.Class<T> aClass,
                                                           boolean includeOnceOffBuilds)
Finds the last successful or failed ResultsSummary before buildNumber

Parameters:
planKey -
buildNumber -
includeOnceOffBuilds - tells whether we also consider 'once-off' builds (the ones with custom revision) or should we skip them in our calculations
Returns:
buildResult

findFirstResultAfter

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

Parameters:
planKey -
buildNumber -
aClass -
Returns:
buildResult

findFirstBuildResultWithBuildStateAfter

@Nullable
ResultsSummary findFirstBuildResultWithBuildStateAfter(@NotNull
                                                                java.lang.String planKey,
                                                                int buildNumber,
                                                                @NotNull
                                                                BuildState buildState)
Finds the last successful BuildResultsSummary after buildNumber

Parameters:
planKey -
buildNumber -
buildState -
Returns:
buildResult

findLastBuildResultWithBuildStateBefore

ResultsSummary findLastBuildResultWithBuildStateBefore(@NotNull
                                                       java.lang.String planKey,
                                                       int buildNumber,
                                                       @NotNull
                                                       BuildState buildState)
Finds the last BuildResultsSummary before buildNumber with BuildState

Parameters:
planKey -
buildNumber -
buildState -
Returns:
buildResult

findFirstBuildResultWithBuildStateBetween

@Nullable
ResultsSummary findFirstBuildResultWithBuildStateBetween(@NotNull
                                                                  java.lang.String planKey,
                                                                  int lowerBuildNumber,
                                                                  int upperBuildNumber,
                                                                  @NotNull
                                                                  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

Parameters:
planKey -
lowerBuildNumber -
upperBuildNumber -
buildState -
Returns:
buildResult

findFirstBuildNumberAfter

@Nullable
java.lang.Integer findFirstBuildNumberAfter(@NotNull
                                                     java.lang.String planKey,
                                                     int buildNumber)
Returns the build number of next existing build results.

Parameters:
planKey -
buildNumber -
Returns:
null if no build result summary with higher number exists

findLastBuildNumberBefore

@Nullable
java.lang.Integer findLastBuildNumberBefore(@NotNull
                                                     java.lang.String planKey,
                                                     int buildNumber)
Returns the build number of previous existing build results.

Parameters:
planKey -
buildNumber -
Returns:
null if no build result summary with lower number exists

findBuildResultsWithArtifacts

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

Parameters:
planKey -
Returns:

scrollResultSummaries

long scrollResultSummaries(@NotNull
                           java.lang.String buildKey,
                           @NotNull
                           ResultDataRead resultDataRead,
                           @NotNull
                           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. Collections are empty and related objects have only id set.

Parameters:
buildKey - of the plan you want to scroll the result summaries for
function - function to be executed on each of the BuildResultSummary
resultDataRead - if the data should be loaded lazy or eagerly
Returns:
number of traversed rows

getChainStageResultById

@Nullable
ChainStageResult getChainStageResultById(long id)
Returns a ChainStageResult by its id

Returns:
chainStageResult

getAllResultSummariesForPlan

<T extends ResultsSummary> java.util.List<T> getAllResultSummariesForPlan(@NotNull
                                                                          Plan plan)
Get all the ResultsSummarys for the given Plan

Type Parameters:
T -
Parameters:
plan -
Returns:
summaries

getResultSummariesForPlan

@NotNull
<T extends ResultsSummary> java.util.List<T> getResultSummariesForPlan(@NotNull
                                                                               ImmutablePlan plan,
                                                                               int firstResult,
                                                                               int maxResults)
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.

Type Parameters:
T -
Parameters:
plan -
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
<T extends ResultsSummary> java.util.List<T> getResultSummariesForPlanByLifeCycleState(@NotNull
                                                                                               Plan plan,
                                                                                               @NotNull
                                                                                               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). User can skip first n result and request maximum number of results.

Type Parameters:
T -
Parameters:
plan -
lifeCycleState -
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

getResultSummariesByChangeSetId

<T extends ResultsSummary> java.util.List<T> getResultSummariesByChangeSetId(@NotNull
                                                                             java.lang.String changeSetId,
                                                                             @NotNull
                                                                             java.lang.Class<T> discriminator)
Get a list of all build results containing a commit with the given change set ID. This will not return records marked for deletion.

Parameters:
changeSetId - of the commit
discriminator - class of the ResultSummary interface required
Returns:
List of ResultsSummary (ResultSummary as determined by discriminator) containing a commit with the given changeSetId

getResultSummariesByChangeSetIds

<T extends ResultsSummary> java.util.List<T> getResultSummariesByChangeSetIds(@NotNull
                                                                              java.util.List<java.lang.String> changeSetIds,
                                                                              @NotNull
                                                                              java.lang.Class<T> discriminator)
Get a list of all build results containing a commit with any of the given change set IDs. This will not return records marked for deletion.

Parameters:
changeSetIds - of the commits
discriminator - class of the ResultSummary interface required
Returns:
List of ResultsSummary (ResultSummary as determined by discriminator) containing a commit with the any of the given changeSetIds

getParentResultSummary

@Nullable
ChainResultsSummary getParentResultSummary(ResultsSummary summary)
Get (@link ChainResultsSummary} containing given ResultsSummary

Parameters:
summary -
Returns:

getStageForResult

@Nullable
ChainStageResult getStageForResult(ResultsSummary resultsSummary)
Get (@link ChainStageResult} containing given ResultsSummary

Parameters:
resultsSummary -
Returns:

findLatestResultsSummaries

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

Returns:
list of latest results summaries

findLatestFailedResultSummaries

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

Returns:
list of latest results summaries

findChainResultsWithJobLabelled

java.util.List<ChainResultsSummary> findChainResultsWithJobLabelled(ResultsSummaryCriteria criteria,
                                                                    java.util.List<Label> labels)
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.

    Parameters:
    criteria - 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

    @Nullable
    <T extends ResultsSummary> T findLastResultSummaryWithState(@NotNull
                                                                         PlanKey planKey,
                                                                         @NotNull
                                                                         BuildState buildState,
                                                                         @NotNull
                                                                         java.lang.Class<T> aClass)
    Type Parameters:
    T -
    Parameters:
    planKey -
    buildState -
    aClass -
    Returns:
    the last ResultsSummary with the provided BuildState

    countResultsWithState

    int countResultsWithState(@NotNull
                              PlanKey planKey,
                              int lowerBuildNumber,
                              int upperBuildNumber,
                              @NotNull
                              BuildState buildState)
    Counts results with a given state in a given build number range for plan.

    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

    scrollVariableSubstitutionForExport

    long scrollVariableSubstitutionForExport(@NotNull
                                             com.google.common.base.Function<VariableSubstitution,java.lang.Void> function)
    Scroll through and execute function for each of VariableSubstitution Objects passed to function are not fully initialized. Collections are empty and related objects have only id set.

    Parameters:
    function - function to be executed on each of the VariableSubstitution
    Returns:
    number of traversed rows

    markResultSummariesForDeletion

    int markResultSummariesForDeletion(@NotNull
                                       PlanKey planKey)
    Mass update of all ResultsSummary records in the database related to a Plan identified by planKey.

    Parameters:
    planKey - key of a plan
    Returns:
    number of updated records


    Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.