Class DeploymentVersionDaoImpl
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
com.atlassian.bamboo.deployments.versions.persistence.DeploymentVersionDaoImpl
- All Implemented Interfaces:
DeploymentVersionDao
,org.springframework.beans.factory.InitializingBean
public class DeploymentVersionDaoImpl
extends StatelessSessionHibernateDaoSupport
implements DeploymentVersionDao
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
-
Constructor Summary
ConstructorDescriptionDeploymentVersionDaoImpl
(TransactionAndHibernateTemplate transactionTemplate) -
Method Summary
Modifier and TypeMethodDescription@NotNull MutableDeploymentVersionStatus
createNewVersionStatus
(long deploymentVersionId, DeploymentVersionState state, @NotNull String userName) Creates a new vesion status for the given deployment version.void
delete
(MutableDeploymentVersion deploymentVersion) Delete MutableDeploymentVersionvoid
deleteById
(long deploymentVersionId) Delete MutableDeploymentVersionint
deleteForDeploymentProject
(long deploymentProjectId) Affected tables: - DEPLOYMENT_VERSION (manual, JPA) - DEPLOYMENT_VERSION_ARTIFACT (cascade) - DEPLOYMENT_PLANRESULTKEYS (cascade)int
deleteVersionItems
(long deploymentVersionId) Affected tables: - DEPLOYMENT_VERSION_ARTIFACT (manual, JPA)int
deleteVersionStatus
(long deploymentVersionId) Delete DeploymentVersionStatus records related to a given versionint
deleteVersionStatuses
(@NotNull DeploymentVersionDeletionAdapter deletionAdapter) Delete DeploymentVersionStatus records related to a given versionsfindLatestKnownVersionsForEnvironmentsOfDeploymentProject
(long deploymentProjectId) Find all the versions that are currently deployed on environments of a deployment projects.@Nullable MutableDeploymentVersion
findLatestVersionForProject
(long deploymentProjectId) Find the latest version for a deployment project.@Nullable MutableDeploymentVersion
findLatestVersionForProject
(long deploymentProjectId, @NotNull PlanKey branchKey) Find the latest version for a deployment project.findNextVersionContainingResult
(long deploymentProjectId, @NotNull PlanResultKey planResultKey) Find the first version that is created from a result which is later than current result (not taking custom revision into account)@Nullable MutableDeploymentVersion
findPreviousVersion
(long deploymentProjectId, @NotNull MutableDeploymentVersion deploymentVersion) Find the last version created before this one.@NotNull List<DeploymentVersionDto>
findVersionDtos
(DeploymentVersionSearchCriteria searchCriteria) @NotNull Iterable<DeploymentVersionDto>
findVersionDtosBetween
(long deploymentProjectId, long version1Id, long version2Id) findVersionIdentifiersAssociatedWithJiraIssue
(@NotNull String issueKey) Find all the version identifiers that are associated with a JIRA issue, grouped byDeploymentProject
Note: this API is in its intermittent form and is subject to change.@NotNull List<MutableDeploymentVersion>
findVersions
(@NotNull DeploymentVersionSearchCriteria searchCriteria) Search for versions using search criteria@NotNull List<MutableDeploymentVersion>
findVersionsAssociatedWithJiraIssue
(long deploymentProjectId, @NotNull String issueKey) Find all the versions of aDeploymentProject
that are associated with a JIRA issue@NotNull List<MutableDeploymentVersion>
findVersionsAssociatedWithJiraIssue
(@NotNull String issueKey) Find all the versions that are associated with a JIRA issuefindVersionsBetween
(long deploymentProjectId, long version1Id, long version2Id) Find versions created between version1 and version2.@NotNull List<DeploymentVersionStatusDto>
getAllUsersLatestVersionStatusDtosOrderedByCreationDate
(long deploymentVersionId) Retrieves all users' latest deployment version statuses for a requested deploymentVersionId ordered by creation date.@NotNull Map<Long,
List<DeploymentVersionStatusDto>> getAllUsersLatestVersionStatusDtosOrderedByCreationDate
(@NotNull List<Long> deploymentVersionIds) getDeploymentVersion
(long deploymentVersionId) Get MutableDeploymentVersion by id@Nullable MutableDeploymentVersion
getDeploymentVersionByName
(@NotNull String existingVersionName, long deploymentProjectId) Retrieve a specific version by name for a project@NotNull List<DeploymentVersionDto>
getDeploymentVersionDtosForDeploymentProject
(long deploymentProjectId, int offset, int maxResults) @NotNull List<MutableDeploymentVersion>
getDeploymentVersionsForDeploymentProject
(long deploymentProjectId) Get MutableDeploymentVersion by DeploymentProject id@Nullable MutableDeploymentVersionStatus
getLatestVersionStatus
(long deploymentVersionId) Retrieves deployment version status.@Nullable DeploymentVersionStatusDto
getLatestVersionStatusDto
(long deploymentVersionId) Retrieves deployment version status.@NotNull Map<Long,
DeploymentVersionStatusDto> getLatestVersionStatusDtos
(@NotNull List<Long> deploymentVersionIds) @NotNull Set<PlanResultKey>
getRelatedPlanResultKeys
(long deploymentVersionId) @NotNull Map<Long,
PlanResultKey> getRelatedPlanResultKeys
(Set<Long> deploymentVersionIds) Retrieve the PlanResultKeys of ResultSummaries related to a particular DeploymentVersions@Nullable MutableDeploymentVersion
getRelatedVersion
(long deploymentProjectId, @NotNull PlanResultKey planResultKey) Find latest version of a deployment project that is related to specific plan result.@NotNull List<MutableDeploymentVersion>
getRelatedVersions
(@NotNull PlanResultKey planResultKey) All versions project that are related to specific plan result.getResultPlanKeysHavingDeploymentProjectVersions
(long deploymentProjectId) Returns keys of result plans (branch) that have at least one deployment project version (release)@NotNull List<ArtifactDeploymentVersionItemDto>
getVersionItemDtos
(long deploymentVersionId) Find version items associated with a version.int
Count all versionsint
getVersionsCountForProject
(long deploymentProjectId) Count versions related to deployment projectint
getVersionsCountForProjectAndBranch
(long deploymentProjectId, @NotNull PlanKey branchKey) Count versions related to deployment project and a specific plan branch@NotNull List<MutableDeploymentVersionStatus>
getVersionStatuses
(long deploymentVersionId) GetMutableDeploymentVersionStatus
es by DeploymentVersion idboolean
hasVersions
(@NotNull DeploymentVersionSearchCriteria searchCriteria) Test if versions that match criteria do existboolean
isVersionNameConflicting
(@NotNull String name, long deploymentProjectId) Check whether the version name is already being used by another version within this projectvoid
save
(@NotNull MutableDeploymentVersion deploymentVersion) MutableDeploymentVersionItem members ofMutableDeploymentVersion.getItems()
are persisted in a cascadevoid
updatePlanKey
(@NotNull PlanKey originalPlanKey, @NotNull PlanKey newPlanKey) Update planKey in DeploymentVersion's related entities when plan key has changed (ie after moving plan)Methods 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
-
DeploymentVersionDaoImpl
-
-
Method Details
-
getResultPlanKeysHavingDeploymentProjectVersions
Description copied from interface:DeploymentVersionDao
Returns keys of result plans (branch) that have at least one deployment project version (release)- Specified by:
getResultPlanKeysHavingDeploymentProjectVersions
in interfaceDeploymentVersionDao
- Parameters:
deploymentProjectId
- id of the deployment project
-
getDeploymentVersionsForDeploymentProject
@NotNull public @NotNull List<MutableDeploymentVersion> getDeploymentVersionsForDeploymentProject(long deploymentProjectId) Description copied from interface:DeploymentVersionDao
Get MutableDeploymentVersion by DeploymentProject id- Specified by:
getDeploymentVersionsForDeploymentProject
in interfaceDeploymentVersionDao
-
getDeploymentVersionDtosForDeploymentProject
@NotNull public @NotNull List<DeploymentVersionDto> getDeploymentVersionDtosForDeploymentProject(long deploymentProjectId, int offset, int maxResults) - Specified by:
getDeploymentVersionDtosForDeploymentProject
in interfaceDeploymentVersionDao
-
getVersionItemDtos
@NotNull public @NotNull List<ArtifactDeploymentVersionItemDto> getVersionItemDtos(long deploymentVersionId) Description copied from interface:DeploymentVersionDao
Find version items associated with a version.- Specified by:
getVersionItemDtos
in interfaceDeploymentVersionDao
-
getDeploymentVersion
Description copied from interface:DeploymentVersionDao
Get MutableDeploymentVersion by id- Specified by:
getDeploymentVersion
in interfaceDeploymentVersionDao
-
save
MutableDeploymentVersionItem members ofMutableDeploymentVersion.getItems()
are persisted in a cascade- Specified by:
save
in interfaceDeploymentVersionDao
- Parameters:
deploymentVersion
- MutableDeploymentVersion to be persisted
-
deleteById
public void deleteById(long deploymentVersionId) Description copied from interface:DeploymentVersionDao
Delete MutableDeploymentVersion- Specified by:
deleteById
in interfaceDeploymentVersionDao
-
delete
Description copied from interface:DeploymentVersionDao
Delete MutableDeploymentVersion- Specified by:
delete
in interfaceDeploymentVersionDao
-
deleteForDeploymentProject
public int deleteForDeploymentProject(long deploymentProjectId) Affected tables: - DEPLOYMENT_VERSION (manual, JPA) - DEPLOYMENT_VERSION_ARTIFACT (cascade) - DEPLOYMENT_PLANRESULTKEYS (cascade)- Specified by:
deleteForDeploymentProject
in interfaceDeploymentVersionDao
- Parameters:
deploymentProjectId
- id of DeploymentProject- Returns:
- number of deleted DeploymentVersion records
-
deleteVersionItems
public int deleteVersionItems(long deploymentVersionId) Affected tables: - DEPLOYMENT_VERSION_ARTIFACT (manual, JPA)- Specified by:
deleteVersionItems
in interfaceDeploymentVersionDao
- Parameters:
deploymentVersionId
- id of DeploymentVersion- Returns:
- number of deleted DeploymentVersionItem records
-
findVersions
@NotNull public @NotNull List<MutableDeploymentVersion> findVersions(@NotNull @NotNull DeploymentVersionSearchCriteria searchCriteria) Description copied from interface:DeploymentVersionDao
Search for versions using search criteria- Specified by:
findVersions
in interfaceDeploymentVersionDao
- Parameters:
searchCriteria
- search criteria- Returns:
- list of versions that match the criteria
-
findVersionDtos
@NotNull public @NotNull List<DeploymentVersionDto> findVersionDtos(DeploymentVersionSearchCriteria searchCriteria) - Specified by:
findVersionDtos
in interfaceDeploymentVersionDao
-
hasVersions
Description copied from interface:DeploymentVersionDao
Test if versions that match criteria do exist- Specified by:
hasVersions
in interfaceDeploymentVersionDao
- Parameters:
searchCriteria
- search criteria- Returns:
- true if there are versions that match criteria
-
isVersionNameConflicting
Description copied from interface:DeploymentVersionDao
Check whether the version name is already being used by another version within this project- Specified by:
isVersionNameConflicting
in interfaceDeploymentVersionDao
- Parameters:
name
- to checkdeploymentProjectId
- project to filter by- Returns:
- true if name is already being used.
-
getDeploymentVersionByName
@Nullable public @Nullable MutableDeploymentVersion getDeploymentVersionByName(@NotNull @NotNull String existingVersionName, long deploymentProjectId) Description copied from interface:DeploymentVersionDao
Retrieve a specific version by name for a project- Specified by:
getDeploymentVersionByName
in interfaceDeploymentVersionDao
- Parameters:
existingVersionName
- name of version to finddeploymentProjectId
- of project to look in- Returns:
- version with specified name in the given project. Null if could not be found.
-
findPreviousVersion
@Nullable public @Nullable MutableDeploymentVersion findPreviousVersion(long deploymentProjectId, @NotNull @NotNull MutableDeploymentVersion deploymentVersion) Description copied from interface:DeploymentVersionDao
Find the last version created before this one. If version is related to any DeploymentVersionPlanResultKey then previous version would also be related to the same plan key (so we can find previous version created off the same branch).- Specified by:
findPreviousVersion
in interfaceDeploymentVersionDao
-
findLatestVersionForProject
@Nullable public @Nullable MutableDeploymentVersion findLatestVersionForProject(long deploymentProjectId) Description copied from interface:DeploymentVersionDao
Find the latest version for a deployment project. Comparison based on creation date.- Specified by:
findLatestVersionForProject
in interfaceDeploymentVersionDao
- Parameters:
deploymentProjectId
- id of the deployment project- Returns:
- the latest version for a deployment project
-
findLatestVersionForProject
@Nullable public @Nullable MutableDeploymentVersion findLatestVersionForProject(long deploymentProjectId, @NotNull @NotNull PlanKey branchKey) Description copied from interface:DeploymentVersionDao
Find the latest version for a deployment project. Comparison based on creation date.- Specified by:
findLatestVersionForProject
in interfaceDeploymentVersionDao
- Parameters:
deploymentProjectId
- id of the deployment projectbranchKey
- key of the PlanBranch- Returns:
- the latest version created for a branch for a deployment project
-
getRelatedPlanResultKeys
- Specified by:
getRelatedPlanResultKeys
in interfaceDeploymentVersionDao
- Returns:
- Retrieve the PlanResultKeys of ResultSummaries related to a particular DeploymentVersion
-
getRelatedPlanResultKeys
@NotNull public @NotNull Map<Long,PlanResultKey> getRelatedPlanResultKeys(Set<Long> deploymentVersionIds) Description copied from interface:DeploymentVersionDao
Retrieve the PlanResultKeys of ResultSummaries related to a particular DeploymentVersions- Specified by:
getRelatedPlanResultKeys
in interfaceDeploymentVersionDao
-
getLatestVersionStatus
@Nullable public @Nullable MutableDeploymentVersionStatus getLatestVersionStatus(long deploymentVersionId) Description copied from interface:DeploymentVersionDao
Retrieves deployment version status. For better performance, consider usingDeploymentVersionDao.getLatestVersionStatusDto(long)
instead.- Specified by:
getLatestVersionStatus
in interfaceDeploymentVersionDao
- Returns:
- Latest deployment version status.
-
getLatestVersionStatusDtos
@NotNull public @NotNull Map<Long,DeploymentVersionStatusDto> getLatestVersionStatusDtos(@NotNull @NotNull List<Long> deploymentVersionIds) - Specified by:
getLatestVersionStatusDtos
in interfaceDeploymentVersionDao
-
getAllUsersLatestVersionStatusDtosOrderedByCreationDate
@NotNull public @NotNull Map<Long,List<DeploymentVersionStatusDto>> getAllUsersLatestVersionStatusDtosOrderedByCreationDate(@NotNull @NotNull List<Long> deploymentVersionIds) - Specified by:
getAllUsersLatestVersionStatusDtosOrderedByCreationDate
in interfaceDeploymentVersionDao
- Returns:
- all users' version statuses for the requested deploymentVersionIds.
-
getLatestVersionStatusDto
@Nullable public @Nullable DeploymentVersionStatusDto getLatestVersionStatusDto(long deploymentVersionId) Description copied from interface:DeploymentVersionDao
Retrieves deployment version status.- Specified by:
getLatestVersionStatusDto
in interfaceDeploymentVersionDao
- Returns:
- Latest deployment version status.
-
getAllUsersLatestVersionStatusDtosOrderedByCreationDate
@NotNull public @NotNull List<DeploymentVersionStatusDto> getAllUsersLatestVersionStatusDtosOrderedByCreationDate(long deploymentVersionId) Description copied from interface:DeploymentVersionDao
Retrieves all users' latest deployment version statuses for a requested deploymentVersionId ordered by creation date.- Specified by:
getAllUsersLatestVersionStatusDtosOrderedByCreationDate
in interfaceDeploymentVersionDao
- Returns:
- deployment version status dtos.
-
createNewVersionStatus
@NotNull public @NotNull MutableDeploymentVersionStatus createNewVersionStatus(long deploymentVersionId, DeploymentVersionState state, @NotNull @NotNull String userName) Description copied from interface:DeploymentVersionDao
Creates a new vesion status for the given deployment version.- Specified by:
createNewVersionStatus
in interfaceDeploymentVersionDao
-
getRelatedVersion
@Nullable public @Nullable MutableDeploymentVersion getRelatedVersion(long deploymentProjectId, @NotNull @NotNull PlanResultKey planResultKey) Description copied from interface:DeploymentVersionDao
Find latest version of a deployment project that is related to specific plan result.- Specified by:
getRelatedVersion
in interfaceDeploymentVersionDao
- Returns:
-
getRelatedVersions
@NotNull public @NotNull List<MutableDeploymentVersion> getRelatedVersions(@NotNull @NotNull PlanResultKey planResultKey) Description copied from interface:DeploymentVersionDao
All versions project that are related to specific plan result.- Specified by:
getRelatedVersions
in interfaceDeploymentVersionDao
-
findNextVersionContainingResult
public MutableDeploymentVersion findNextVersionContainingResult(long deploymentProjectId, @NotNull @NotNull PlanResultKey planResultKey) Description copied from interface:DeploymentVersionDao
Find the first version that is created from a result which is later than current result (not taking custom revision into account)- Specified by:
findNextVersionContainingResult
in interfaceDeploymentVersionDao
- Returns:
-
getVersionStatuses
@NotNull public @NotNull List<MutableDeploymentVersionStatus> getVersionStatuses(long deploymentVersionId) Description copied from interface:DeploymentVersionDao
GetMutableDeploymentVersionStatus
es by DeploymentVersion id- Specified by:
getVersionStatuses
in interfaceDeploymentVersionDao
-
findVersionsBetween
public Iterable<MutableDeploymentVersion> findVersionsBetween(long deploymentProjectId, long version1Id, long version2Id) Description copied from interface:DeploymentVersionDao
Find versions created between version1 and version2. The order of the argument is irrelevant. Lower bound is not included in result but upper bound is. The result is sorted by creation date (newest first)- Specified by:
findVersionsBetween
in interfaceDeploymentVersionDao
- Returns:
-
findVersionDtosBetween
@NotNull public @NotNull Iterable<DeploymentVersionDto> findVersionDtosBetween(long deploymentProjectId, long version1Id, long version2Id) - Specified by:
findVersionDtosBetween
in interfaceDeploymentVersionDao
-
findVersionsAssociatedWithJiraIssue
@NotNull public @NotNull List<MutableDeploymentVersion> findVersionsAssociatedWithJiraIssue(long deploymentProjectId, @NotNull @NotNull String issueKey) Description copied from interface:DeploymentVersionDao
Find all the versions of aDeploymentProject
that are associated with a JIRA issue- Specified by:
findVersionsAssociatedWithJiraIssue
in interfaceDeploymentVersionDao
-
findVersionsAssociatedWithJiraIssue
@NotNull public @NotNull List<MutableDeploymentVersion> findVersionsAssociatedWithJiraIssue(@NotNull @NotNull String issueKey) Description copied from interface:DeploymentVersionDao
Find all the versions that are associated with a JIRA issue- Specified by:
findVersionsAssociatedWithJiraIssue
in interfaceDeploymentVersionDao
-
findVersionIdentifiersAssociatedWithJiraIssue
public Multimap<MutableDeploymentProject,Pair<Long, findVersionIdentifiersAssociatedWithJiraIssuePlanResultKey>> (@NotNull @NotNull String issueKey) Description copied from interface:DeploymentVersionDao
Find all the version identifiers that are associated with a JIRA issue, grouped byDeploymentProject
Note: this API is in its intermittent form and is subject to change.- Specified by:
findVersionIdentifiersAssociatedWithJiraIssue
in interfaceDeploymentVersionDao
-
findLatestKnownVersionsForEnvironmentsOfDeploymentProject
public List<MutableDeploymentVersion> findLatestKnownVersionsForEnvironmentsOfDeploymentProject(long deploymentProjectId) Description copied from interface:DeploymentVersionDao
Find all the versions that are currently deployed on environments of a deployment projects. Return duplicates if deployed on more than one environments.- Specified by:
findLatestKnownVersionsForEnvironmentsOfDeploymentProject
in interfaceDeploymentVersionDao
- Returns:
-
deleteVersionStatus
public int deleteVersionStatus(long deploymentVersionId) Description copied from interface:DeploymentVersionDao
Delete DeploymentVersionStatus records related to a given version- Specified by:
deleteVersionStatus
in interfaceDeploymentVersionDao
- Parameters:
deploymentVersionId
- id of the DeploymentVersion- Returns:
- number of deleted DeploymentVersionStatus records
-
deleteVersionStatuses
public int deleteVersionStatuses(@NotNull @NotNull DeploymentVersionDeletionAdapter deletionAdapter) Description copied from interface:DeploymentVersionDao
Delete DeploymentVersionStatus records related to a given versions- Specified by:
deleteVersionStatuses
in interfaceDeploymentVersionDao
- Parameters:
deletionAdapter
-DeletionSQLAdapter.getInClause()
should provide range of DeploymentVersions to remove- Returns:
- number of deleted DeploymentVersionStatus records
-
getVersionsCount
public int getVersionsCount()Description copied from interface:DeploymentVersionDao
Count all versions- Specified by:
getVersionsCount
in interfaceDeploymentVersionDao
- Returns:
- number of versions created in all deployment projects
-
getVersionsCountForProject
public int getVersionsCountForProject(long deploymentProjectId) Description copied from interface:DeploymentVersionDao
Count versions related to deployment project- Specified by:
getVersionsCountForProject
in interfaceDeploymentVersionDao
- Parameters:
deploymentProjectId
- id of deployment project- Returns:
- number of versions existing for a deployment project
-
getVersionsCountForProjectAndBranch
public int getVersionsCountForProjectAndBranch(long deploymentProjectId, @NotNull @NotNull PlanKey branchKey) Description copied from interface:DeploymentVersionDao
Count versions related to deployment project and a specific plan branch- Specified by:
getVersionsCountForProjectAndBranch
in interfaceDeploymentVersionDao
- Parameters:
deploymentProjectId
- id of deployment projectbranchKey
- plan branch key- Returns:
- number of versions existing for a deployment project and a plan branch
-
updatePlanKey
public void updatePlanKey(@NotNull @NotNull PlanKey originalPlanKey, @NotNull @NotNull PlanKey newPlanKey) Description copied from interface:DeploymentVersionDao
Update planKey in DeploymentVersion's related entities when plan key has changed (ie after moving plan)- Specified by:
updatePlanKey
in interfaceDeploymentVersionDao
- Parameters:
originalPlanKey
- original PlanKeynewPlanKey
- new PlanKey
-