com.atlassian.bamboo.resultsummary
Class BuildResultsSummaryHibernateDao

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate.support.HibernateDaoSupport
          extended by com.atlassian.bamboo.persistence3.BambooHibernateObjectDao<ResultsSummary>
              extended by com.atlassian.bamboo.resultsummary.BuildResultsSummaryHibernateDao
All Implemented Interfaces:
BambooObjectDao<ResultsSummary>, BuildResultsSummaryDao, org.springframework.beans.factory.InitializingBean

public class BuildResultsSummaryHibernateDao
extends BambooHibernateObjectDao<ResultsSummary>
implements BuildResultsSummaryDao


Field Summary
protected static java.lang.String BUILD_AGENT_ID
           
protected static java.lang.String BUILD_COMPLETED_DATE
           
protected static java.lang.String BUILD_NUMBER
           
protected static java.lang.String BUILD_STATE
           
protected static java.lang.String CREATION_DATE
           
protected static java.lang.String DELTA_STATE
           
protected static java.lang.String LIFE_CYCLE_STATE
           
protected static java.lang.String PLAN_KEY
           
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Fields inherited from interface com.atlassian.bamboo.resultsummary.BuildResultsSummaryDao
NUMBER_OF_DAYS_TO_FILTER
 
Constructor Summary
BuildResultsSummaryHibernateDao()
           
 
Method Summary
 int countBuildResultsSummaries()
          Count all result summaries records.
 int countBuildResultsSummaries(long agentId, BuildState buildState)
          Count how many build results match the agent & optional build state.
 int countBuildResultsSummaries(java.lang.String planKey)
           
 int countResultsWithState(PlanKey planKey, int lowerBuildNumber, int upperBuildNumber, BuildState buildState)
          Counts results with a given state in a given build number range for plan.
 java.util.List<ResultsSummary> findBuildResultsSummariesByJiraIssues(java.util.List<java.lang.String> issueKeys)
          Get a list of results summaries associated with the list of issue keys.
 java.util.List<ResultsSummary> findBuildResultsSummariesByProjectKey(java.lang.String jiraProjectKey)
          Retrieve a list of results summaries associated with given JIRA project key This will not return records marked for deletion.
 java.util.List<Pair<ArtifactLink,BuildResultsSummary>> findBuildResultsWithArtifacts(java.lang.String planKey)
          Find all build results which have matching artifacts.
 java.util.List<BuildResultsSummary> findBuildsForImageConfiguration(java.lang.String planKey, ElasticImageConfiguration elasticImage, BuildState buildState, int maxResults)
          Searcher for builds of an image
<E extends ResultsSummary>
E
findById(long id, java.lang.Class<E> aClass)
          Find an entity by its id
 java.util.List<ChainResultsSummary> findChainResultsWithJobLabelled(ResultsSummaryCriteria queryCriteria, java.util.List<Label> labels)
          Searches through all chains to find any that have jobs which match the given labels.
 java.lang.Integer findFirstBuildNumberAfter(java.lang.String planKey, int buildNumber)
          Returns the build number of next existing build results.
 ResultsSummary findFirstBuildResultWithBuildStateAfter(java.lang.String planKey, int buildNumber, BuildState buildState)
          Finds the last successful BuildResultsSummary after buildNumber
 ResultsSummary findFirstBuildResultWithBuildStateBetween(java.lang.String planKey, int lowerBuildNumber, int upperBuildNumber, BuildState buildState)
          Returns the first build that matches BuildState between the given build number range Note that this function is inclusive of the upper and lower bound
<T extends ResultsSummary>
T
findFirstResultAfter(java.lang.String planKey, int buildNumber, java.lang.Class<T> aClass)
          Finds the first successful or failed BuildResultsSummary after buildNumber
 java.lang.Integer findLastBuildNumberBefore(java.lang.String planKey, int buildNumber)
          Returns the build number of previous existing build results.
<T extends ResultsSummary>
T
findLastBuildResultBeforeWithTests(PlanResultKey planResultKey, java.lang.Class<T> aClass)
           
 ResultsSummary findLastBuildResultWithBuildStateBefore(java.lang.String planKey, int buildNumber, BuildState buildState)
          Finds the last BuildResultsSummary before buildNumber with BuildState
<T extends ResultsSummary>
T
findLastResultBefore(java.lang.String planKey, int buildNumber, java.lang.Class<T> aClass)
          Finds the last successful or failed ResultsSummary before buildNumber
<T extends ResultsSummary>
T
findLastResultSummaryWithState(PlanKey planKey, BuildState buildState, java.lang.Class<T> aClass)
           
 java.util.List<ResultsSummary> findLatestFailedResultSummaries()
          Find the failed result summaries for all TopLevelPlans in Bamboo that have occurred in the last X days, where x is the constant NUMBER_OF_DAYS_TO_FILTER
 java.util.List<ResultsSummary> findLatestResultsSummaries()
          Find the result summaries for all TopLevelPlans in Bamboo that have occurred in the last X days, where x is the constant NUMBER_OF_DAYS_TO_FILTER
 Pair<java.lang.Integer,java.lang.Iterable<PlanKey>> findPlanKeysFromAllOrphanedResultSummaries()
          Scans database for all the ResultsSummary objects in the database that do not have a matching Plan
<T extends ResultsSummary>
java.util.List<T>
findResultsSummaries(ResultsSummaryCriteria criteria)
          Searches for ResultsSummary objects given a ResultsSummaryCriteria.
<T extends ResultsSummary>
java.util.Collection<T>
getAllActiveResultSummariesForPlan(PlanKey planKey, java.lang.Class<T> aClass)
          Returns all the ResultsSummary in a LifeCycleState.PENDING, LifeCycleState.QUEUED, LifeCycleState.IN_PROGRESS state with the given Class See also LifeCycleState.isActive(LifeCycleState) and ResultsSummary.isActive()
<T extends ResultsSummary>
java.util.Collection<T>
getAllBuildResultSummariesInBuildState(BuildState state, java.lang.Class<T> aClass)
          Returns all the BuildResultsSummary in requested build state.
<T extends ResultsSummary>
java.util.Collection<T>
getAllBuildResultSummariesInLifeCycleState(LifeCycleState state, java.lang.Class<T> aClass)
          Returns all the BuildResultsSummary in requested lifecycle state.
<T extends ResultsSummary>
java.util.Collection<T>
getAllBuildResultSummariesInUnknownState(java.lang.Class<T> aClass)
          Returns all the BuildResultsSummary in a BuildState.UNKNOWN state This will not return records marked for deletion.
 java.util.Collection<BuildResultsSummary> getAllInProgressBuildResultSummaries()
          Returns all the BuildResultsSummary in a LifeCycleState.IN_PROGRESS state This will not return records marked for deletion.
<T extends ResultsSummary>
java.util.Collection<T>
getAllInProgressResultSummaries(java.lang.Class<T> aClass)
          Returns all the ResultsSummary in a LifeCycleState.IN_PROGRESS state with the given Class This will not return records marked for deletion.
<T extends ResultsSummary>
java.util.Collection<T>
getAllPendingResultSummaries(java.lang.Class<T> aClass)
          Returns all the ResultsSummary in a LifeCycleState.PENDING state with the given Class This will not return records marked for deletion.
<T extends ResultsSummary>
java.util.Collection<T>
getAllQueuedResultSummaries(java.lang.Class<T> aClass)
          Returns all the ResultsSummary in a LifeCycleState.QUEUED state with the given Class This will not return records marked for deletion.
<T extends ResultsSummary>
java.util.List<T>
getAllResultSummariesForPlan(Plan plan)
          Get all the ResultsSummarys for the given Plan
 ResultsSummary getBreakingBuild(ResultsSummary summary)
           
 BuildResultsSummary getBuildResultsSummaryByBuildKeyAndBuildNumber(java.lang.String buildKey, int buildNumber)
          Lookup BuildResultsSummary by buildKey and buildNumber
 ChainStageResult getChainStageResultById(long id)
          Returns a ChainStageResult by its id
<T extends ResultsSummary>
java.util.List<T>
getFinalizedResultSummariesForPlan(PlanKey planKey, java.lang.Class<T> aClass, int firstResult, int maxResults)
          Returns all the ResultsSummary in a LifeCycleState.FINISHED or LifeCycleState.NOT_BUILT state with the given Class.
 BuildResultsSummary getFirstBuildSummary(Plan plan)
          Returns the first available BuildResultsSummary for the given Plan
 BuildResultsSummary getFirstBuildSummary(PlanKey planKey)
          Returns the first available BuildResultsSummary for the given PlanKey
 ResultsSummary getFixingBuild(ResultsSummary summary)
          Returns the first successful BuildResultsSummary for given BuildResultsSummary.
 java.util.List<LinkedJiraIssue> getJiraIssuesForBuild(Plan plan)
          Retrieves a list of LinkedJiraIssue that are linked to the given build.
 java.util.List<LinkedJiraIssue> getJiraIssuesForBuildResults(java.util.List<ResultsSummary> buildResults)
          Retrieves a list of LinkedJiraIssue linked to the given build result summaries
<T extends ResultsSummary>
T
getLastResultSummary(java.lang.String planKey, java.lang.Class<T> aClass)
          Returns the latest completed ResultsSummary for the plan represented by planKey
 java.util.List<ResultsSummary> getNeighbouringSummaries(ImmutablePlan plan, int currentBuildNumber, int neighbouringSummariesMaxCount)
          Returns build results "around" given build number
 java.util.List<ResultsSummary> getNeighbouringSummaries(Plan plan, int currentBuildNumber)
          Returns build results "around" given build number
 int getNumberOfConcurrentlyRunningBuilds(PlanKey planKey)
          Get the number of concurrently running builds for planKey
 long getNumberOfFinalizedResults(Plan plan)
          Get number of the ResultsSummarys or LifeCycleState.NOT_BUILT state for the given Plan
 long getNumberOfFinishedResults(Plan plan)
          Returns the number of finished results available for the given Plan
 ChainResultsSummary getParentResultSummary(ResultsSummary summary)
          Get (@link ChainResultsSummary} containing given ResultsSummary
<T extends ResultsSummary>
T
getResultsSummary(PlanResultKey planResultKey, java.lang.Class<T> aClass)
          Lookup ResultsSummary by PlanResultKey and expected type
<T extends ResultsSummary>
T
getResultsSummary(PlanResultKey planResultKey, java.lang.Class<T> aClass, ResultDataRead dataRead)
          Lookup ResultsSummary by PlanResultKey and expected type, all lazy initialized collections can be eagerly read
 java.lang.Long getResultsSummaryId(PlanResultKey planResultKey)
          Return ResultsSummary's database id.
<T extends ResultsSummary>
java.util.List<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.
<T extends ResultsSummary>
java.util.List<T>
getResultSummariesForPlanByLifeCycleState(Plan plan, LifeCycleState lifeCycleState, int firstResult, int maxResults)
          Get the ResultsSummarys for the given Plan in give LifeCycleState that are Results are sorted by build number (descending).
 ChainStageResult getStageForResult(ResultsSummary summary)
          Get (@link ChainStageResult} containing given ResultsSummary
 int markResultSummariesForDeletion(PlanKey planKey)
          Mass update of all ResultsSummary records in the database related to a Plan identified by planKey.
 int removeResultsSummariesForPlan(PlanKey planKey)
          Remove all resultSummary objects for the given plan.
 void removeResultsSummary(ResultsSummary resultsSummary)
          Removes the passed result summary
 long scrollJiraIssuesForExport(com.google.common.base.Function<LinkedJiraIssue,java.lang.Void> function)
          Scroll through and execute function for each of LinkedJiraIssue Objects passed to function are not fully initialized.
 long scrollResultSummaries(java.lang.String buildKey, ResultDataRead dataRead, com.google.common.base.Function<ResultsSummary,java.lang.Void> function)
          Scroll through and execute function for each of BuildResultsSummary Objects passed to function are not fully initialized.
 long scrollVariableSubstitutionForExport(com.google.common.base.Function<VariableSubstitution,java.lang.Void> function)
          Scroll through and execute function for each of VariableSubstitution Objects passed to function are not fully initialized.
 void setPlanDiscriminatorRegistry(PlanDiscriminatorRegistry planDiscriminatorRegistry)
           
 void setResultsSummaryDiscriminatorRegistry(ResultsSummaryDiscriminatorRegistry resultsSummaryDiscriminatorRegistry)
           
 
Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateObjectDao
delete, deleteAll, executeReturnLong, findAll, save, saveAll
 
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.bamboo.persistence3.BambooObjectDao
delete, deleteAll, executeReturnLong, findAll, save, saveAll
 

Field Detail

CREATION_DATE

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

BUILD_COMPLETED_DATE

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

BUILD_AGENT_ID

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

BUILD_NUMBER

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

PLAN_KEY

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

BUILD_STATE

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

LIFE_CYCLE_STATE

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

DELTA_STATE

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

BuildResultsSummaryHibernateDao

public BuildResultsSummaryHibernateDao()
Method Detail

getResultsSummaryId

public java.lang.Long getResultsSummaryId(@NotNull
                                          PlanResultKey planResultKey)
Description copied from interface: BuildResultsSummaryDao
Return ResultsSummary's database id. This method is intended for internal use (currently in importer)

Specified by:
getResultsSummaryId in interface BuildResultsSummaryDao
Parameters:
planResultKey - plan result key of ResultsSummary to be found
Returns:
id of ResultsSummary or null if not found

getResultsSummary

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

Specified by:
getResultsSummary in interface BuildResultsSummaryDao
Returns:
resultSummary

getResultsSummary

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

Specified by:
getResultsSummary in interface BuildResultsSummaryDao
Returns:
resultSummary

findById

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

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

getAllBuildResultSummariesInBuildState

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

Specified by:
getAllBuildResultSummariesInBuildState in interface BuildResultsSummaryDao
Returns:
summaries

getAllBuildResultSummariesInLifeCycleState

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

Specified by:
getAllBuildResultSummariesInLifeCycleState in interface BuildResultsSummaryDao
Returns:
summaries

getAllBuildResultSummariesInUnknownState

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

Specified by:
getAllBuildResultSummariesInUnknownState in interface BuildResultsSummaryDao
Returns:
summaries

getAllPendingResultSummaries

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

Specified by:
getAllPendingResultSummaries in interface BuildResultsSummaryDao
Returns:
summaries

getAllQueuedResultSummaries

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

Specified by:
getAllQueuedResultSummaries in interface BuildResultsSummaryDao
Returns:
summaries

getAllInProgressResultSummaries

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

Specified by:
getAllInProgressResultSummaries in interface BuildResultsSummaryDao
Returns:
summaries

getAllActiveResultSummariesForPlan

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

Specified by:
getAllActiveResultSummariesForPlan in interface BuildResultsSummaryDao
Returns:
summaries

getFinalizedResultSummariesForPlan

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

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

getNumberOfConcurrentlyRunningBuilds

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

Specified by:
getNumberOfConcurrentlyRunningBuilds in interface BuildResultsSummaryDao
Returns:

getAllInProgressBuildResultSummaries

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

Specified by:
getAllInProgressBuildResultSummaries in interface BuildResultsSummaryDao
Returns:
summaries

getBuildResultsSummaryByBuildKeyAndBuildNumber

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

Specified by:
getBuildResultsSummaryByBuildKeyAndBuildNumber in interface BuildResultsSummaryDao
Returns:
summary

findResultsSummaries

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

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

removeResultsSummariesForPlan

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

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

findPlanKeysFromAllOrphanedResultSummaries

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

Specified by:
findPlanKeysFromAllOrphanedResultSummaries in interface BuildResultsSummaryDao
Returns:
number of orphaned ResultsSummarys and list of distinct PlanKeys they reference.

countBuildResultsSummaries

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

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

countBuildResultsSummaries

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

countBuildResultsSummaries

public int countBuildResultsSummaries()
Description copied from interface: BuildResultsSummaryDao
Count all result summaries records. This will not count records marked for deletion.

Specified by:
countBuildResultsSummaries in interface BuildResultsSummaryDao
Returns:

findBuildsForImageConfiguration

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

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

findBuildResultsWithArtifacts

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

Specified by:
findBuildResultsWithArtifacts in interface BuildResultsSummaryDao
Returns:

getResultSummariesByChangeSetId

public <T extends ResultsSummary> java.util.List<ResultWithPlanInfo<T>> getResultSummariesByChangeSetId(@NotNull
                                                                                                        java.lang.String changeSetId,
                                                                                                        java.lang.Class<T> discriminator)
Description copied from interface: BuildResultsSummaryDao
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 This will not return records marked for deletion. N.B. plan info will only work for top level plans

Specified by:
getResultSummariesByChangeSetId in interface BuildResultsSummaryDao
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

findBuildResultsSummariesByJiraIssues

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

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

findBuildResultsSummariesByProjectKey

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

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

removeResultsSummary

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

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

getFirstBuildSummary

@Nullable
public BuildResultsSummary getFirstBuildSummary(@NotNull
                                                         Plan plan)
Description copied from interface: BuildResultsSummaryDao
Returns the first available BuildResultsSummary for the given Plan

Specified by:
getFirstBuildSummary in interface BuildResultsSummaryDao
Returns:
buildResult

getFirstBuildSummary

public BuildResultsSummary getFirstBuildSummary(@NotNull
                                                PlanKey planKey)
Description copied from interface: BuildResultsSummaryDao
Returns the first available BuildResultsSummary for the given PlanKey

Specified by:
getFirstBuildSummary in interface BuildResultsSummaryDao
Returns:
buildResult

getLastResultSummary

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

Specified by:
getLastResultSummary in interface BuildResultsSummaryDao
Returns:
buildResult

findFirstBuildNumberAfter

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

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

findLastBuildNumberBefore

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

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

getNumberOfFinishedResults

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

Specified by:
getNumberOfFinishedResults in interface BuildResultsSummaryDao
Returns:
numberOfResults

getNumberOfFinalizedResults

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

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

getNeighbouringSummaries

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

Specified by:
getNeighbouringSummaries in interface BuildResultsSummaryDao
Returns:

getNeighbouringSummaries

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

Specified by:
getNeighbouringSummaries in interface BuildResultsSummaryDao
Returns:

getBreakingBuild

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

getFixingBuild

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

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

getJiraIssuesForBuildResults

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

Specified by:
getJiraIssuesForBuildResults in interface BuildResultsSummaryDao
Returns:

getJiraIssuesForBuild

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

Specified by:
getJiraIssuesForBuild in interface BuildResultsSummaryDao
Returns:

scrollJiraIssuesForExport

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

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

scrollVariableSubstitutionForExport

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

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

findFirstResultAfter

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

Specified by:
findFirstResultAfter in interface BuildResultsSummaryDao
Returns:
buildResult

findLastResultBefore

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

Specified by:
findLastResultBefore in interface BuildResultsSummaryDao
Returns:
buildResult

findLastBuildResultBeforeWithTests

public <T extends ResultsSummary> T findLastBuildResultBeforeWithTests(@NotNull
                                                                       PlanResultKey planResultKey,
                                                                       @NotNull
                                                                       java.lang.Class<T> aClass)
Specified by:
findLastBuildResultBeforeWithTests in interface BuildResultsSummaryDao
Type Parameters:
T - of result
Parameters:
planResultKey - of the result
aClass - of
Returns:
resultsSummary

findFirstBuildResultWithBuildStateAfter

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

Specified by:
findFirstBuildResultWithBuildStateAfter in interface BuildResultsSummaryDao
Returns:
buildResult

findLastBuildResultWithBuildStateBefore

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

Specified by:
findLastBuildResultWithBuildStateBefore in interface BuildResultsSummaryDao
Returns:
buildResult

findFirstBuildResultWithBuildStateBetween

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

Specified by:
findFirstBuildResultWithBuildStateBetween in interface BuildResultsSummaryDao
Returns:
buildResult

scrollResultSummaries

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

Specified by:
scrollResultSummaries in interface BuildResultsSummaryDao
Parameters:
buildKey - of the plan you want to scroll the result summaries for
dataRead - if the data should be loaded lazy or eagerly
function - function to be executed on each of the BuildResultSummary
Returns:
number of traversed rows

getChainStageResultById

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

Specified by:
getChainStageResultById in interface BuildResultsSummaryDao
Returns:
chainStageResult

getAllResultSummariesForPlan

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

Specified by:
getAllResultSummariesForPlan in interface BuildResultsSummaryDao
Returns:
summaries

getResultSummariesForPlan

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

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

getResultSummariesForPlanByLifeCycleState

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

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

getParentResultSummary

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

Specified by:
getParentResultSummary in interface BuildResultsSummaryDao
Returns:

getStageForResult

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

Specified by:
getStageForResult in interface BuildResultsSummaryDao
Returns:

findLatestResultsSummaries

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

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

findLatestFailedResultSummaries

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

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

findChainResultsWithJobLabelled

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

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

    findLastResultSummaryWithState

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

    countResultsWithState

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

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

    markResultSummariesForDeletion

    public int markResultSummariesForDeletion(@NotNull
                                              PlanKey planKey)
    Description copied from interface: BuildResultsSummaryDao
    Mass update of all ResultsSummary records in the database related to a Plan identified by planKey.

    Specified by:
    markResultSummariesForDeletion in interface BuildResultsSummaryDao
    Parameters:
    planKey - key of a plan
    Returns:
    number of updated records

    setResultsSummaryDiscriminatorRegistry

    public void setResultsSummaryDiscriminatorRegistry(ResultsSummaryDiscriminatorRegistry resultsSummaryDiscriminatorRegistry)

    setPlanDiscriminatorRegistry

    public void setPlanDiscriminatorRegistry(PlanDiscriminatorRegistry planDiscriminatorRegistry)


    Copyright © 2012 Atlassian. All Rights Reserved.