Class BuildResultsSummaryManagerImpl
- java.lang.Object
-
- com.atlassian.bamboo.resultsummary.BuildResultsSummaryManagerImpl
-
- All Implemented Interfaces:
BuildResultsSummaryManager
,ResultsSummaryManager
public class BuildResultsSummaryManagerImpl extends Object implements BuildResultsSummaryManager, ResultsSummaryManager
-
-
Constructor Summary
Constructors Constructor Description BuildResultsSummaryManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addVariableContextSnapshotToResultSummary(@NotNull ResultsSummary resultsSummary, @NotNull VariableContext variableContext)
Adds state of global and plan variables to result at the beginning of execution.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.@Nullable Long
calculateQueueDuration(@NotNull ChainResultsSummary resultsSummary)
Calculates queueDuration value for a chain result as a maximum value of (vcsUpdateTime - queueTime) for all related job results.@Nullable Long
calculateVcsUpdateDuration(@NotNull ChainResultsSummary resultsSummary)
Calculates vcsUpdateDuration value for a chain result as a maximum value of (buildDate - vcsUpdateTime) for all related job results.void
cleanPendingLifeCycleState(@NotNull PlanResultKey planResultKey)
Cleans state of pending result.void
clearVariablesOnRerunBuild(@NotNull ResultsSummary resultsSummary)
Clear stored stage manual variables when build is fully rerun.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.<T extends ResultsSummary>
TcreateResultsSummary(@NotNull BuildContext buildContext, @NotNull Class<T> aClass)
Creates aResultsSummary
of the givenClass
<T extends ResultsSummary>
TcreateResultsSummary(@Nullable ChainResultsSummary chainResultsSummary, @NotNull BuildContext buildContext, @NotNull Class<T> aClass)
@NotNull List<Integer>
findAllBuildResultsNumbers(PlanKey planKey)
@NotNull Range<Integer>
findBuildResultNumbersRange(@NotNull PlanKey planKey)
Finds minimum and maximum build number for a plan.@NotNull List<PlanResultKey>
findChainResultsWithFormatVersionLessThan(int formatVersion, int maxResults)
List<ChainResultsSummary>
findChainResultsWithJobLabelled(ResultsSummaryCriteria criteria, List<Label> labels)
Searches through all chains to find any that have jobs which match the given labels.@Nullable ResultsSummary
findFirstFailedBuildResultAfter(@NotNull String buildKey, int buildNumber)
Finds the first failedResultsSummary
after buildNumber@Nullable ResultsSummary
findFirstFailedBuildResultBetween(@NotNull ImmutablePlan build, int lowerBuildNumber, int upperBuildNumber)
Finds the first failed build between the upper and lower build numbers inclusively.@Nullable ResultsSummary
findFirstFailedBuildResultBetween(@NotNull PlanKey planKey, int lowerBuildNumber, int upperBuildNumber)
Finds the first failed build between the upper and lower build numbers inclusively.*<T extends ResultsSummary>
TfindFirstResultAfter(@NotNull PlanResultKey planResultKey, Class<T> aClass)
Finds the firstResultsSummary
after a specified build which is either FINISHED or can be FINISHED, i.e.@Nullable ResultsSummary
findFirstSuccessfulBuildResultAfter(@NotNull PlanResultKey planResultKey)
Finds the last successfulResultsSummary
after buildNumber@NotNull List<LinkedJiraIssue>
findJiraIssuesForPlanKey(@NotNull PlanKey planKey)
Retrieves a list ofLinkedJiraIssue
linked to the given plan key@NotNull List<LinkedJiraIssue>
findJiraIssuesForResults(@NotNull List<ResultsSummary> buildResults)
Retrieves a list ofLinkedJiraIssue
linked to the given build result summaries@NotNull List<PlanKey>
findJobKeysFromExistingChainResults(@NotNull PlanKey chainKey)
Find keys of jobs for which results associated with given plan exist.@Nullable ResultsSummary
findLastBuildResultBefore(@NotNull String buildKey, int buildNumber)
Finds the last successful or failingBuildResultsSummary
before buildNumber<T extends ResultsSummary>
TfindLastBuildResultBeforeWithTests(@NotNull PlanResultKey planResultKey, @NotNull Class<T> aClass, boolean includeOnceOffBuilds)
Finds the last successful or failingBuildResultsSummary
before buildNumber@Nullable ResultsSummary
findLastFailingBuildResultBefore(@NotNull ImmutablePlan build, int buildNumber)
Finds the last failingResultsSummary
before buildNumber@Nullable ResultsSummary
findLastFailingBuildResultBefore(@NotNull PlanKey planKey, int buildNumber)
Finds the last failingResultsSummary
before buildNumber<T extends ResultsSummary>
TfindLastResultBefore(@NotNull PlanResultKey planResultKey, Class<T> aClass)
Finds the last successful or failingResultsSummary
before planResultKey.getBuildNumber<T extends ResultsSummary>
TfindLastResultBefore(@NotNull PlanResultKey planResultKey, Class<T> aClass, boolean includeOnceOffBuilds)
Finds the lastResultsSummary
before planResultKey.getBuildNumber<T extends ResultsSummary>
TfindLastResultSummaryWithState(@NotNull PlanKey planKey, @NotNull BuildState buildState, @NotNull Class<T> aClass)
<T extends ResultsSummary>
TfindLastResultSummaryWithState(@NotNull PlanKey planKey, @NotNull BuildState buildState, @NotNull Class<T> aClass, boolean ignoreSpecsResults)
@Nullable ResultsSummary
findLastSuccessfulBuildResultBefore(@NotNull PlanResultKey planResultKey)
Finds the last successfulResultsSummary
before build@Nullable ResultsSummary
findLastSuccessfulBuildResultBefore(@NotNull PlanResultKey planResultKey, boolean includeOnceOffBuilds)
Finds the last successfulResultsSummary
before buildint
findMinimumBuildNumberForNLatest(@NotNull PlanKey planKey, int n)
Find a build number for which exist n non-specs results with a build number greater or equal.@NotNull List<? extends ResultsSummary>
findResultsSummariesByJiraIssues(@Nullable List<String> issueKeys)
Finds a list of results which are linked to the given issue keys@NotNull List<? extends ResultsSummary>
findResultsSummariesByProjectKey(@Nullable String projectKey)
Provide a list of results which are linked to any issues under the given jira project key@NotNull List<ResultsSummary>
getAfterSummaries(@NotNull ImmutablePlan plan, int buildNumber, int maxCount)
Returns all theResultsSummary
objects that represent build results strictly after the given build number.<T extends ResultsSummary>
@NotNull Collection<T>getAllActiveResultSummariesForPlan(PlanKey planKey, Class<T> aClass)
Returns all theResultsSummary
in aLifeCycleState.IN_PROGRESS
state<T extends ResultsSummary>
@NotNull Collection<T>getAllBuildResultSummariesInUnknownState(Class<T> aClass)
Returns all theBuildResultsSummary
in aBuildState.UNKNOWN
state<T extends ResultsSummary>
@NotNull Collection<T>getAllInProgressResultSummaries(Class<T> aClass)
Returns all theResultsSummary
in aLifeCycleState.IN_PROGRESS
state<T extends ResultsSummary>
@NotNull Collection<T>getAllPendingResultSummaries(Class<T> aClass)
Returns all theResultsSummary
in aLifeCycleState.PENDING
state<T extends ResultsSummary>
@NotNull Collection<T>getAllQueuedResultSummaries(Class<T> aClass)
Returns all theResultsSummary
in aLifeCycleState.QUEUED
state<T extends ResultsSummary>
TgetAnyResultSummary(@NotNull ResultsSummaryCriteria criteria, ResultDataRead dataRead)
Generic search to find any result summary basing on the criteria provided.long
getAverageBuildTime(@NotNull ImmutableBuildable plan, int numberOfResults)
Returns average build duration for given number of buildslong
getAveragePlanExecutionDuration(@NotNull ImmutablePlan plan, int numberOfResults)
Get average duration from n last results summaries in finished state for a plan.@NotNull List<ResultsSummary>
getBeforeSummaries(@NotNull ImmutablePlan plan, int buildNumber, int maxCount)
Returns all theResultsSummary
objects that represent build results strictly before the given build number.@Nullable ResultsSummary
getBreakingBuild(ResultsSummary buildResultsSummary)
Returns the first failing build after the last successful build.@Nullable ChainStageResult
getChainStageResultById(@NotNull Long id)
Returns aChainStageResult
by its id@NotNull List<UnassociatedCommit>
getCommitsForUser(@NotNull String username, int max)
Retrieve a list of recent Commits for the given user.<T extends ResultsSummary>
@NotNull List<T>getFinalizedResultSummariesForPlan(PlanKey planKey, Class<T> aClass, int firstResult, int maxResults)
Returns all theResultsSummary
in aLifeCycleState.FINISHED
orLifeCycleState.NOT_BUILT
state with the givenClass
.@Nullable ResultsSummary
getFixingBuild(ResultsSummary buildResultsSummary)
Returns the first successfulResultsSummary
for givenResultsSummary
.@NotNull List<ResultsSummary>
getLastNFailedResultsSummaries(@NotNull PlanIdentifier planIdentifier, int numberOfResults)
Returns the most recent n failed build results.@NotNull List<ResultsSummary>
getLastNResultsSummaries(@NotNull PlanIdentifier planIdentifier, int numberOfResults)
Provides a list of the latest N results summaries for the given plan, newest first.<T extends ResultsSummary>
TgetLastResultsSummary(@NotNull String planKey, Class<T> aClass)
Get the lastResultsSummary
for planKey andClass
<T extends ResultsSummary>
TgetLastResultsSummary(@NotNull String planKey, Class<T> aClass, boolean ignoreSpecsResults)
Get the lastResultsSummary
for planKey andClass
with possible skip of specs results.ResultsSummary
getLastSuccessfulResultSummary(@NotNull PlanKey planKey)
Get the last successfulResultsSummary
for planKeyList<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 seeList<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@NotNull List<ResultsSummary>
getNeighbouringSummaries(@NotNull ImmutablePlan plan, int buildNumber, int maxCount)
Returns all theResultsSummary
objects that represent build results "around" the given build number.@NotNull List<ResultsSummary>
getNeighbouringSummaries(Plan plan, int buildNumber)
Returns all theResultsSummary
objects that matches the passed build numbersint
getNumberOfConcurrentlyRunningBuilds(PlanKey planKey)
Gets the number of concurrently running buildslong
getNumberOfFinalizedResults(@NotNull ImmutablePlan plan)
Get number of theResultsSummary
s in aLifeCycleState.FINISHED
orLifeCycleState.NOT_BUILT
state for the givenPlan
long
getNumberOfFinalizedResults(@NotNull PlanKey planKey)
Get number of theResultsSummary
s in aLifeCycleState.FINISHED
orLifeCycleState.NOT_BUILT
state for the givenPlan
long
getNumberOfFinishedResults(@NotNull Plan plan)
long
getNumberOfResults()
Get number of allResultsSummary
s@Nullable ChainResultsSummary
getParentResultSummary(ResultsSummary resultsSummary)
Get (@link ChainResultsSummary} containing givenResultsSummary
@NotNull List<PlanKey>
getPlanKeysSortedByNumberOfFinalizedResultSummaries()
ResultsSummary
getResultsSummary(long id)
Lookup the ResultsSummary by id@Nullable ResultsSummary
getResultsSummary(@NotNull PlanResultKey planResultKey)
Lookup the ResultsSummary byPlanResultKey
<T extends ResultsSummary>
TgetResultsSummary(@NotNull PlanResultKey planResultKey, @NotNull Class<T> aClass)
LookupResultsSummary
byPlanResultKey
and expected type<T extends ResultsSummary>
TgetResultsSummary(@NotNull PlanResultKey planResultKey, @NotNull Class<T> aClass, ResultDataRead dataRead)
LookupResultsSummary
byPlanResultKey
and expected type.@Nullable ResultsSummary
getResultsSummary(@NotNull PlanResultKey planResultKey, ResultDataRead dataRead)
Lookup the ResultsSummary byPlanResultKey
.<T extends ResultsSummary>
@NotNull List<T>getResultSummaries(@NotNull ResultsSummaryCriteria resultsSummaryCriteria)
Generic search to find any result summaries basing on the criteria provided.<T extends ResultsSummary>
@NotNull List<T>getResultSummariesByChangeSetId(@NotNull String changeSetId, @NotNull Class<T> discriminator)
Get a list of all build results containing a commit with the given changeset ID.<T extends ResultsSummary>
List<T>getResultSummariesByChangeSetIdAndRepository(long repositoryId, @NotNull String changeSetId, @NotNull Class<T> discriminator)
Get a list of all build results containing a commit with the given changeset ID that are in the given repository.<T extends ResultsSummary>
@NotNull List<T>getResultSummariesByChangeSetIds(@NotNull Iterable<Pair<String,RepositoryData>> changeSetIds, Class<T> discriminator)
Get a list of all build results containing a commit with any of the given changeset IDs and which are in the supplied list of repository datas.<T extends ResultsSummary>
@NotNull List<T>getResultSummariesByChangeSetIds(@NotNull List<String> changeSetIds, Class<T> discriminator)
Get a list of all build results containing a commit with any of the given changeset IDs.<T extends ResultsSummary>
@NotNull List<T>getResultSummariesByCheckoutChangesetId(@NotNull String changeSetId, @NotNull Class<T> discriminator)
Get a list of all build results containing repositories checked out with the given changeset ID.<T extends ResultsSummary>
@NotNull List<T>getResultSummariesForExpiry(@NotNull ExpiryCriteria expiryCriteria)
Searches forresult summaries
according to the givencriteria
for use in build expiry.<T extends ResultsSummary>
@NotNull List<T>getResultSummariesForPlan(@NotNull ImmutablePlan plan, int firstResult, int maxResults)
<T extends ResultsSummary>
@NotNull List<T>getResultSummariesForPlanByLifeCycleState(@NotNull Plan plan, @NotNull LifeCycleState lifeCycleState, int firstResult, int maxResults)
Get theResultsSummary
s for the givenPlan
in giveLifeCycleState
that are Results are sorted by build number (descending).@Nullable ChainStageResult
getStageForResult(ResultsSummary resultsSummary)
Get (@link ChainStageResult} containing givenResultsSummary
void
invalidateLogSize(@NotNull PlanResultKey planResultKey)
Invalidates the log size of aResultsSummary
with the givenPlanResultKey
.int
markResultSummariesForDeletion(@NotNull PlanKey planKey)
Mass update of allResultsSummary
records in the database related to a Plan identified by planKey.void
moveResultSummaries(@NotNull Plan newParentPlan, @NotNull PlanKey oldPlanKey, @NotNull PlanKey newPlanKey)
Reassigns plan key ResultsSummaries associated with selected plan key.void
postBuildVariableSnapshotUpdate(@NotNull ResultsSummary resultsSummary, @NotNull VariableContext variableContext)
Saves result variables produced in a job.int
removeAllOrphanedResultSummaries()
Removes all theResultsSummary
objects in the database that do not have a matchingPlan
void
removeArtifacts(@NotNull ImmutablePlan plan, int buildNumber)
Remove any artifacts stored for this plan resultvoid
removeArtifacts(@NotNull ResultsSummary resultsSummary)
Remove any artifacts stored for this plan resultvoid
removeBuildLogs(@NotNull ResultsSummary resultsSummary)
Remove any build logs stored for this plan resultvoid
removeBuildLogs(@NotNull ResultsSummary resultsSummary, long maxIgnoredSize)
Remove build logs stored for this plan result that are greater than given size (in bytes).void
removeBuildLogs(ImmutablePlan plan, int buildNumber)
Remove any build logs stored for this plan resultvoid
removeBuildLogs(ImmutablePlan plan, int buildNumber, long maxIgnoredSize)
Remove build logs stored for this plan result that are greater than given size (in bytes).void
removeMatchingArtifacts(@NotNull ResultsSummary resultsSummary, @NotNull com.google.common.base.Predicate<ArtifactLink> predicate)
Remove artifacts from results summary that match a predicate.void
removeMergeResultSummary(@NotNull MergeResultSummary mergeResult)
Removes merge result.int
removeResultsSummariesForPlan(@NotNull Plan plan)
Remove all resultSummary objects for the given plan.void
removeResultSummary(@NotNull ImmutablePlan plan, int buildNumber)
Remove plan result summary and all associated objects.void
removeResultSummary(@NotNull PlanResultKey planResultKey)
Remove plan result summary and all associated objects.void
removeResultSummary(@NotNull ResultsSummary resultsSummary)
Remove plan result summary and all associated objects.void
removeResultSummary(@Nullable ImmutablePlan plan, @NotNull ResultsSummary resultsSummary)
Remove plan result summary and all associated objects.ResultsSummary
resetResultSummary(@NotNull BuildResultsSummary resultsSummary)
Prepare result summry to be reuse for plan rerunvoid
saveResultSummary(@NotNull ResultsSummary resultsSummary)
Saves theResultsSummary
long
scrollResultSummaries(@NotNull String buildKey, @NotNull com.google.common.base.Function<ResultsSummary,Void> function)
Scroll through and execute function for each of BuildResultsSummary Objects passed to function are not fully initialized.long
scrollResultSummaries(@NotNull String buildKey, ResultDataRead resultDataRead, @NotNull com.google.common.base.Function<ResultsSummary,Void> function)
Scroll through and execute function for each of ResultsSummary (Build and Chain) Objects passed to function are not fully initialized.void
setArtifactLinkManager(ArtifactLinkManager artifactLinkManager)
void
setBranchIntegrationService(BranchIntegrationService branchIntegrationService)
void
setBuildExecutionManager(BuildExecutionManager buildExecutionManager)
void
setBuildResultsSummaryDao(BuildResultsSummaryDao buildResultsSummaryDao)
void
setCommentManager(CommentManager commentManager)
void
setCommitDao(CommitDao commitDao)
void
setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)
void
setExtendedAuthorManager(ExtendedAuthorManager extendedAuthorManager)
void
setJiraIssueUtils(JiraIssueUtils jiraIssueUtils)
void
setMergeResultSummaryDao(MergeResultSummaryDao mergeResultSummaryDao)
void
setPlanManager(PlanManager planManager)
void
setRepositoryDefinitionManager(RepositoryDefinitionManager repositoryDefinitionManager)
void
setVariableContextBaselineDao(VariableContextBaselineDao variableContextBaselineDao)
void
setVcsRepositoryManager(VcsRepositoryManager vcsRepositoryManager)
@NotNull BuildResultsSummary
updateBuildSummaryFromBuildResults(BuildContext buildContext, @NotNull CurrentlyBuilding currentlyBuilding, BuildResults buildResults)
Updates BuildResultsSummary after build is completed.void
updateLifeCycleState(@NotNull ResultsSummary resultsSummary, @NotNull LifeCycleState lifeCycleState, @NotNull BuildState buildState)
Update LifeCycleState and saves the givenResultsSummary
void
updateLifeCycleState(@NotNull BuildIdentifier buildIdentifier, @NotNull LifeCycleState lifeCycleState, @NotNull BuildState buildState)
Update LifeCycleState and saves theResultsSummary
for givenBuildContext
Updates also timing informationvoid
updateLifeCycleState(@NotNull CurrentlyBuilding currentlyBuilding, @NotNull LifeCycleState lifeCycleState, @NotNull BuildState buildState)
Update LifeCycleState and saves theResultsSummary
for givenBuildContext
Updates also timing information.void
updatePlanCompletedDate(@NotNull ChainResultsSummary resultSummary, @NotNull Date completionDate)
Update completed date and duration ofChainResultsSummary
void
updateProcessingDuration(ChainResultsSummary resultSummary)
UpdatesImmutableResultsSummary.getProcessingDuration()
andChainStageResult.getProcessingDuration()
based on chain execution.void
updateResultSummaryWithBuildChanges(@NotNull BuildContext buildContext)
void
updateVariablesOnContinuedBuild(@NotNull ResultsSummary resultsSummary, @NotNull VariableContext variableContext)
Add manual variables added when starting manual stage or restarting failed stage.-
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.resultsummary.ResultsSummaryManager
getLastNFailedResultsSummaries, getLastNResultsSummaries
-
-
-
-
Method Detail
-
getResultSummariesForPlanByLifeCycleState
@NotNull public <T extends ResultsSummary> @NotNull List<T> getResultSummariesForPlanByLifeCycleState(@NotNull @NotNull Plan plan, @NotNull @NotNull LifeCycleState lifeCycleState, int firstResult, int maxResults)
Description copied from interface:ResultsSummaryManager
Get theResultsSummary
s for the givenPlan
in giveLifeCycleState
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 interfaceResultsSummaryManager
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
-
getResultSummariesForPlan
@NotNull public <T extends ResultsSummary> @NotNull List<T> getResultSummariesForPlan(@NotNull @NotNull ImmutablePlan plan, int firstResult, int maxResults)
Description copied from interface:ResultsSummaryManager
Get theResultsSummary
s for the givenPlan
in anyLifeCycleState
. Results are sorted by build number (descending). User can skip first n result and request maximum number of results.- Specified by:
getResultSummariesForPlan
in interfaceResultsSummaryManager
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
-
getChainStageResultById
@Nullable public @Nullable ChainStageResult getChainStageResultById(@NotNull @NotNull Long id)
Description copied from interface:ResultsSummaryManager
Returns aChainStageResult
by its id- Specified by:
getChainStageResultById
in interfaceResultsSummaryManager
- Returns:
- chainStageResult
-
getResultsSummary
@Nullable public @Nullable ResultsSummary getResultsSummary(@NotNull @NotNull PlanResultKey planResultKey)
Description copied from interface:ResultsSummaryManager
Lookup the ResultsSummary byPlanResultKey
- Specified by:
getResultsSummary
in interfaceResultsSummaryManager
- Returns:
- resultsSummary
-
getResultsSummary
@Nullable public @Nullable ResultsSummary getResultsSummary(@NotNull @NotNull PlanResultKey planResultKey, ResultDataRead dataRead)
Description copied from interface:ResultsSummaryManager
Lookup the ResultsSummary byPlanResultKey
. All lazy initialized collections can be eagerly fetched to avoid session problems. Use with caution - expensive call- Specified by:
getResultsSummary
in interfaceResultsSummaryManager
- Returns:
- resultsSummary
-
getResultsSummary
@Nullable public <T extends ResultsSummary> T getResultsSummary(@NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull Class<T> aClass)
Description copied from interface:ResultsSummaryManager
LookupResultsSummary
byPlanResultKey
and expected type- Specified by:
getResultsSummary
in interfaceResultsSummaryManager
- Returns:
- resultSummary
-
getResultsSummary
@Nullable public <T extends ResultsSummary> T getResultsSummary(@NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull Class<T> aClass, ResultDataRead dataRead)
Description copied from interface:ResultsSummaryManager
LookupResultsSummary
byPlanResultKey
and expected type. All lazy initialized collections can be eagerly fetched to avoid session problems. Use with caution - expensive call- Specified by:
getResultsSummary
in interfaceResultsSummaryManager
- Returns:
- resultSummary
-
getResultsSummary
public ResultsSummary getResultsSummary(long id)
Description copied from interface:ResultsSummaryManager
Lookup the ResultsSummary by id- Specified by:
getResultsSummary
in interfaceResultsSummaryManager
- Parameters:
id
- - database id- Returns:
- resultsSummary
-
resetResultSummary
public ResultsSummary resetResultSummary(@NotNull @NotNull BuildResultsSummary resultsSummary) throws IOException
Description copied from interface:ResultsSummaryManager
Prepare result summry to be reuse for plan rerun- Specified by:
resetResultSummary
in interfaceResultsSummaryManager
- Returns:
- Throws:
IOException
-
addVariableContextSnapshotToResultSummary
public void addVariableContextSnapshotToResultSummary(@NotNull @NotNull ResultsSummary resultsSummary, @NotNull @NotNull VariableContext variableContext)
Description copied from interface:ResultsSummaryManager
Adds state of global and plan variables to result at the beginning of execution. If first argument is chain result, also adds snapshot of manual variables.- Specified by:
addVariableContextSnapshotToResultSummary
in interfaceResultsSummaryManager
-
updateVariablesOnContinuedBuild
public void updateVariablesOnContinuedBuild(@NotNull @NotNull ResultsSummary resultsSummary, @NotNull @NotNull VariableContext variableContext)
Description copied from interface:ResultsSummaryManager
Add manual variables added when starting manual stage or restarting failed stage. Does nothing for job results.- Specified by:
updateVariablesOnContinuedBuild
in interfaceResultsSummaryManager
-
clearVariablesOnRerunBuild
public void clearVariablesOnRerunBuild(@NotNull @NotNull ResultsSummary resultsSummary)
Description copied from interface:ResultsSummaryManager
Clear stored stage manual variables when build is fully rerun. Does nothing for job results.- Specified by:
clearVariablesOnRerunBuild
in interfaceResultsSummaryManager
-
postBuildVariableSnapshotUpdate
public void postBuildVariableSnapshotUpdate(@NotNull @NotNull ResultsSummary resultsSummary, @NotNull @NotNull VariableContext variableContext)
Description copied from interface:ResultsSummaryManager
Saves result variables produced in a job. Does nothing for chain results.- Specified by:
postBuildVariableSnapshotUpdate
in interfaceResultsSummaryManager
-
getAllPendingResultSummaries
@NotNull public <T extends ResultsSummary> @NotNull Collection<T> getAllPendingResultSummaries(Class<T> aClass)
Description copied from interface:ResultsSummaryManager
Returns all theResultsSummary
in aLifeCycleState.PENDING
state- Specified by:
getAllPendingResultSummaries
in interfaceResultsSummaryManager
- Returns:
- pendingSummaries
-
getAllQueuedResultSummaries
@NotNull public <T extends ResultsSummary> @NotNull Collection<T> getAllQueuedResultSummaries(Class<T> aClass)
Description copied from interface:ResultsSummaryManager
Returns all theResultsSummary
in aLifeCycleState.QUEUED
state- Specified by:
getAllQueuedResultSummaries
in interfaceResultsSummaryManager
- Returns:
- summaries
-
getAllInProgressResultSummaries
@NotNull public <T extends ResultsSummary> @NotNull Collection<T> getAllInProgressResultSummaries(Class<T> aClass)
Description copied from interface:ResultsSummaryManager
Returns all theResultsSummary
in aLifeCycleState.IN_PROGRESS
state- Specified by:
getAllInProgressResultSummaries
in interfaceResultsSummaryManager
- Returns:
- summaries
-
getAllActiveResultSummariesForPlan
@NotNull public <T extends ResultsSummary> @NotNull Collection<T> getAllActiveResultSummariesForPlan(PlanKey planKey, Class<T> aClass)
Description copied from interface:ResultsSummaryManager
Returns all theResultsSummary
in aLifeCycleState.IN_PROGRESS
state- Specified by:
getAllActiveResultSummariesForPlan
in interfaceResultsSummaryManager
- Returns:
- summaries
-
getFinalizedResultSummariesForPlan
@NotNull public <T extends ResultsSummary> @NotNull List<T> getFinalizedResultSummariesForPlan(PlanKey planKey, Class<T> aClass, int firstResult, int maxResults)
Description copied from interface:ResultsSummaryManager
Returns all theResultsSummary
in aLifeCycleState.FINISHED
orLifeCycleState.NOT_BUILT
state with the givenClass
. Results are sorted descending by build number.- Specified by:
getFinalizedResultSummariesForPlan
in interfaceResultsSummaryManager
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:ResultsSummaryManager
Gets the number of concurrently running builds- Specified by:
getNumberOfConcurrentlyRunningBuilds
in interfaceResultsSummaryManager
- Returns:
-
getAllBuildResultSummariesInUnknownState
@NotNull public <T extends ResultsSummary> @NotNull Collection<T> getAllBuildResultSummariesInUnknownState(Class<T> aClass)
Description copied from interface:ResultsSummaryManager
Returns all theBuildResultsSummary
in aBuildState.UNKNOWN
state- Specified by:
getAllBuildResultSummariesInUnknownState
in interfaceResultsSummaryManager
- Returns:
- summaries
-
createResultsSummary
public <T extends ResultsSummary> T createResultsSummary(@NotNull @NotNull BuildContext buildContext, @NotNull @NotNull Class<T> aClass) throws ResultsSummaryCreationException
Description copied from interface:ResultsSummaryManager
Creates aResultsSummary
of the givenClass
- Specified by:
createResultsSummary
in interfaceResultsSummaryManager
- Returns:
- resultsSummary
- Throws:
ResultsSummaryCreationException
-
createResultsSummary
public <T extends ResultsSummary> T createResultsSummary(@Nullable @Nullable ChainResultsSummary chainResultsSummary, @NotNull @NotNull BuildContext buildContext, @NotNull @NotNull Class<T> aClass) throws ResultsSummaryCreationException
- Specified by:
createResultsSummary
in interfaceBuildResultsSummaryManager
- Throws:
ResultsSummaryCreationException
-
updateResultSummaryWithBuildChanges
public void updateResultSummaryWithBuildChanges(@NotNull @NotNull BuildContext buildContext) throws ResultsSummaryCreationException
- Specified by:
updateResultSummaryWithBuildChanges
in interfaceResultsSummaryManager
- Throws:
ResultsSummaryCreationException
-
updateBuildSummaryFromBuildResults
@NotNull public @NotNull BuildResultsSummary updateBuildSummaryFromBuildResults(BuildContext buildContext, @NotNull @NotNull CurrentlyBuilding currentlyBuilding, BuildResults buildResults)
Description copied from interface:BuildResultsSummaryManager
Updates BuildResultsSummary after build is completed. All fiedls are initialized at this moment.- Specified by:
updateBuildSummaryFromBuildResults
in interfaceBuildResultsSummaryManager
- Returns:
- updated build result summary
-
calculateAndSetDeltaState
public void calculateAndSetDeltaState(ResultsSummary resultsSummary)
Description copied from interface:ResultsSummaryManager
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.- Specified by:
calculateAndSetDeltaState
in interfaceResultsSummaryManager
- Parameters:
resultsSummary
- to update
-
updateLifeCycleState
public void updateLifeCycleState(@NotNull @NotNull ResultsSummary resultsSummary, @NotNull @NotNull LifeCycleState lifeCycleState, @NotNull @NotNull BuildState buildState)
Description copied from interface:ResultsSummaryManager
Update LifeCycleState and saves the givenResultsSummary
- Specified by:
updateLifeCycleState
in interfaceResultsSummaryManager
- Parameters:
resultsSummary
- ResultsSummary to be updated and savedlifeCycleState
- LifeCycleState to be setbuildState
- BuildState to be set
-
cleanPendingLifeCycleState
public void cleanPendingLifeCycleState(@NotNull @NotNull PlanResultKey planResultKey)
Description copied from interface:ResultsSummaryManager
Cleans state of pending result.- Specified by:
cleanPendingLifeCycleState
in interfaceResultsSummaryManager
-
updateLifeCycleState
public void updateLifeCycleState(@NotNull @NotNull BuildIdentifier buildIdentifier, @NotNull @NotNull LifeCycleState lifeCycleState, @NotNull @NotNull BuildState buildState)
Description copied from interface:ResultsSummaryManager
Update LifeCycleState and saves theResultsSummary
for givenBuildContext
Updates also timing information- Specified by:
updateLifeCycleState
in interfaceResultsSummaryManager
- Parameters:
buildIdentifier
- BuildIdentifier used to get information on ResultsSummarylifeCycleState
- LifeCycleState to be setbuildState
- BuildState to be set
-
updateLifeCycleState
public void updateLifeCycleState(@NotNull @NotNull CurrentlyBuilding currentlyBuilding, @NotNull @NotNull LifeCycleState lifeCycleState, @NotNull @NotNull BuildState buildState)
Description copied from interface:ResultsSummaryManager
Update LifeCycleState and saves theResultsSummary
for givenBuildContext
Updates also timing information.- Specified by:
updateLifeCycleState
in interfaceResultsSummaryManager
- Parameters:
currentlyBuilding
- in-memory state of the buildlifeCycleState
- LifeCycleState to be setbuildState
- BuildState to be set
-
updatePlanCompletedDate
public void updatePlanCompletedDate(@NotNull @NotNull ChainResultsSummary resultSummary, @NotNull @NotNull Date completionDate)
Description copied from interface:ResultsSummaryManager
Update completed date and duration ofChainResultsSummary
- Specified by:
updatePlanCompletedDate
in interfaceResultsSummaryManager
-
updateProcessingDuration
public void updateProcessingDuration(ChainResultsSummary resultSummary)
Description copied from interface:ResultsSummaryManager
UpdatesImmutableResultsSummary.getProcessingDuration()
andChainStageResult.getProcessingDuration()
based on chain execution.- Specified by:
updateProcessingDuration
in interfaceResultsSummaryManager
-
markResultSummariesForDeletion
public int markResultSummariesForDeletion(@NotNull @NotNull PlanKey planKey)
Description copied from interface:ResultsSummaryManager
Mass update of allResultsSummary
records in the database related to a Plan identified by planKey.- Specified by:
markResultSummariesForDeletion
in interfaceResultsSummaryManager
- Parameters:
planKey
- key of a plan- Returns:
- number of updated records
-
getBreakingBuild
@Nullable public @Nullable ResultsSummary getBreakingBuild(ResultsSummary buildResultsSummary)
Description copied from interface:ResultsSummaryManager
Returns the first failing build after the last successful build. ie the latest build before this one with the delta state "broken"- Specified by:
getBreakingBuild
in interfaceResultsSummaryManager
- Parameters:
buildResultsSummary
- of the current build- Returns:
- null if there is no breaking build.
-
getFixingBuild
@Nullable public @Nullable ResultsSummary getFixingBuild(ResultsSummary buildResultsSummary)
Description copied from interface:ResultsSummaryManager
Returns the first successfulResultsSummary
for givenResultsSummary
. The input build is returned if it is successful.- Specified by:
getFixingBuild
in interfaceResultsSummaryManager
- Returns:
- null if there is no fixing build.
-
getAnyResultSummary
@Nullable public <T extends ResultsSummary> T getAnyResultSummary(@NotNull @NotNull ResultsSummaryCriteria criteria, ResultDataRead dataRead)
Description copied from interface:ResultsSummaryManager
Generic search to find any result summary basing on the criteria provided. Note that if criteria does not specify order then result of this method might be non-deterministic.- Specified by:
getAnyResultSummary
in interfaceResultsSummaryManager
- Parameters:
criteria
- containing all the search constraints- Returns:
- any resultSummary matching the criteria or null.
-
getResultSummaries
@NotNull public <T extends ResultsSummary> @NotNull List<T> getResultSummaries(@NotNull @NotNull ResultsSummaryCriteria resultsSummaryCriteria)
Description copied from interface:ResultsSummaryManager
Generic search to find any result summaries basing on the criteria provided.- Specified by:
getResultSummaries
in interfaceResultsSummaryManager
- Parameters:
resultsSummaryCriteria
- containing all the search constraints- Returns:
- list of resultsSummaries matching the criteria.
-
getResultSummariesForExpiry
@NotNull public <T extends ResultsSummary> @NotNull List<T> getResultSummariesForExpiry(@NotNull @NotNull ExpiryCriteria expiryCriteria)
Description copied from interface:ResultsSummaryManager
Searches forresult summaries
according to the givencriteria
for use in build expiry.- Specified by:
getResultSummariesForExpiry
in interfaceResultsSummaryManager
- Type Parameters:
T
- type of returned results (determined by the criteria)- Parameters:
expiryCriteria
- search constraints- Returns:
- list of
results summaries
matching the criteria
-
getLastNResultsSummaries
@NotNull public @NotNull List<ResultsSummary> getLastNResultsSummaries(@NotNull @NotNull PlanIdentifier planIdentifier, int numberOfResults)
Description copied from interface:ResultsSummaryManager
Provides a list of the latest N results summaries for the given plan, newest first.- Specified by:
getLastNResultsSummaries
in interfaceResultsSummaryManager
- Parameters:
planIdentifier
- - to get the results fornumberOfResults
- - number of summaries you would like- Returns:
- list<ResultsSummary>
-
getLastNFailedResultsSummaries
@NotNull public @NotNull List<ResultsSummary> getLastNFailedResultsSummaries(@NotNull @NotNull PlanIdentifier planIdentifier, int numberOfResults)
Description copied from interface:ResultsSummaryManager
Returns the most recent n failed build results. Sorted by newest first.- Specified by:
getLastNFailedResultsSummaries
in interfaceResultsSummaryManager
numberOfResults
- must be > 0
-
findResultsSummariesByJiraIssues
@NotNull public @NotNull List<? extends ResultsSummary> findResultsSummariesByJiraIssues(@Nullable @Nullable List<String> issueKeys)
Description copied from interface:ResultsSummaryManager
Finds a list of results which are linked to the given issue keys- Specified by:
findResultsSummariesByJiraIssues
in interfaceResultsSummaryManager
- Parameters:
issueKeys
- to search for- Returns:
- al list of ResultsSummary associated with any of the given list of issue keys
-
findResultsSummariesByProjectKey
@NotNull public @NotNull List<? extends ResultsSummary> findResultsSummariesByProjectKey(@Nullable @Nullable String projectKey)
Description copied from interface:ResultsSummaryManager
Provide a list of results which are linked to any issues under the given jira project key- Specified by:
findResultsSummariesByProjectKey
in interfaceResultsSummaryManager
- Parameters:
projectKey
- - jira project key- Returns:
- a list of results which are linked to any issues under the given jira project key
-
findJiraIssuesForResults
@NotNull public @NotNull List<LinkedJiraIssue> findJiraIssuesForResults(@NotNull @NotNull List<ResultsSummary> buildResults)
Description copied from interface:ResultsSummaryManager
Retrieves a list ofLinkedJiraIssue
linked to the given build result summaries- Specified by:
findJiraIssuesForResults
in interfaceResultsSummaryManager
- Parameters:
buildResults
- to look for issues attached to- Returns:
- a list of
LinkedJiraIssue
linked to the given build result summaries
-
findJiraIssuesForPlanKey
@NotNull public @NotNull List<LinkedJiraIssue> findJiraIssuesForPlanKey(@NotNull @NotNull PlanKey planKey)
Description copied from interface:ResultsSummaryManager
Retrieves a list ofLinkedJiraIssue
linked to the given plan key- Specified by:
findJiraIssuesForPlanKey
in interfaceResultsSummaryManager
- Parameters:
planKey
- to look for issues associated with plan of this key- Returns:
- a list of
LinkedJiraIssue
linked to the givenPlan
-
removeResultSummary
public void removeResultSummary(@NotNull @NotNull ImmutablePlan plan, int buildNumber)
Description copied from interface:ResultsSummaryManager
Remove plan result summary and all associated objects.- Specified by:
removeResultSummary
in interfaceResultsSummaryManager
-
removeResultSummary
public void removeResultSummary(@Nullable @Nullable ImmutablePlan plan, @NotNull @NotNull ResultsSummary resultsSummary)
Description copied from interface:ResultsSummaryManager
Remove plan result summary and all associated objects.- Specified by:
removeResultSummary
in interfaceResultsSummaryManager
- Parameters:
plan
- not used
-
removeResultSummary
public void removeResultSummary(@NotNull @NotNull PlanResultKey planResultKey)
Description copied from interface:ResultsSummaryManager
Remove plan result summary and all associated objects.- Specified by:
removeResultSummary
in interfaceResultsSummaryManager
-
removeResultSummary
public void removeResultSummary(@NotNull @NotNull ResultsSummary resultsSummary)
Description copied from interface:ResultsSummaryManager
Remove plan result summary and all associated objects.- Specified by:
removeResultSummary
in interfaceResultsSummaryManager
-
removeBuildLogs
public void removeBuildLogs(ImmutablePlan plan, int buildNumber)
Description copied from interface:ResultsSummaryManager
Remove any build logs stored for this plan result- Specified by:
removeBuildLogs
in interfaceResultsSummaryManager
-
removeBuildLogs
public void removeBuildLogs(ImmutablePlan plan, int buildNumber, long maxIgnoredSize)
Description copied from interface:ResultsSummaryManager
Remove build logs stored for this plan result that are greater than given size (in bytes).- Specified by:
removeBuildLogs
in interfaceResultsSummaryManager
-
removeBuildLogs
public void removeBuildLogs(@NotNull @NotNull ResultsSummary resultsSummary)
Description copied from interface:ResultsSummaryManager
Remove any build logs stored for this plan result- Specified by:
removeBuildLogs
in interfaceResultsSummaryManager
-
removeBuildLogs
public void removeBuildLogs(@NotNull @NotNull ResultsSummary resultsSummary, long maxIgnoredSize)
Description copied from interface:ResultsSummaryManager
Remove build logs stored for this plan result that are greater than given size (in bytes).- Specified by:
removeBuildLogs
in interfaceResultsSummaryManager
-
removeMatchingArtifacts
public void removeMatchingArtifacts(@NotNull @NotNull ResultsSummary resultsSummary, @NotNull @NotNull com.google.common.base.Predicate<ArtifactLink> predicate) throws IOException
Description copied from interface:ResultsSummaryManager
Remove artifacts from results summary that match a predicate.- Specified by:
removeMatchingArtifacts
in interfaceResultsSummaryManager
- Throws:
IOException
-
removeArtifacts
public void removeArtifacts(@NotNull @NotNull ImmutablePlan plan, int buildNumber) throws IOException
Description copied from interface:ResultsSummaryManager
Remove any artifacts stored for this plan result- Specified by:
removeArtifacts
in interfaceResultsSummaryManager
- Throws:
IOException
-
removeArtifacts
public void removeArtifacts(@NotNull @NotNull ResultsSummary resultsSummary) throws IOException
Description copied from interface:ResultsSummaryManager
Remove any artifacts stored for this plan result- Specified by:
removeArtifacts
in interfaceResultsSummaryManager
- Throws:
IOException
-
findChainResultsWithJobLabelled
public List<ChainResultsSummary> findChainResultsWithJobLabelled(ResultsSummaryCriteria criteria, List<Label> labels)
Description copied from interface:ResultsSummaryManager
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
- Specified by:
findChainResultsWithJobLabelled
in interfaceResultsSummaryManager
- Parameters:
criteria
- containing the restrictions for the chains to be returnedlabels
- that the jobs can be associated with- Returns:
- list of ChainResultSummary that match the criteria and have jobs with any of the given labels
-
getNeighbouringSummaries
@NotNull public @NotNull List<ResultsSummary> getNeighbouringSummaries(Plan plan, int buildNumber)
Description copied from interface:ResultsSummaryManager
Returns all theResultsSummary
objects that matches the passed build numbers- Specified by:
getNeighbouringSummaries
in interfaceResultsSummaryManager
- Returns:
List
ofBuildResultsSummary
-
getNeighbouringSummaries
@NotNull public @NotNull List<ResultsSummary> getNeighbouringSummaries(@NotNull @NotNull ImmutablePlan plan, int buildNumber, int maxCount)
Description copied from interface:ResultsSummaryManager
Returns all theResultsSummary
objects that represent build results "around" the given build number.- Specified by:
getNeighbouringSummaries
in interfaceResultsSummaryManager
- Parameters:
plan
- the plan to return results forbuildNumber
- the build number to search aroundmaxCount
- the maximum number of builds to return- Returns:
List
ofBuildResultsSummary
in ascending order. At most there will bemaxCount
items in the list, inclusive of the result forbuildNumber
(if present).
-
getBeforeSummaries
@NotNull public @NotNull List<ResultsSummary> getBeforeSummaries(@NotNull @NotNull ImmutablePlan plan, int buildNumber, int maxCount)
Description copied from interface:ResultsSummaryManager
Returns all theResultsSummary
objects that represent build results strictly before the given build number.- Specified by:
getBeforeSummaries
in interfaceResultsSummaryManager
- Parameters:
plan
- the plan to return results forbuildNumber
- the build number to search beforemaxCount
- the maximum number of builds to return- Returns:
List
ofBuildResultsSummary
in ascending order. At most there will bemaxCount
items in the list, exclusive of the result forbuildNumber
(if present).
-
getAfterSummaries
@NotNull public @NotNull List<ResultsSummary> getAfterSummaries(@NotNull @NotNull ImmutablePlan plan, int buildNumber, int maxCount)
Description copied from interface:ResultsSummaryManager
Returns all theResultsSummary
objects that represent build results strictly after the given build number.- Specified by:
getAfterSummaries
in interfaceResultsSummaryManager
- Parameters:
plan
- the plan to return results forbuildNumber
- the build number to search aftermaxCount
- the maximum number of builds to return- Returns:
List
ofBuildResultsSummary
in ascending order. At most there will bemaxCount
items in the list, exclusive of the result forbuildNumber
(if present).
-
removeResultsSummariesForPlan
public int removeResultsSummariesForPlan(@NotNull @NotNull Plan plan)
Description copied from interface:ResultsSummaryManager
Remove all resultSummary objects for the given plan. Time-cost of this method might be significant if there are thousands ofResultsSummary
objects to be deleted in such case#scheduleResultsSummariesForDelayedDeletion(Plan)
should be considered.- Specified by:
removeResultsSummariesForPlan
in interfaceResultsSummaryManager
- Parameters:
plan
- to remove results for.- Returns:
- number of
ResultsSummary
s removed
-
removeAllOrphanedResultSummaries
public int removeAllOrphanedResultSummaries()
Description copied from interface:ResultsSummaryManager
Removes all theResultsSummary
objects in the database that do not have a matchingPlan
- Specified by:
removeAllOrphanedResultSummaries
in interfaceResultsSummaryManager
- Returns:
- number of
ResultsSummary
s removed
-
saveResultSummary
public void saveResultSummary(@NotNull @NotNull ResultsSummary resultsSummary)
Description copied from interface:ResultsSummaryManager
Saves theResultsSummary
- Specified by:
saveResultSummary
in interfaceResultsSummaryManager
-
getLastSuccessfulResultSummary
public ResultsSummary getLastSuccessfulResultSummary(@NotNull @NotNull PlanKey planKey)
Description copied from interface:ResultsSummaryManager
Get the last successfulResultsSummary
for planKey- Specified by:
getLastSuccessfulResultSummary
in interfaceResultsSummaryManager
- Returns:
-
findLastSuccessfulBuildResultBefore
@Nullable public @Nullable ResultsSummary findLastSuccessfulBuildResultBefore(@NotNull @NotNull PlanResultKey planResultKey)
Description copied from interface:ResultsSummaryManager
Finds the last successfulResultsSummary
before build- Specified by:
findLastSuccessfulBuildResultBefore
in interfaceResultsSummaryManager
- Returns:
- buildResult
-
findLastSuccessfulBuildResultBefore
@Nullable public @Nullable ResultsSummary findLastSuccessfulBuildResultBefore(@NotNull @NotNull PlanResultKey planResultKey, boolean includeOnceOffBuilds)
Description copied from interface:ResultsSummaryManager
Finds the last successfulResultsSummary
before build- Specified by:
findLastSuccessfulBuildResultBefore
in interfaceResultsSummaryManager
-
findFirstResultAfter
@Nullable public <T extends ResultsSummary> T findFirstResultAfter(@NotNull @NotNull PlanResultKey planResultKey, Class<T> aClass)
Description copied from interface:ResultsSummaryManager
Finds the firstResultsSummary
after a specified build which is either FINISHED or can be FINISHED, i.e. is not in NOT_BUILT state.- Specified by:
findFirstResultAfter
in interfaceResultsSummaryManager
- Returns:
-
findLastResultBefore
@Nullable public <T extends ResultsSummary> T findLastResultBefore(@NotNull @NotNull PlanResultKey planResultKey, Class<T> aClass)
Description copied from interface:ResultsSummaryManager
Finds the last successful or failingResultsSummary
before planResultKey.getBuildNumber- Specified by:
findLastResultBefore
in interfaceResultsSummaryManager
- Returns:
-
findLastResultBefore
@Nullable public <T extends ResultsSummary> T findLastResultBefore(@NotNull @NotNull PlanResultKey planResultKey, Class<T> aClass, boolean includeOnceOffBuilds)
Description copied from interface:ResultsSummaryManager
Finds the lastResultsSummary
before planResultKey.getBuildNumber- Specified by:
findLastResultBefore
in interfaceResultsSummaryManager
includeOnceOffBuilds
- - should we skip once-off builds or include them in the search- Returns:
-
findLastResultSummaryWithState
public <T extends ResultsSummary> T findLastResultSummaryWithState(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull BuildState buildState, @NotNull @NotNull Class<T> aClass)
- Specified by:
findLastResultSummaryWithState
in interfaceResultsSummaryManager
- Returns:
- the last
ResultsSummary
with the providedBuildState
-
findLastResultSummaryWithState
@Nullable public <T extends ResultsSummary> T findLastResultSummaryWithState(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull BuildState buildState, @NotNull @NotNull Class<T> aClass, boolean ignoreSpecsResults)
- Specified by:
findLastResultSummaryWithState
in interfaceResultsSummaryManager
- Returns:
- the last
ResultsSummary
with the providedBuildState
-
getResultSummariesByChangeSetId
@NotNull public <T extends ResultsSummary> @NotNull List<T> getResultSummariesByChangeSetId(@NotNull @NotNull String changeSetId, @NotNull @NotNull Class<T> discriminator)
Description copied from interface:ResultsSummaryManager
Get a list of all build results containing a commit with the given changeset ID.
Please note that a build result summary contains list of commits which were added in a given build (compared to a previous one). It means that a list of commits may be empty if there were no repository changes. A list of commits is also empty in case of a first build in a plan or a first build of a plan's branch. A build results summary may also contain no commits if no version control system was used.
This will not return records marked for deletion.
In case you need to find build results based on commit which was checked out into a build workspace, see the
ResultsSummaryManager.getResultSummariesByCheckoutChangesetId(String, Class)
- Specified by:
getResultSummariesByChangeSetId
in interfaceResultsSummaryManager
- Type Parameters:
T
- extends ResultSummary- Parameters:
changeSetId
- of the commitdiscriminator
- class of the ResultSummary interface required- Returns:
- List of ResultsSummary (ResultSummary as determined by discriminator) containing a commit with the given changeSetId
-
getResultSummariesByCheckoutChangesetId
@NotNull public <T extends ResultsSummary> @NotNull List<T> getResultSummariesByCheckoutChangesetId(@NotNull @NotNull String changeSetId, @NotNull @NotNull Class<T> discriminator)
Description copied from interface:ResultsSummaryManager
Get a list of all build results containing repositories checked out with the given changeset ID.
A build may use one or more repositories, each checked out with a certain changeset. This method returns build results having exact changeset ID checked out (note that it does not search for intermediate commits between two changeset IDs).
This will not return records marked for deletion.
In case you need to find build results based on commits which were added in certain build (compared to a previous one), see the
ResultsSummaryManager.getResultSummariesByChangeSetId(String, Class)
- Specified by:
getResultSummariesByCheckoutChangesetId
in interfaceResultsSummaryManager
- Type Parameters:
T
- extends ResultSummary- Parameters:
changeSetId
- of the checkout commitdiscriminator
- class of the ResultSummary interface required- Returns:
- List of ResultsSummary (ResultSummary as determined by discriminator) containing a repository which
was checked out with a
changeSetId
commit
-
getResultSummariesByChangeSetIdAndRepository
public <T extends ResultsSummary> List<T> getResultSummariesByChangeSetIdAndRepository(long repositoryId, @NotNull @NotNull String changeSetId, @NotNull @NotNull Class<T> discriminator)
Description copied from interface:ResultsSummaryManager
Get a list of all build results containing a commit with the given changeset ID that are in the given repository.- Specified by:
getResultSummariesByChangeSetIdAndRepository
in interfaceResultsSummaryManager
- Type Parameters:
T
- extends ResultSummary- Parameters:
repositoryId
- of the repositorychangeSetId
- of the commitdiscriminator
- class of the ResultSummary interface required- Returns:
- List of ResultsSummary (ResultSummary as determined by discriminator) containing a commit with the given changeSetId
-
getResultSummariesByChangeSetIds
@NotNull public <T extends ResultsSummary> @NotNull List<T> getResultSummariesByChangeSetIds(@NotNull @NotNull List<String> changeSetIds, Class<T> discriminator)
Description copied from interface:ResultsSummaryManager
Get a list of all build results containing a commit with any of the given changeset IDs.- Specified by:
getResultSummariesByChangeSetIds
in interfaceResultsSummaryManager
- Type Parameters:
T
- extends ResultSummary- Parameters:
changeSetIds
- of the commitdiscriminator
- class of the ResultSummary interface required- Returns:
- List of ResultsSummary (ResultSummary as determined by discriminator) containing a commit with any of the given changeSetIds
-
getResultSummariesByChangeSetIds
@NotNull public <T extends ResultsSummary> @NotNull List<T> getResultSummariesByChangeSetIds(@NotNull @NotNull Iterable<Pair<String,RepositoryData>> changeSetIds, Class<T> discriminator)
Description copied from interface:ResultsSummaryManager
Get a list of all build results containing a commit with any of the given changeset IDs and which are in the supplied list of repository datas.- Specified by:
getResultSummariesByChangeSetIds
in interfaceResultsSummaryManager
- Type Parameters:
T
- extends ResultSummary- Parameters:
changeSetIds
- of the commit anding with the repository that commit came fromdiscriminator
- class of the ResultSummary interface required- Returns:
- List of ResultsSummary (ResultSummary as determined by discriminator) containing a commit with any of the given changeSetIds
-
getCommitsForUser
@NotNull public @NotNull List<UnassociatedCommit> getCommitsForUser(@NotNull @NotNull String username, int max)
Description copied from interface:ResultsSummaryManager
Retrieve a list of recent Commits for the given user. Items in the collection are unique and sorted by date.- Specified by:
getCommitsForUser
in interfaceResultsSummaryManager
- Parameters:
username
- to filter commits bymax
- maximum number of commits to get.- Returns:
- a list of recent Commits for the given user
-
findLastBuildResultBefore
@Nullable public @Nullable ResultsSummary findLastBuildResultBefore(@NotNull @NotNull String buildKey, int buildNumber)
Description copied from interface:ResultsSummaryManager
Finds the last successful or failingBuildResultsSummary
before buildNumber- Specified by:
findLastBuildResultBefore
in interfaceResultsSummaryManager
- Returns:
-
findLastBuildResultBeforeWithTests
public <T extends ResultsSummary> T findLastBuildResultBeforeWithTests(@NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull Class<T> aClass, boolean includeOnceOffBuilds)
Description copied from interface:ResultsSummaryManager
Finds the last successful or failingBuildResultsSummary
before buildNumber- Specified by:
findLastBuildResultBeforeWithTests
in interfaceResultsSummaryManager
includeOnceOffBuilds
- should once-off builds be considered or ignored in the search- Returns:
- resultsSummary
-
findFirstFailedBuildResultAfter
@Nullable public @Nullable ResultsSummary findFirstFailedBuildResultAfter(@NotNull @NotNull String buildKey, int buildNumber)
Description copied from interface:ResultsSummaryManager
Finds the first failedResultsSummary
after buildNumber- Specified by:
findFirstFailedBuildResultAfter
in interfaceResultsSummaryManager
- Returns:
- buildResult
-
findFirstSuccessfulBuildResultAfter
@Nullable public @Nullable ResultsSummary findFirstSuccessfulBuildResultAfter(@NotNull @NotNull PlanResultKey planResultKey)
Description copied from interface:ResultsSummaryManager
Finds the last successfulResultsSummary
after buildNumber- Specified by:
findFirstSuccessfulBuildResultAfter
in interfaceResultsSummaryManager
- Returns:
- buildResult
-
findLastFailingBuildResultBefore
@Nullable public @Nullable ResultsSummary findLastFailingBuildResultBefore(@NotNull @NotNull ImmutablePlan build, int buildNumber)
Description copied from interface:ResultsSummaryManager
Finds the last failingResultsSummary
before buildNumber- Specified by:
findLastFailingBuildResultBefore
in interfaceResultsSummaryManager
- Returns:
- buildResult
-
findLastFailingBuildResultBefore
@Nullable public @Nullable ResultsSummary findLastFailingBuildResultBefore(@NotNull @NotNull PlanKey planKey, int buildNumber)
Description copied from interface:ResultsSummaryManager
Finds the last failingResultsSummary
before buildNumber- Specified by:
findLastFailingBuildResultBefore
in interfaceResultsSummaryManager
- Returns:
- buildResult
-
findFirstFailedBuildResultBetween
@Nullable public @Nullable ResultsSummary findFirstFailedBuildResultBetween(@NotNull @NotNull ImmutablePlan build, int lowerBuildNumber, int upperBuildNumber)
Description copied from interface:ResultsSummaryManager
Finds the first failed build between the upper and lower build numbers inclusively.- Specified by:
findFirstFailedBuildResultBetween
in interfaceResultsSummaryManager
- Returns:
- buildResults
-
findFirstFailedBuildResultBetween
@Nullable public @Nullable ResultsSummary findFirstFailedBuildResultBetween(@NotNull @NotNull PlanKey planKey, int lowerBuildNumber, int upperBuildNumber)
Description copied from interface:ResultsSummaryManager
Finds the first failed build between the upper and lower build numbers inclusively.*- Specified by:
findFirstFailedBuildResultBetween
in interfaceResultsSummaryManager
-
getParentResultSummary
@Nullable public @Nullable ChainResultsSummary getParentResultSummary(ResultsSummary resultsSummary)
Description copied from interface:ResultsSummaryManager
Get (@link ChainResultsSummary} containing givenResultsSummary
- Specified by:
getParentResultSummary
in interfaceResultsSummaryManager
- Returns:
-
getStageForResult
@Nullable public @Nullable ChainStageResult getStageForResult(ResultsSummary resultsSummary)
Description copied from interface:ResultsSummaryManager
Get (@link ChainStageResult} containing givenResultsSummary
- Specified by:
getStageForResult
in interfaceResultsSummaryManager
- Returns:
-
getNumberOfResults
public long getNumberOfResults()
Description copied from interface:ResultsSummaryManager
Get number of allResultsSummary
s- Specified by:
getNumberOfResults
in interfaceResultsSummaryManager
- Returns:
- number of summaries
-
getNumberOfFinishedResults
public long getNumberOfFinishedResults(@NotNull @NotNull Plan plan)
Description copied from interface:ResultsSummaryManager
- Specified by:
getNumberOfFinishedResults
in interfaceResultsSummaryManager
- Returns:
- number of summaries
-
getNumberOfFinalizedResults
public long getNumberOfFinalizedResults(@NotNull @NotNull ImmutablePlan plan)
Description copied from interface:ResultsSummaryManager
Get number of theResultsSummary
s in aLifeCycleState.FINISHED
orLifeCycleState.NOT_BUILT
state for the givenPlan
- Specified by:
getNumberOfFinalizedResults
in interfaceResultsSummaryManager
- Returns:
- number of summaries
-
getNumberOfFinalizedResults
public long getNumberOfFinalizedResults(@NotNull @NotNull PlanKey planKey)
Description copied from interface:ResultsSummaryManager
Get number of theResultsSummary
s in aLifeCycleState.FINISHED
orLifeCycleState.NOT_BUILT
state for the givenPlan
- Specified by:
getNumberOfFinalizedResults
in interfaceResultsSummaryManager
- Returns:
- number of summaries
-
getLatestResultSummaries
public List<ResultsSummary> getLatestResultSummaries()
Description copied from interface:ResultsSummaryManager
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- Specified by:
getLatestResultSummaries
in interfaceResultsSummaryManager
- Returns:
List
ofResultsSummary
-
getLatestFailedResultSummaries
public List<ResultsSummary> getLatestFailedResultSummaries()
Description copied from interface:ResultsSummaryManager
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- Specified by:
getLatestFailedResultSummaries
in interfaceResultsSummaryManager
- Returns:
List
ofResultsSummary
-
getAverageBuildTime
public long getAverageBuildTime(@NotNull @NotNull ImmutableBuildable plan, int numberOfResults)
Description copied from interface:BuildResultsSummaryManager
Returns average build duration for given number of builds- Specified by:
getAverageBuildTime
in interfaceBuildResultsSummaryManager
numberOfResults
- - How many build results to use in the average. must be greater 0 @return Average build time. 0 if no build found.
-
getAveragePlanExecutionDuration
public long getAveragePlanExecutionDuration(@NotNull @NotNull ImmutablePlan plan, int numberOfResults)
Description copied from interface:ResultsSummaryManager
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.- Specified by:
getAveragePlanExecutionDuration
in interfaceResultsSummaryManager
numberOfResults
- amount of results to be taken into account for average calculation- Returns:
- average duration in milliseconds or 0 if there is no results
-
countResultsWithState
public int countResultsWithState(@NotNull @NotNull PlanKey planKey, int lowerBuildNumber, int upperBuildNumber, @NotNull @NotNull BuildState buildState)
Description copied from interface:ResultsSummaryManager
Counts results with a given state in a given build number range for plan.- Specified by:
countResultsWithState
in interfaceResultsSummaryManager
- Parameters:
planKey
- the key of plan to analyselowerBuildNumber
- the build number to start the count withupperBuildNumber
- the build number to end the count withbuildState
- the state that will be counted- Returns:
- the count
-
getLastResultsSummary
@Nullable public <T extends ResultsSummary> T getLastResultsSummary(@NotNull @NotNull String planKey, Class<T> aClass)
Description copied from interface:ResultsSummaryManager
Get the lastResultsSummary
for planKey andClass
- Specified by:
getLastResultsSummary
in interfaceResultsSummaryManager
- Returns:
-
getLastResultsSummary
public <T extends ResultsSummary> T getLastResultsSummary(@NotNull @NotNull String planKey, Class<T> aClass, boolean ignoreSpecsResults)
Description copied from interface:ResultsSummaryManager
Get the lastResultsSummary
for planKey andClass
with possible skip of specs results.- Specified by:
getLastResultsSummary
in interfaceResultsSummaryManager
- Returns:
-
moveResultSummaries
public void moveResultSummaries(@NotNull @NotNull Plan newParentPlan, @NotNull @NotNull PlanKey oldPlanKey, @NotNull @NotNull PlanKey newPlanKey)
Description copied from interface:ResultsSummaryManager
Reassigns plan key ResultsSummaries associated with selected plan key.- Specified by:
moveResultSummaries
in interfaceResultsSummaryManager
- Parameters:
newParentPlan
- the new parent plan of result summaries. This should be a plan, not a job.
-
scrollResultSummaries
public long scrollResultSummaries(@NotNull @NotNull String buildKey, @NotNull @NotNull com.google.common.base.Function<ResultsSummary,Void> function)
Description copied from interface:ResultsSummaryManager
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 interfaceResultsSummaryManager
- Parameters:
buildKey
- of the plan you want to scroll the result summaries forfunction
- function to be executed on each of the BuildResultSummary- Returns:
- number of traversed rows
-
scrollResultSummaries
public long scrollResultSummaries(@NotNull @NotNull String buildKey, ResultDataRead resultDataRead, @NotNull @NotNull com.google.common.base.Function<ResultsSummary,Void> function)
Description copied from interface:ResultsSummaryManager
Scroll through and execute function for each of ResultsSummary (Build and Chain) Objects passed to function are not fully initialized. Collections are empty and related objects have only id set.- Specified by:
scrollResultSummaries
in interfaceResultsSummaryManager
- Parameters:
buildKey
- of the plan you want to scroll the result summaries forresultDataRead
- if the data should be loaded lazy or eagerlyfunction
- function to be executed on each of the BuildResultSummary- Returns:
- number of traversed rows
-
removeMergeResultSummary
public void removeMergeResultSummary(@NotNull @NotNull MergeResultSummary mergeResult)
Description copied from interface:ResultsSummaryManager
Removes merge result. Use with care.- Specified by:
removeMergeResultSummary
in interfaceResultsSummaryManager
-
getPlanKeysSortedByNumberOfFinalizedResultSummaries
@NotNull public @NotNull List<PlanKey> getPlanKeysSortedByNumberOfFinalizedResultSummaries()
- Specified by:
getPlanKeysSortedByNumberOfFinalizedResultSummaries
in interfaceResultsSummaryManager
-
calculateQueueDuration
@Nullable public @Nullable Long calculateQueueDuration(@NotNull @NotNull ChainResultsSummary resultsSummary)
Description copied from interface:ResultsSummaryManager
Calculates queueDuration value for a chain result as a maximum value of (vcsUpdateTime - queueTime) for all related job results.- Specified by:
calculateQueueDuration
in interfaceResultsSummaryManager
- Parameters:
resultsSummary
-ChainResultsSummary
for which calculation has to be made- Returns:
- queueDuration value or null if there are no related
BuildResultsSummary
records
-
calculateVcsUpdateDuration
@Nullable public @Nullable Long calculateVcsUpdateDuration(@NotNull @NotNull ChainResultsSummary resultsSummary)
Description copied from interface:ResultsSummaryManager
Calculates vcsUpdateDuration value for a chain result as a maximum value of (buildDate - vcsUpdateTime) for all related job results.- Specified by:
calculateVcsUpdateDuration
in interfaceResultsSummaryManager
- Parameters:
resultsSummary
-ChainResultsSummary
for which calculation has to be made- Returns:
- vcsUpdateDuration value or null if there are no related
BuildResultsSummary
records
-
findAllBuildResultsNumbers
@NotNull public @NotNull List<Integer> findAllBuildResultsNumbers(PlanKey planKey)
- Specified by:
findAllBuildResultsNumbers
in interfaceResultsSummaryManager
-
invalidateLogSize
public void invalidateLogSize(@NotNull @NotNull PlanResultKey planResultKey)
Description copied from interface:ResultsSummaryManager
Invalidates the log size of aResultsSummary
with the givenPlanResultKey
. For aBuildResultsSummary
theChainResultsSummary
's max log size will also be invalidated.- Specified by:
invalidateLogSize
in interfaceResultsSummaryManager
- Parameters:
planResultKey
- result key
-
findChainResultsWithFormatVersionLessThan
@NotNull public @NotNull List<PlanResultKey> findChainResultsWithFormatVersionLessThan(int formatVersion, int maxResults)
- Specified by:
findChainResultsWithFormatVersionLessThan
in interfaceResultsSummaryManager
-
findBuildResultNumbersRange
@NotNull public @NotNull Range<Integer> findBuildResultNumbersRange(@NotNull @NotNull PlanKey planKey)
Description copied from interface:ResultsSummaryManager
Finds minimum and maximum build number for a plan. Works for both chains and jobs.- Specified by:
findBuildResultNumbersRange
in interfaceResultsSummaryManager
- Returns:
- (min, max) pair or (0,0) if there are no results.
-
findJobKeysFromExistingChainResults
@NotNull public @NotNull List<PlanKey> findJobKeysFromExistingChainResults(@NotNull @NotNull PlanKey chainKey)
Description copied from interface:ResultsSummaryManager
Find keys of jobs for which results associated with given plan exist. The jobs themselves might no longer exist. Internal use only- Specified by:
findJobKeysFromExistingChainResults
in interfaceResultsSummaryManager
-
findMinimumBuildNumberForNLatest
public int findMinimumBuildNumberForNLatest(@NotNull @NotNull PlanKey planKey, int n)
Description copied from interface:ResultsSummaryManager
Find a build number for which exist n non-specs results with a build number greater or equal. If the build has less that n such results, the lowest build number is returned.- Specified by:
findMinimumBuildNumberForNLatest
in interfaceResultsSummaryManager
-
setBuildResultsSummaryDao
public void setBuildResultsSummaryDao(BuildResultsSummaryDao buildResultsSummaryDao)
-
setExtendedAuthorManager
public void setExtendedAuthorManager(ExtendedAuthorManager extendedAuthorManager)
-
setEventPublisher
public void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)
-
setJiraIssueUtils
public void setJiraIssueUtils(JiraIssueUtils jiraIssueUtils)
-
setArtifactLinkManager
public void setArtifactLinkManager(ArtifactLinkManager artifactLinkManager)
-
setCommitDao
public void setCommitDao(CommitDao commitDao)
-
setBuildExecutionManager
public void setBuildExecutionManager(BuildExecutionManager buildExecutionManager)
-
setRepositoryDefinitionManager
public void setRepositoryDefinitionManager(RepositoryDefinitionManager repositoryDefinitionManager)
-
setCommentManager
public void setCommentManager(CommentManager commentManager)
-
setBranchIntegrationService
public void setBranchIntegrationService(BranchIntegrationService branchIntegrationService)
-
setMergeResultSummaryDao
public void setMergeResultSummaryDao(MergeResultSummaryDao mergeResultSummaryDao)
-
setVariableContextBaselineDao
public void setVariableContextBaselineDao(VariableContextBaselineDao variableContextBaselineDao)
-
setVcsRepositoryManager
public void setVcsRepositoryManager(VcsRepositoryManager vcsRepositoryManager)
-
setPlanManager
public void setPlanManager(PlanManager planManager)
-
-