Class DeploymentResultDaoImpl
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
com.atlassian.bamboo.deployments.results.persistence.DeploymentResultDaoImpl
- All Implemented Interfaces:
DeploymentResultDao
,org.springframework.beans.factory.InitializingBean
public class DeploymentResultDaoImpl
extends StatelessSessionHibernateDaoSupport
implements DeploymentResultDao
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
-
Constructor Summary
ConstructorDescriptionDeploymentResultDaoImpl
(TransactionAndHibernateTemplate transactionTemplate) -
Method Summary
Modifier and TypeMethodDescriptionint
countDeploymentResultsForEnvironment
(long environmentId) Count deployment results for deployment.int
delete
(@NotNull EnvironmentDeletionAdapter environmentDeletionAdapter) Delete - DEPLOYMENT_RESULT_CUSTOMDATA (manual, JDBC) - DEPLOYMENT_RESULT (manual, JDBC) - WEBHOOK_RESPONSE (manual, JDBC)int
delete
(@NotNull DeploymentResultDeletionAdapter deletionAdapter) Delete - DEPLOYMENT_RESULT_CUSTOMDATA (manual, JDBC) - DEPLOYMENT_RESULT (manual, JDBC) - WEBHOOK_RESPONSE (manual, JDBC)void
delete
(MutableDeploymentResult deploymentResult) Delete Deployment Result.findEnvironmentIdsVersionWasDeployedOn
(long deploymentVersionId) @Nullable MutableDeploymentResult
getDeploymentResult
(long deploymentResultId) Get DeploymentResult by idgetDeploymentResultIdsForDeploymentVersionFinishedBefore
(long deploymentVersionId, @NotNull Date finishDate) Get a list of result ids for a DeploymentVersion.@NotNull List<MutableDeploymentResult>
getDeploymentResults
(long environmentId, long deploymentVersionId) Retrieve all deployment results that exist for an environment and version.@NotNull List<MutableDeploymentResult>
getDeploymentResultsByLifeCycleState
(Collection<LifeCycleState> lifeCycleStates) @NotNull List<DeploymentResultDto>
getDeploymentResultsDtosForEnvironment
(long environmentId, int offset, int maxResults) Get the latest deployment results for an Environment, limited to requested amount starting from requested start index.@NotNull List<MutableDeploymentResult>
getDeploymentResultsForDeploymentVersion
(long deploymentVersionId) Get a list of DeploymentResults for a DeploymentVersion.@NotNull List<MutableDeploymentResult>
getDeploymentResultsForDeploymentVersionFinishedBefore
(long deploymentVersionId, Date finishedDate) Get a list of DeploymentResults for a DeploymentVersion.@NotNull List<MutableDeploymentResult>
getDeploymentResultsForEnvironment
(long environmentId) Get a list of DeploymentResults for a Environment WARNING: This method will fetch all results, potentially creating performance problem.@NotNull List<MutableDeploymentResult>
getDeploymentResultsForEnvironment
(long environmentId, int offset, int maxResults) Get a list of DeploymentResults for a Environment@Nullable MutableDeploymentResult
getLastResultBefore
(@NotNull DeploymentResult deploymentResult) @Nullable MutableDeploymentResult
getLastResultInStatesBefore
(@NotNull DeploymentResult deploymentResult, @NotNull EnumSet<BuildState> buildStates) @Nullable MutableDeploymentResult
getLatestDeploymentResult
(long environmentId, long deploymentVersionId) Retrieve the latest deployment result that exists for a version on an environment.@Nullable MutableDeploymentResult
getLatestDeploymentResultForEnvironment
(long environmentId) Get the latest result that ran against an environmentRetrieve the latest deployment result for every deployment environment.@NotNull List<MutableDeploymentResult>
getLatestDeploymentResultsForEnvironment
(long environmentId, int startIndex, int maxResults) Get the latest deployment results for an Environment, limited to requested amount starting from requested start index.getLatestDeploymentResultsForEnvironments
(@NotNull List<Long> environmentIds) Retrieve the latest deployment result for deployment environments.@Nullable DeploymentResultDto
getLatestKnownDeploymentResultDtoForEnvironment
(long environmentId) Get the latest result that *actually* ran against an environments.@Nullable MutableDeploymentResult
getLatestKnownDeploymentResultForEnvironment
(long environmentId) Get the latest result that *actually* ran against an environments.getLatestStatusForEnvironments
(@NotNull List<Long> environmentIds) Get minimum status data for listed environment ids.@Nullable MutableDeploymentResult
getRollbackDeploymentResultBeforeStartedDate
(@NotNull DeploymentResult deploymentResult) Find the result successfully deployed on same environment before given deployment result coming from different deployment version@Nullable MutableDeploymentResult
getRollbackDeploymentResultForEnvironment
(long environmentId, long latestVersionId) Find the result that you are trying to replicate by doing a rollback.@NotNull List<MutableDeploymentResult>
getSuccessfulDeploymentResultsForEnvironment
(long environmentId, int offset, int maxResults) Get a list of DeploymentResults successfully deployed to an Environmentlong
iterateResultsForExport
(@NotNull Consumer<MutableDeploymentResult> consumer) Iterate through and execute function for each of MutableDeploymentResultvoid
save
(MutableDeploymentResult deploymentResult) Save DeploymentResultint
unlinkFromVersion
(@NotNull DeploymentVersionDeletionAdapter deletionAdapter) Unlink DeploymentResults records limited byDeletionSQLAdapter.getInClause()
from deployment version.void
updateVersionName
(long deploymentVersionId, @NotNull String newVersionName) Updates version name in all results related to a vesionMethods inherited from class com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
getCacheAwareHibernateTemplate
Methods inherited from class org.springframework.orm.hibernate5.support.HibernateDaoSupport
checkDaoConfig, createHibernateTemplate, currentSession, getHibernateTemplate, getSessionFactory, setHibernateTemplate, setSessionFactory
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
-
Constructor Details
-
DeploymentResultDaoImpl
-
-
Method Details
-
getDeploymentResult
Description copied from interface:DeploymentResultDao
Get DeploymentResult by id- Specified by:
getDeploymentResult
in interfaceDeploymentResultDao
-
getDeploymentResultsByLifeCycleState
@NotNull public @NotNull List<MutableDeploymentResult> getDeploymentResultsByLifeCycleState(Collection<LifeCycleState> lifeCycleStates) - Specified by:
getDeploymentResultsByLifeCycleState
in interfaceDeploymentResultDao
-
save
Description copied from interface:DeploymentResultDao
Save DeploymentResult- Specified by:
save
in interfaceDeploymentResultDao
-
getDeploymentResultsForEnvironment
@NotNull public @NotNull List<MutableDeploymentResult> getDeploymentResultsForEnvironment(long environmentId) Description copied from interface:DeploymentResultDao
Get a list of DeploymentResults for a Environment WARNING: This method will fetch all results, potentially creating performance problem.- Specified by:
getDeploymentResultsForEnvironment
in interfaceDeploymentResultDao
- Parameters:
environmentId
- id of Environment
-
getDeploymentResultsForEnvironment
@NotNull public @NotNull List<MutableDeploymentResult> getDeploymentResultsForEnvironment(long environmentId, int offset, int maxResults) Description copied from interface:DeploymentResultDao
Get a list of DeploymentResults for a Environment- Specified by:
getDeploymentResultsForEnvironment
in interfaceDeploymentResultDao
- Parameters:
environmentId
- id of Environment
-
getDeploymentResultsDtosForEnvironment
@NotNull public @NotNull List<DeploymentResultDto> getDeploymentResultsDtosForEnvironment(long environmentId, int offset, int maxResults) Description copied from interface:DeploymentResultDao
Get the latest deployment results for an Environment, limited to requested amount starting from requested start index.- Specified by:
getDeploymentResultsDtosForEnvironment
in interfaceDeploymentResultDao
-
getSuccessfulDeploymentResultsForEnvironment
@NotNull public @NotNull List<MutableDeploymentResult> getSuccessfulDeploymentResultsForEnvironment(long environmentId, int offset, int maxResults) Description copied from interface:DeploymentResultDao
Get a list of DeploymentResults successfully deployed to an Environment- Specified by:
getSuccessfulDeploymentResultsForEnvironment
in interfaceDeploymentResultDao
- Parameters:
environmentId
- id of Environment
-
countDeploymentResultsForEnvironment
public int countDeploymentResultsForEnvironment(long environmentId) Description copied from interface:DeploymentResultDao
Count deployment results for deployment.- Specified by:
countDeploymentResultsForEnvironment
in interfaceDeploymentResultDao
- Returns:
-
getLatestDeploymentResultsForEnvironment
@NotNull public @NotNull List<MutableDeploymentResult> getLatestDeploymentResultsForEnvironment(long environmentId, int startIndex, int maxResults) Description copied from interface:DeploymentResultDao
Get the latest deployment results for an Environment, limited to requested amount starting from requested start index.- Specified by:
getLatestDeploymentResultsForEnvironment
in interfaceDeploymentResultDao
- Parameters:
environmentId
- of the environmentstartIndex
- the index to which start. Latest deployment is at index 0; (ignored if below zero)maxResults
- how many results to retrieve, (ignored if equal to or below zero)- Returns:
- subset of latest deployment results
-
getDeploymentResultsForDeploymentVersion
@NotNull public @NotNull List<MutableDeploymentResult> getDeploymentResultsForDeploymentVersion(long deploymentVersionId) Description copied from interface:DeploymentResultDao
Get a list of DeploymentResults for a DeploymentVersion. Records are sorted by deployment start date. TODO: this method is a potential problem due to performance reasons- Specified by:
getDeploymentResultsForDeploymentVersion
in interfaceDeploymentResultDao
- Parameters:
deploymentVersionId
- id of DeploymentVersion
-
getDeploymentResultsForDeploymentVersionFinishedBefore
@NotNull public @NotNull List<MutableDeploymentResult> getDeploymentResultsForDeploymentVersionFinishedBefore(long deploymentVersionId, Date finishedDate) Description copied from interface:DeploymentResultDao
Get a list of DeploymentResults for a DeploymentVersion. Records are sorted by deployment start date.- Specified by:
getDeploymentResultsForDeploymentVersionFinishedBefore
in interfaceDeploymentResultDao
- Parameters:
deploymentVersionId
- id of DeploymentVersionfinishedDate
- only select results finished before this date
-
getDeploymentResultIdsForDeploymentVersionFinishedBefore
@NotNull public @NotNull List<Long> getDeploymentResultIdsForDeploymentVersionFinishedBefore(long deploymentVersionId, @NotNull @NotNull Date finishDate) Description copied from interface:DeploymentResultDao
Get a list of result ids for a DeploymentVersion. Records are sorted by deployment start date (oldest first).- Specified by:
getDeploymentResultIdsForDeploymentVersionFinishedBefore
in interfaceDeploymentResultDao
- Parameters:
deploymentVersionId
- id of DeploymentVersionfinishDate
- only select results finished before this date
-
getDeploymentResults
@NotNull public @NotNull List<MutableDeploymentResult> getDeploymentResults(long environmentId, long deploymentVersionId) Description copied from interface:DeploymentResultDao
Retrieve all deployment results that exist for an environment and version. There are no restrictions for how many times. Performance should not be a huge problem with this method as we do not expect too many results for one version going to an specific environment you can deploy a version to an environment.- Specified by:
getDeploymentResults
in interfaceDeploymentResultDao
- Parameters:
environmentId
- of the environmentdeploymentVersionId
- of the version- Returns:
- deployment result for a version against an environment.
-
getLatestDeploymentResult
@Nullable public @Nullable MutableDeploymentResult getLatestDeploymentResult(long environmentId, long deploymentVersionId) Description copied from interface:DeploymentResultDao
Retrieve the latest deployment result that exists for a version on an environment.- Specified by:
getLatestDeploymentResult
in interfaceDeploymentResultDao
- Parameters:
environmentId
- of the environmentdeploymentVersionId
- of the version- Returns:
- Latest deployment result if exists
-
getLatestDeploymentResultForEnvironment
@Nullable public @Nullable MutableDeploymentResult getLatestDeploymentResultForEnvironment(long environmentId) Description copied from interface:DeploymentResultDao
Get the latest result that ran against an environment- Specified by:
getLatestDeploymentResultForEnvironment
in interfaceDeploymentResultDao
- Parameters:
environmentId
- id of the environment- Returns:
- the latest result. Null if not run
-
getLatestKnownDeploymentResultForEnvironment
@Nullable public @Nullable MutableDeploymentResult getLatestKnownDeploymentResultForEnvironment(long environmentId) Description copied from interface:DeploymentResultDao
Get the latest result that *actually* ran against an environments. Any NOT_BUILT results are skipped, so you can see the latest known state of that particular environment. ConsiderDeploymentResultDao.getLatestKnownDeploymentResultDtoForEnvironment(long)
, which scales better.- Specified by:
getLatestKnownDeploymentResultForEnvironment
in interfaceDeploymentResultDao
- Parameters:
environmentId
- id of the environment- Returns:
- the latest results.
-
getLatestKnownDeploymentResultDtoForEnvironment
@Nullable public @Nullable DeploymentResultDto getLatestKnownDeploymentResultDtoForEnvironment(long environmentId) Description copied from interface:DeploymentResultDao
Get the latest result that *actually* ran against an environments. Any NOT_BUILT results are skipped, so you can see the latest known state of that particular environment. This version scales better thanDeploymentResultDao.getLatestKnownDeploymentResultForEnvironment(long)
- Specified by:
getLatestKnownDeploymentResultDtoForEnvironment
in interfaceDeploymentResultDao
- Parameters:
environmentId
- id of the environment- Returns:
- the latest results.
-
getRollbackDeploymentResultForEnvironment
@Nullable public @Nullable MutableDeploymentResult getRollbackDeploymentResultForEnvironment(long environmentId, long latestVersionId) Description copied from interface:DeploymentResultDao
Find the result that you are trying to replicate by doing a rollback. Looks back until it finds a successful result that is not the same version as the one currently deployed- Specified by:
getRollbackDeploymentResultForEnvironment
in interfaceDeploymentResultDao
- Parameters:
environmentId
- if the environment to find rollback forlatestVersionId
- id of the version currently on the environment- Returns:
- result
-
getRollbackDeploymentResultBeforeStartedDate
@Nullable public @Nullable MutableDeploymentResult getRollbackDeploymentResultBeforeStartedDate(@NotNull @NotNull DeploymentResult deploymentResult) Description copied from interface:DeploymentResultDao
Find the result successfully deployed on same environment before given deployment result coming from different deployment version- Specified by:
getRollbackDeploymentResultBeforeStartedDate
in interfaceDeploymentResultDao
- Returns:
-
delete
Description copied from interface:DeploymentResultDao
Delete Deployment Result.- Specified by:
delete
in interfaceDeploymentResultDao
- Parameters:
deploymentResult
- to be deleted
-
delete
Delete - DEPLOYMENT_RESULT_CUSTOMDATA (manual, JDBC) - DEPLOYMENT_RESULT (manual, JDBC) - WEBHOOK_RESPONSE (manual, JDBC)- Specified by:
delete
in interfaceDeploymentResultDao
- Parameters:
deletionAdapter
-DeletionSQLAdapter.getInClause()
should provide range of DeploymentResults- Returns:
- number of deleted records
-
delete
Delete - DEPLOYMENT_RESULT_CUSTOMDATA (manual, JDBC) - DEPLOYMENT_RESULT (manual, JDBC) - WEBHOOK_RESPONSE (manual, JDBC)- Specified by:
delete
in interfaceDeploymentResultDao
- Parameters:
environmentDeletionAdapter
-EnvironmentDeletionAdapter
should provide range of DeploymentResults- Returns:
- number of deleted records
-
unlinkFromVersion
Description copied from interface:DeploymentResultDao
Unlink DeploymentResults records limited byDeletionSQLAdapter.getInClause()
from deployment version. Unlinking is performed using UPDATE queries- Specified by:
unlinkFromVersion
in interfaceDeploymentResultDao
- Parameters:
deletionAdapter
-DeletionSQLAdapter.getInClause()
should provide range of DeploymentVersions to unlink from- Returns:
- number of unlinked records
-
iterateResultsForExport
Description copied from interface:DeploymentResultDao
Iterate through and execute function for each of MutableDeploymentResult- Specified by:
iterateResultsForExport
in interfaceDeploymentResultDao
- Parameters:
consumer
- consumer to accept each of the MutableDeploymentResult- Returns:
- number of traversed rows
-
findEnvironmentIdsVersionWasDeployedOn
- Specified by:
findEnvironmentIdsVersionWasDeployedOn
in interfaceDeploymentResultDao
- Returns:
- ids of all environments a version was ever deployed on
-
getLastResultBefore
@Nullable public @Nullable MutableDeploymentResult getLastResultBefore(@NotNull @NotNull DeploymentResult deploymentResult) - Specified by:
getLastResultBefore
in interfaceDeploymentResultDao
- Returns:
- result of the last deployment performed on an environment before given result
-
getLastResultInStatesBefore
@Nullable public @Nullable MutableDeploymentResult getLastResultInStatesBefore(@NotNull @NotNull DeploymentResult deploymentResult, @NotNull @NotNull EnumSet<BuildState> buildStates) - Specified by:
getLastResultInStatesBefore
in interfaceDeploymentResultDao
- Returns:
- result of the last deployment performed on an environment before given result in one of given build states
-
updateVersionName
Description copied from interface:DeploymentResultDao
Updates version name in all results related to a vesion- Specified by:
updateVersionName
in interfaceDeploymentResultDao
-
getLatestDeploymentResultsForAllEnvironments
Description copied from interface:DeploymentResultDao
Retrieve the latest deployment result for every deployment environment.- Specified by:
getLatestDeploymentResultsForAllEnvironments
in interfaceDeploymentResultDao
-
getLatestDeploymentResultsForEnvironments
public Collection<DeploymentResultDto> getLatestDeploymentResultsForEnvironments(@NotNull @NotNull List<Long> environmentIds) Description copied from interface:DeploymentResultDao
Retrieve the latest deployment result for deployment environments.- Specified by:
getLatestDeploymentResultsForEnvironments
in interfaceDeploymentResultDao
-
getLatestStatusForEnvironments
public Collection<EnvironmentStatusForDashboard> getLatestStatusForEnvironments(@NotNull @NotNull List<Long> environmentIds) Description copied from interface:DeploymentResultDao
Get minimum status data for listed environment ids.- Specified by:
getLatestStatusForEnvironments
in interfaceDeploymentResultDao
-