com.atlassian.bamboo.resultsummary
Interface ResultsSummaryManager

All Known Subinterfaces:
BuildResultsSummaryManager
All Known Implementing Classes:
BuildResultsSummaryManagerImpl

public interface ResultsSummaryManager

Manager for all ResultsSummary derivatives that supersedes BuildResultsSummaryManager

Since:
2.7

Method Summary
 void calculateAndSetDeltaState(ResultsSummary resultsSummary)
          Figures out the delta state for the provided results summary, if a 'fixing' build will also calculate how long it took to fix.
 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 ResultsSummary>
T
createResultsSummary(BuildContext buildContext, java.lang.Class<T> aClass)
          Creates a ResultsSummary of the given Class
 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.
 ResultsSummary findFirstFailedBuildResultAfter(java.lang.String buildKey, int buildNumber)
          Finds the first failed ResultsSummary after buildNumber
 ResultsSummary findFirstFailedBuildResultBetween(Plan build, int lowerBuildNumber, int upperBuildNumber)
          Finds the first failed build between the upper and lower build numbers inclusively.
<T extends ResultsSummary>
T
findFirstResultAfter(PlanResultKey planResultKey, java.lang.Class<T> aClass)
          Finds the first ResultsSummary after a specified build which is either FINISHED or can be FINISHED, i.e.
 ResultsSummary findFirstSuccessfulBuildResultAfter(java.lang.String buildKey, int buildNumber)
          Finds the last successful BuildResultsSummary after buildNumber
 java.util.List<LinkedJiraIssue> findJiraIssuesForPlan(Plan plan)
          Retrieves a list of LinkedJiraIssue linked to the given Plan
 java.util.List<LinkedJiraIssue> findJiraIssuesForResults(java.util.List<ResultsSummary> buildResults)
          Retrieves a list of LinkedJiraIssue linked to the given build result summaries
 ResultsSummary findLastBuildResultBefore(java.lang.String buildKey, int buildNumber)
          Finds the last successful or failing BuildResultsSummary before buildNumber
<T extends ResultsSummary>
T
findLastBuildResultBeforeWithTests(PlanResultKey planResultKey, java.lang.Class<T> aClass)
          Finds the last successful or failing BuildResultsSummary before buildNumber
 ResultsSummary findLastFailingBuildResultBefore(Plan build, int buildNumber)
          Finds the last failing BuildResultsSummary before buildNumber
<T extends ResultsSummary>
T
findLastResultBefore(PlanResultKey planResultKey, java.lang.Class<T> aClass)
          Finds the last successful or failing ResultsSummary before planResultKey.getBuildNumber
<T extends ResultsSummary>
T
findLastResultSummaryWithState(PlanKey planKey, BuildState buildState, java.lang.Class<T> aClass)
           
 ResultsSummary findLastSuccessfulBuildResultBefore(Plan build, int buildNumber)
          Finds the last successful BuildResultsSummary before buildNumber
 java.util.List<? extends ResultsSummary> findResultsSummariesByJiraIssues(java.util.List<java.lang.String> issueKeys)
          Finds a list of results which are linked to the given issue keys
 java.util.List<? extends ResultsSummary> findResultsSummariesByProjectKey(java.lang.String projectKey)
          Provide a list of results which are linked to any issues under the given jira project key
<T extends ResultsSummary>
java.util.Collection<T>
getAllActiveResultSummariesForPlan(PlanKey planKey, java.lang.Class<T> aClass)
          Returns all the ResultsSummary in a LifeCycleState.IN_PROGRESS state
 java.util.List<BuildResultsSummary> getAllBuildResultsSummariesForAgent(java.lang.Long agentId)
          Returns all BuildResultsSummary for the passed BuildAgent's id.
<T extends ResultsSummary>
java.util.Collection<T>
getAllBuildResultSummariesInUnknownState(java.lang.Class<T> aClass)
          Returns all the BuildResultsSummary in a BuildState.UNKNOWN state
<T extends ResultsSummary>
java.util.Collection<T>
getAllInProgressResultSummaries(java.lang.Class<T> aClass)
          Returns all the ResultsSummary in a LifeCycleState.IN_PROGRESS state
<T extends ResultsSummary>
java.util.Collection<T>
getAllPendingResultSummaries(java.lang.Class<T> aClass)
          Returns all the ResultsSummary in a LifeCycleState.PENDING state
<T extends ResultsSummary>
java.util.Collection<T>
getAllQueuedResultSummaries(java.lang.Class<T> aClass)
          Returns all the ResultsSummary in a LifeCycleState.QUEUED state
<T extends ResultsSummary>
java.util.List<T>
getAllResultSummariesForPlan(Plan plan)
          Deprecated. since 3.1 use getResultSummaries(ResultsSummaryCriteria)
 long getAveragePlanExecutionDuration(Plan plan, int numberOfResults)
          Get average duration from n last results summaries in finished state for a plan.
 ResultsSummary getBreakingBuild(ResultsSummary buildResultsSummary)
          Returns the first failing build after the last successful build.
 ChainStageResult getChainStageResultById(java.lang.Long id)
          Returns a ChainStageResult by its id
 java.util.List<UnassociatedCommit> getCommitsForUser(java.lang.String username, int max)
          Retrieve a list of recent Commits for the given user.
<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.
 ResultsSummary getFixingBuild(ResultsSummary buildResultsSummary)
          Returns the first successful ResultsSummary for given ResultsSummary.
 java.util.List<BuildResultsSummary> getLastNBuildResultsSummaries(Buildable buildable, int numberOfResults)
          Deprecated. since 2.7 use getLastNResultsSummaries instead
 java.util.List<ResultsSummary> getLastNFailedResultsSummaries(Plan build, int numberOfResults)
          Returns the most recent n failed build results.
 java.util.List<ResultsSummary> getLastNResultsSummaries(Plan plan, int numberOfResults)
          Provides a list of the latest N results summaries for the given plan, newest first.
<T extends ResultsSummary>
T
getLastResultsSummary(java.lang.String planKey, java.lang.Class<T> aClass)
          Get the last ResultsSummary for planKey and Class
 ResultsSummary getLastSuccessfulResultSummary(PlanKey planKey)
          Get the last successful ResultsSummary for planKey
 java.util.List<ResultsSummary> getLatestFailedResultSummaries()
          Retrieve list of failed build results (for all builds) in the last few days (number of days is specified in the DAO) This method is filtered to remove results that user doesn't have permission to see
 java.util.List<ResultsSummary> getLatestResultSummaries()
          Retrieve list of build results (for all builds) in the last few days (number of days is specified in the DAO) This method is filtered to remove results that user doesn't have permission to see
 java.util.List<BuildResultsSummary> getLatestSummariesForAgent(java.lang.Long agentId, java.util.Date fromDate)
          Retrieves build summaries for agent id not older than certain date.
 java.util.List<BuildResultsSummary> getLatestSummariesForAgent(java.lang.Long agentId, int maxCount)
          Retrieves n last build summaries for agent.
 BuildResultsSummary getLatestSummaryForAgent(long agentId)
           
 java.util.List<ResultsSummary> getNeighbouringSummaries(ImmutablePlan plan, int buildNumber, int neighbouringSummariesMaxCount)
          Returns all the ResultsSummary objects that matches the passed build numbers
 java.util.List<ResultsSummary> getNeighbouringSummaries(Plan plan, int buildNumber)
          Returns all the ResultsSummary objects that matches the passed build numbers
 int getNumberOfConcurrentlyRunningBuilds(PlanKey planKey)
          Gets the number of concurrently running builds
 long getNumberOfFinalizedResults(Plan plan)
          Get number of the ResultsSummarys in a LifeCycleState.FINISHED or LifeCycleState.NOT_BUILT state for the given Plan
 long getNumberOfFinishedResults(Plan plan)
          Get number of the ResultsSummarys in LifeCycleState.FINISHED state for the given Plan
 ChainResultsSummary getParentResultSummary(ResultsSummary resultsSummary)
          Get (@link ChainResultsSummary} containing given ResultsSummary
 ResultsSummary getResultsSummary(PlanResultKey planResultKey)
          Lookup the ResultsSummary by PlanResultKey
<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.
 ResultsSummary getResultsSummary(PlanResultKey planResultKey, ResultDataRead dataRead)
          Lookup the ResultsSummary by PlanResultKey.
<T extends ResultsSummary>
java.util.List<T>
getResultSummaries(ResultsSummaryCriteria criteria)
          Generic search to find any result summaries bases on the criteria provided.
<T extends ResultsSummary>
java.util.List<ResultWithPlanInfo<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>
getResultSummariesForPlan(ImmutablePlan plan, int firstResult, int maxResults)
          Get the ResultsSummarys for the given Plan in any LifeCycleState.
<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
 void logSubstitutedVariables(BuildContext buildContext, ResultsSummary resultsSummary)
          Adds variable substitution result to ResultsSummary This method logs substitution after it was performed and will use only REALLY substituted values
 void logVariablesForSubstitution(BuildContext buildContext, ResultsSummary resultsSummary)
          Adds expected variable substitution to ResultsSummary This method logs substitution before build was performed and is used basically to log substitution against plan result as there will be no possibility to track it afterwards
 int markResultSummariesForDeletion(PlanKey planKey)
          Mass update of all ResultsSummary records in the database related to a Plan identified by planKey.
 void moveResultSummaries(PlanKey oldPlanKey, PlanKey newPlanKey)
          Deprecated. since 3.2, use $moveResultSummaries(Plan, PlanKey, PlanKey)
 void moveResultSummaries(Plan newParentPlan, PlanKey oldPlanKey, PlanKey newPlanKey)
          Reassigns plan key ResultsSummaries associated with selected plan key.
 int removeAllOrphanedResultSummaries()
          Removes all the ResultsSummary objects in the database that do not have a matching Plan
 void removeArtifacts(Plan plan, int buildNumber)
          Remove any artifacts stored for this plan result
 void removeBuildLogs(Plan plan, int buildNumber)
          Remove any build logs stored for this plan result
 void removeMatchingArtifacts(ResultsSummary resultsSummary, com.google.common.base.Predicate<ArtifactLink> predicate)
          Remove artifacts from results summary that match a predicate.
 int removeResultsSummariesForPlan(Plan plan)
          Remove all resultSummary objects for the given plan.
 void removeResultSummary(Plan plan, int buildNumber)
          Remove plan result summary and all associated objects.
 void saveResultSummary(ResultsSummary resultsSummary)
          Saves the ResultsSummary
 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.
 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.
 void updateCancelledDetails(ResultsSummary resultsSummary)
          Marks ResultSummary as cancelled
 void updateLifeCycleState(BuildContext buildContext, LifeCycleState lifeCycleState, BuildState buildState)
          Update LifeCycleState and saves the ResultsSummary for given BuildContext Updates also timing information
 void updateLifeCycleState(ResultsSummary resultsSummary, LifeCycleState lifeCycleState, BuildState buildState)
          Update LifeCycleState and saves the given ResultsSummary
 void updatePlanCompletedDate(ChainResultsSummary resultsSummary, java.util.Date completionDate)
          Update completed date and duration of ChainResultsSummary
 void updateProcessingDuration(ChainResultsSummary resultSummary)
          Updates ResultsSummary.getProcessingDuration() and ChainStageResult.getProcessingDuration() based on chain execution.
 

Method Detail

createResultsSummary

<T extends ResultsSummary> T createResultsSummary(@NotNull
                                                  BuildContext buildContext,
                                                  @NotNull
                                                  java.lang.Class<T> aClass)
                                              throws ResultsSummaryCreationException
Creates a ResultsSummary of the given Class

Type Parameters:
T -
Parameters:
buildContext -
aClass -
Returns:
resultsSummary
Throws:
ResultsSummaryCreationException

getResultsSummary

@Nullable
ResultsSummary getResultsSummary(@NotNull
                                          PlanResultKey planResultKey)
Lookup the ResultsSummary by PlanResultKey

Parameters:
planResultKey -
Returns:
resultsSummary

getResultsSummary

@Nullable
ResultsSummary getResultsSummary(@NotNull
                                          PlanResultKey planResultKey,
                                          ResultDataRead dataRead)
Lookup the ResultsSummary by PlanResultKey. All lazy initialized collections can be eagerly fetched to avoid session problems. Use with caution - expensive call

Parameters:
planResultKey -
dataRead -
Returns:
resultsSummary

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 fetched to avoid session problems. Use with caution - expensive call

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

updateLifeCycleState

void updateLifeCycleState(@NotNull
                          ResultsSummary resultsSummary,
                          @NotNull
                          LifeCycleState lifeCycleState,
                          @NotNull
                          BuildState buildState)
Update LifeCycleState and saves the given ResultsSummary

Parameters:
resultsSummary - ResultsSummary to be updated and saved
lifeCycleState - LifeCycleState to be set
buildState - BuildState to be set

updateLifeCycleState

void updateLifeCycleState(@NotNull
                          BuildContext buildContext,
                          @NotNull
                          LifeCycleState lifeCycleState,
                          @NotNull
                          BuildState buildState)
Update LifeCycleState and saves the ResultsSummary for given BuildContext Updates also timing information

Parameters:
buildContext - BuildContext used to get information on ResultsSummary
lifeCycleState - LifeCycleState to be set
buildState - BuildState to be set

updatePlanCompletedDate

void updatePlanCompletedDate(@NotNull
                             ChainResultsSummary resultsSummary,
                             @NotNull
                             java.util.Date completionDate)
Update completed date and duration of ChainResultsSummary

Parameters:
resultsSummary -
completionDate -

calculateAndSetDeltaState

void calculateAndSetDeltaState(ResultsSummary resultsSummary)
Figures out the delta state for the provided results summary, if a 'fixing' build will also calculate how long it took to fix. This method only updates the values on the provided results summary object, it does not save it to the database. Assumes buildState has already been set on resultsSummary.

Parameters:
resultsSummary - to update

saveResultSummary

void saveResultSummary(@NotNull
                       ResultsSummary resultsSummary)
Saves the ResultsSummary

Parameters:
resultsSummary -

getAllPendingResultSummaries

@NotNull
<T extends ResultsSummary> java.util.Collection<T> getAllPendingResultSummaries(java.lang.Class<T> aClass)
Returns all the ResultsSummary in a LifeCycleState.PENDING state

Returns:
pendingSummaries

getAllQueuedResultSummaries

@NotNull
<T extends ResultsSummary> java.util.Collection<T> getAllQueuedResultSummaries(java.lang.Class<T> aClass)
Returns all the ResultsSummary in a LifeCycleState.QUEUED state

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

Parameters:
aClass -
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.IN_PROGRESS state

Parameters:
aClass -
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. Results 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:

getNeighbouringSummaries

@NotNull
java.util.List<ResultsSummary> getNeighbouringSummaries(Plan plan,
                                                                int buildNumber)
Returns all the ResultsSummary objects that matches the passed build numbers

Parameters:
plan -
buildNumber -
Returns:
List of BuildResultsSummary

getNeighbouringSummaries

@NotNull
java.util.List<ResultsSummary> getNeighbouringSummaries(ImmutablePlan plan,
                                                                int buildNumber,
                                                                int neighbouringSummariesMaxCount)
Returns all the ResultsSummary objects that matches the passed build numbers

Parameters:
plan -
buildNumber -
neighbouringSummariesMaxCount -
Returns:
List of BuildResultsSummary

getNumberOfConcurrentlyRunningBuilds

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

Parameters:
planKey -
Returns:

getAllBuildResultSummariesInUnknownState

@NotNull
<T extends ResultsSummary> java.util.Collection<T> getAllBuildResultSummariesInUnknownState(java.lang.Class<T> aClass)
Returns all the BuildResultsSummary in a BuildState.UNKNOWN state

Returns:
summaries

findLastResultBefore

@Nullable
<T extends ResultsSummary> T findLastResultBefore(@NotNull
                                                           PlanResultKey planResultKey,
                                                           java.lang.Class<T> aClass)
Finds the last successful or failing ResultsSummary before planResultKey.getBuildNumber

Parameters:
planResultKey -
aClass -
Returns:

getChainStageResultById

@Nullable
ChainStageResult getChainStageResultById(@NotNull
                                                  java.lang.Long id)
Returns a ChainStageResult by its id

Returns:
chainStageResult

getAllResultSummariesForPlan

@NotNull
@Deprecated
<T extends ResultsSummary> java.util.List<T> getAllResultSummariesForPlan(@NotNull
                                                                                             Plan plan)
Deprecated. since 3.1 use getResultSummaries(ResultsSummaryCriteria)

Get all the ResultsSummarys for the given Plan. This can be thousands of objects or just a few. Avoid using this method at all costs.

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

getNumberOfFinishedResults

long getNumberOfFinishedResults(@NotNull
                                Plan plan)
Get number of the ResultsSummarys in LifeCycleState.FINISHED state for the given Plan

Parameters:
plan -
Returns:
number of summaries

getNumberOfFinalizedResults

long getNumberOfFinalizedResults(@NotNull
                                 Plan 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

getResultSummariesForPlan

@NotNull
<T extends ResultsSummary> java.util.List<T> getResultSummariesForPlan(@NotNull
                                                                               ImmutablePlan plan,
                                                                               int firstResult,
                                                                               int maxResults)
Get the ResultsSummarys for the given Plan in any LifeCycleState. Results are sorted by build number (descending). User can skip first n result and request maximum number of results.

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

getAveragePlanExecutionDuration

long getAveragePlanExecutionDuration(@NotNull
                                     Plan plan,
                                     int numberOfResults)
Get average duration from n last results summaries in finished state for a plan. Results in SUCCESSFUL state are preferred; only if there are none those in FAILED state are selected.

Parameters:
plan -
numberOfResults - amount of results to be taken into account for average calculation
Returns:
average duration in milliseconds or 0 if there is no results

getLastResultsSummary

<T extends ResultsSummary> T getLastResultsSummary(@NotNull
                                                   java.lang.String planKey,
                                                   java.lang.Class<T> aClass)
Get the last ResultsSummary for planKey and Class

Type Parameters:
T -
Parameters:
planKey -
aClass -
Returns:

getLastSuccessfulResultSummary

@Nullable
ResultsSummary getLastSuccessfulResultSummary(@NotNull
                                                       PlanKey planKey)
Get the last successful ResultsSummary for planKey

Parameters:
planKey -
Returns:

removeResultsSummariesForPlan

int removeResultsSummariesForPlan(Plan plan)
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(Plan) should be considered.

Parameters:
plan - to remove results for.
Returns:
number of ResultsSummarys removed

removeAllOrphanedResultSummaries

int removeAllOrphanedResultSummaries()
Removes all the ResultsSummary objects in the database that do not have a matching Plan

Returns:
number of ResultsSummarys removed

findFirstFailedBuildResultAfter

@Nullable
ResultsSummary findFirstFailedBuildResultAfter(@NotNull
                                                        java.lang.String buildKey,
                                                        int buildNumber)
Finds the first failed ResultsSummary after buildNumber

Parameters:
buildKey -
buildNumber -
Returns:
buildResult

findFirstSuccessfulBuildResultAfter

@Nullable
ResultsSummary findFirstSuccessfulBuildResultAfter(@NotNull
                                                            java.lang.String buildKey,
                                                            int buildNumber)
Finds the last successful BuildResultsSummary after buildNumber

Parameters:
buildKey -
buildNumber -
Returns:
buildResult

findLastSuccessfulBuildResultBefore

@Nullable
ResultsSummary findLastSuccessfulBuildResultBefore(@NotNull
                                                            Plan build,
                                                            int buildNumber)
Finds the last successful BuildResultsSummary before buildNumber

Parameters:
build -
buildNumber -
Returns:
buildResult

findLastFailingBuildResultBefore

@Nullable
ResultsSummary findLastFailingBuildResultBefore(@NotNull
                                                         Plan build,
                                                         int buildNumber)
Finds the last failing BuildResultsSummary before buildNumber

Parameters:
build -
buildNumber -
Returns:
buildResult

findFirstFailedBuildResultBetween

@Nullable
ResultsSummary findFirstFailedBuildResultBetween(@NotNull
                                                          Plan build,
                                                          int lowerBuildNumber,
                                                          int upperBuildNumber)
Finds the first failed build between the upper and lower build numbers inclusively.

Parameters:
build -
lowerBuildNumber -
upperBuildNumber -
Returns:
buildResults

findLastBuildResultBefore

@Nullable
ResultsSummary findLastBuildResultBefore(@NotNull
                                                  java.lang.String buildKey,
                                                  int buildNumber)
Finds the last successful or failing BuildResultsSummary before buildNumber

Parameters:
buildKey -
buildNumber -
Returns:

findLastBuildResultBeforeWithTests

@Nullable
<T extends ResultsSummary> T findLastBuildResultBeforeWithTests(@NotNull
                                                                         PlanResultKey planResultKey,
                                                                         @NotNull
                                                                         java.lang.Class<T> aClass)
Finds the last successful or failing BuildResultsSummary before buildNumber

Parameters:
planResultKey -
aClass -
Returns:
resultsSummary

getBreakingBuild

@Nullable
ResultsSummary getBreakingBuild(ResultsSummary buildResultsSummary)
Returns the first failing build after the last successful build. ie the latest build before this one with the delta state "broken"

Parameters:
buildResultsSummary - of the current build
Returns:
null if there is no breaking build.

getFixingBuild

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

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

updateCancelledDetails

void updateCancelledDetails(@NotNull
                            ResultsSummary resultsSummary)
Marks ResultSummary as cancelled

Parameters:
resultsSummary - results summary

getLatestResultSummaries

java.util.List<ResultsSummary> getLatestResultSummaries()
Retrieve list of build results (for all builds) in the last few days (number of days is specified in the DAO) This method is filtered to remove results that user doesn't have permission to see

Returns:
List of ResultsSummary

getLatestFailedResultSummaries

java.util.List<ResultsSummary> getLatestFailedResultSummaries()
Retrieve list of failed build results (for all builds) in the last few days (number of days is specified in the DAO) This method is filtered to remove results that user doesn't have permission to see

Returns:
List of ResultsSummary

getLastNResultsSummaries

@NotNull
java.util.List<ResultsSummary> getLastNResultsSummaries(@NotNull
                                                                Plan plan,
                                                                int numberOfResults)
Provides a list of the latest N results summaries for the given plan, newest first.

Parameters:
plan - - to get the results for
numberOfResults - - number of summaries you would like
Returns:
list.

getLastNFailedResultsSummaries

@NotNull
java.util.List<ResultsSummary> getLastNFailedResultsSummaries(@NotNull
                                                                      Plan build,
                                                                      int numberOfResults)
Returns the most recent n failed build results. Sorted by newest first.

Parameters:
build -
numberOfResults - must be > 0
Returns:

getLastNBuildResultsSummaries

@NotNull
@Deprecated
java.util.List<BuildResultsSummary> getLastNBuildResultsSummaries(@NotNull
                                                                                     Buildable buildable,
                                                                                     int numberOfResults)
Deprecated. since 2.7 use getLastNResultsSummaries instead

Returns the most recent n build results. Sorted by newest first.

Parameters:
buildable -
numberOfResults - must be > 0 @return
Returns:
the most recent n build results. Sorted by newest first.

getResultSummaries

@NotNull
<T extends ResultsSummary> java.util.List<T> getResultSummaries(@NotNull
                                                                        ResultsSummaryCriteria criteria)
Generic search to find any result summaries bases on the criteria provided.

Parameters:
criteria - containing all the search constraints
Returns:
list of resultsSummaries matching the criteria.

findJiraIssuesForResults

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

Parameters:
buildResults - to look for issues attached to
Returns:
a list of LinkedJiraIssue linked to the given build result summaries

findJiraIssuesForPlan

@NotNull
java.util.List<LinkedJiraIssue> findJiraIssuesForPlan(@NotNull
                                                              Plan plan)
Retrieves a list of LinkedJiraIssue linked to the given Plan

Parameters:
plan - to look for issues associated with
Returns:
a list of LinkedJiraIssue linked to the given Plan

findResultsSummariesByJiraIssues

@NotNull
java.util.List<? extends ResultsSummary> findResultsSummariesByJiraIssues(@Nullable
                                                                                  java.util.List<java.lang.String> issueKeys)
Finds a list of results which are linked to the given issue keys

Parameters:
issueKeys - to search for
Returns:
al list of ResultsSummary associated with any of the given list of issue keys

findResultsSummariesByProjectKey

@NotNull
java.util.List<? extends ResultsSummary> findResultsSummariesByProjectKey(@Nullable
                                                                                  java.lang.String projectKey)
Provide a list of results which are linked to any issues under the given jira project key

Parameters:
projectKey - - jira project key
Returns:
a list of results which are linked to any issues under the given jira project key

getAllBuildResultsSummariesForAgent

@NotNull
java.util.List<BuildResultsSummary> getAllBuildResultsSummariesForAgent(@NotNull
                                                                                java.lang.Long agentId)
Returns all BuildResultsSummary for the passed BuildAgent's id.

Parameters:
agentId - id of the agent to get the result summaries for
Returns:
all BuildResultsSummary for the passed BuildAgent's id.

getLatestSummariesForAgent

@NotNull
java.util.List<BuildResultsSummary> getLatestSummariesForAgent(@NotNull
                                                                       java.lang.Long agentId,
                                                                       @NotNull
                                                                       java.util.Date fromDate)
Retrieves build summaries for agent id not older than certain date.

Parameters:
agentId - id of an agent
fromDate - beginning of the search period
Returns:
List of BuildResultsSummary

getLatestSummariesForAgent

@NotNull
java.util.List<BuildResultsSummary> getLatestSummariesForAgent(@NotNull
                                                                       java.lang.Long agentId,
                                                                       int maxCount)
Retrieves n last build summaries for agent.

Parameters:
agentId - id of an agent
maxCount - maximum number of elements to retrieve
Returns:
List of BuildResultsSummary

getLatestSummaryForAgent

@Nullable
BuildResultsSummary getLatestSummaryForAgent(long agentId)

getParentResultSummary

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

Parameters:
resultsSummary -
Returns:

getStageForResult

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

Parameters:
resultsSummary -
Returns:

removeResultSummary

void removeResultSummary(@NotNull
                         Plan plan,
                         int buildNumber)
Remove plan result summary and all associated objects.

Parameters:
plan -
buildNumber -

removeArtifacts

void removeArtifacts(Plan plan,
                     int buildNumber)
Remove any artifacts stored for this plan result

Parameters:
plan -
buildNumber -

removeMatchingArtifacts

void removeMatchingArtifacts(@NotNull
                             ResultsSummary resultsSummary,
                             @NotNull
                             com.google.common.base.Predicate<ArtifactLink> predicate)
Remove artifacts from results summary that match a predicate.

Parameters:
resultsSummary -
predicate -

removeBuildLogs

void removeBuildLogs(Plan plan,
                     int buildNumber)
Remove any build logs stored for this plan result

Parameters:
plan -
buildNumber -

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 consistant 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

    moveResultSummaries

    @Deprecated
    void moveResultSummaries(PlanKey oldPlanKey,
                                        PlanKey newPlanKey)
    Deprecated. since 3.2, use $moveResultSummaries(Plan, PlanKey, PlanKey)

    Reassigns plan key ResultsSummaries associated with selected plan key.


    moveResultSummaries

    void moveResultSummaries(@NotNull
                             Plan newParentPlan,
                             @NotNull
                             PlanKey oldPlanKey,
                             @NotNull
                             PlanKey newPlanKey)
    Reassigns plan key ResultsSummaries associated with selected plan key.

    Parameters:
    newParentPlan - the new parent plan of result summaries. This should be a plan, not a job.

    scrollResultSummaries

    long scrollResultSummaries(@NotNull
                               java.lang.String buildKey,
                               @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
    Returns:
    number of traversed rows

    scrollResultSummaries

    long scrollResultSummaries(@NotNull
                               java.lang.String buildKey,
                               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
    resultDataRead - if the data should be loaded lazy or eagerly
    function - function to be executed on each of the BuildResultSummary
    Returns:
    number of traversed rows

    findFirstResultAfter

    @Nullable
    <T extends ResultsSummary> T findFirstResultAfter(@NotNull
                                                               PlanResultKey planResultKey,
                                                               java.lang.Class<T> aClass)
    Finds the first ResultsSummary after a specified build which is either FINISHED or can be FINISHED, i.e. is not in NOT_BUILT state.

    Parameters:
    planResultKey -
    aClass -
    Returns:

    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

    getResultSummariesByChangeSetId

    @NotNull
    <T extends ResultsSummary> java.util.List<ResultWithPlanInfo<T>> getResultSummariesByChangeSetId(@NotNull
                                                                                                             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. Build results are returned with plan identification information for display purposes N.B. plan info will only work for top level plans

    Type Parameters:
    T - extends ResultSummary
    Parameters:
    changeSetId - of the commit
    discriminator - class of the ResultSummary interface required
    Returns:
    List of ResultWithPlanInfo (ResultSummary as determined by discriminator, and plan details) containing a commit with the given changeSetId

    getCommitsForUser

    @NotNull
    java.util.List<UnassociatedCommit> getCommitsForUser(@NotNull
                                                                 java.lang.String username,
                                                                 int max)
    Retrieve a list of recent Commits for the given user. Items in the collection are unique and sorted by date.

    Parameters:
    username - to filter commits by
    max - maximum number of commits to get.
    Returns:
    a list of recent Commits for the given user

    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

    logVariablesForSubstitution

    void logVariablesForSubstitution(@NotNull
                                     BuildContext buildContext,
                                     @NotNull
                                     ResultsSummary resultsSummary)
    Adds expected variable substitution to ResultsSummary This method logs substitution before build was performed and is used basically to log substitution against plan result as there will be no possibility to track it afterwards


    logSubstitutedVariables

    void logSubstitutedVariables(@NotNull
                                 BuildContext buildContext,
                                 @NotNull
                                 ResultsSummary resultsSummary)
    Adds variable substitution result to ResultsSummary This method logs substitution after it was performed and will use only REALLY substituted values


    updateProcessingDuration

    void updateProcessingDuration(ChainResultsSummary resultSummary)
    Updates ResultsSummary.getProcessingDuration() and ChainStageResult.getProcessingDuration() based on chain execution.

    Parameters:
    resultSummary -

    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 © 2012 Atlassian. All Rights Reserved.