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
-
-
Constructor Summary
Constructors Constructor Description DeploymentVersionDaoImpl(TransactionAndHibernateTemplate transactionTemplate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull MutableDeploymentVersionStatuscreateNewVersionStatus(long deploymentVersionId, DeploymentVersionState state, @NotNull String userName)Creates a new vesion status for the given deployment version.voiddelete(MutableDeploymentVersion deploymentVersion)Delete MutableDeploymentVersionintdeleteForDeploymentProject(long deploymentProjectId)Affected tables: - DEPLOYMENT_VERSION (manual, JPA) - DEPLOYMENT_VERSION_ITEM (cascade) - DEPLOYMENT_VERSION_ITEM_BA (cascade) - DEPLOYMENT_PLANRESULTKEYS (cascade)intdeleteVersionItems(long deploymentVersionId)Affected tables: - DEPLOYMENT_VERSION_ITEM (manual, JPA) - DEPLOYMENT_VERSION_ITEM_BA (cascade)intdeleteVersionStatus(long deploymentVersionId)Delete DeploymentVersionStatus records related to a given versionintdeleteVersionStatuses(@NotNull DeploymentVersionDeletionAdapter deletionAdapter)Delete DeploymentVersionStatus records related to a given versionsList<MutableDeploymentVersion>findLatestKnownVersionsForEnvironmentsOfDeploymentProject(long deploymentProjectId)Find all the versions that are currently deployed on environments of a deployment projects.@Nullable MutableDeploymentVersionfindLatestVersionForProject(long deploymentProjectId)Find the latest version for a deployment project.@Nullable MutableDeploymentVersionfindLatestVersionForProject(long deploymentProjectId, @NotNull PlanKey branchKey)Find the latest version for a deployment project.MutableDeploymentVersionfindNextVersionContainingResult(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 MutableDeploymentVersionfindPreviousVersion(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)com.google.common.collect.Multimap<MutableDeploymentProject,Pair<Long,PlanResultKey>>findVersionIdentifiersAssociatedWithJiraIssue(@NotNull String issueKey)Find all the version identifiers that are associated with a JIRA issue, grouped byDeploymentProjectNote: 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 aDeploymentProjectthat are associated with a JIRA issue@NotNull List<MutableDeploymentVersion>findVersionsAssociatedWithJiraIssue(@NotNull String issueKey)Find all the versions that are associated with a JIRA issueIterable<MutableDeploymentVersion>findVersionsBetween(long deploymentProjectId, long version1Id, long version2Id)Find versions created between version1 and version2.MutableDeploymentVersiongetDeploymentVersion(long deploymentVersionId)Get MutableDeploymentVersion by id@Nullable MutableDeploymentVersiongetDeploymentVersionByName(@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 MutableDeploymentVersionStatusgetLatestVersionStatus(long deploymentVersionId)Retrieves deployment version status.@Nullable DeploymentVersionStatusDtogetLatestVersionStatusDto(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 MutableDeploymentVersiongetRelatedVersion(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.List<String>getResultPlanKeysHavingDeploymentProjectVersions(long deploymentProjectId)Returns keys of result plans (branch) that have at least one deployment project version (release)intgetVersionsCount()Count all versionsintgetVersionsCountForProject(long deploymentProjectId)Count versions related to deployment projectintgetVersionsCountForProjectAndBranch(long deploymentProjectId, @NotNull PlanKey branchKey)Count versions related to deployment project and a specific plan branch@NotNull List<MutableDeploymentVersionStatus>getVersionStatuses(long deploymentVersionId)GetMutableDeploymentVersionStatuses by DeploymentVersion idbooleanhasVersions(@NotNull DeploymentVersionSearchCriteria searchCriteria)Test if versions that match criteria do existbooleanisVersionNameConflicting(@NotNull String name, long deploymentProjectId)Check whether the version name is already being used by another version within this projectvoidsave(@NotNull MutableDeploymentVersion deploymentVersion)MutableDeploymentVersionItem members ofMutableDeploymentVersion.getItems()are persisted in a cascadevoidupdatePlanKey(@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
-
-
-
-
Constructor Detail
-
DeploymentVersionDaoImpl
public DeploymentVersionDaoImpl(TransactionAndHibernateTemplate transactionTemplate)
-
-
Method Detail
-
getResultPlanKeysHavingDeploymentProjectVersions
public List<String> getResultPlanKeysHavingDeploymentProjectVersions(long deploymentProjectId)
Description copied from interface:DeploymentVersionDaoReturns keys of result plans (branch) that have at least one deployment project version (release)- Specified by:
getResultPlanKeysHavingDeploymentProjectVersionsin interfaceDeploymentVersionDao- Parameters:
deploymentProjectId- id of the deployment project
-
getDeploymentVersionsForDeploymentProject
@NotNull public @NotNull List<MutableDeploymentVersion> getDeploymentVersionsForDeploymentProject(long deploymentProjectId)
Description copied from interface:DeploymentVersionDaoGet MutableDeploymentVersion by DeploymentProject id- Specified by:
getDeploymentVersionsForDeploymentProjectin interfaceDeploymentVersionDao
-
getDeploymentVersionDtosForDeploymentProject
@NotNull public @NotNull List<DeploymentVersionDto> getDeploymentVersionDtosForDeploymentProject(long deploymentProjectId, int offset, int maxResults)
- Specified by:
getDeploymentVersionDtosForDeploymentProjectin interfaceDeploymentVersionDao
-
getDeploymentVersion
public MutableDeploymentVersion getDeploymentVersion(long deploymentVersionId)
Description copied from interface:DeploymentVersionDaoGet MutableDeploymentVersion by id- Specified by:
getDeploymentVersionin interfaceDeploymentVersionDao
-
save
public void save(@NotNull @NotNull MutableDeploymentVersion deploymentVersion)MutableDeploymentVersionItem members ofMutableDeploymentVersion.getItems()are persisted in a cascade- Specified by:
savein interfaceDeploymentVersionDao- Parameters:
deploymentVersion- MutableDeploymentVersion to be persisted
-
delete
public void delete(MutableDeploymentVersion deploymentVersion)
Description copied from interface:DeploymentVersionDaoDelete MutableDeploymentVersion- Specified by:
deletein interfaceDeploymentVersionDao
-
deleteForDeploymentProject
public int deleteForDeploymentProject(long deploymentProjectId)
Affected tables: - DEPLOYMENT_VERSION (manual, JPA) - DEPLOYMENT_VERSION_ITEM (cascade) - DEPLOYMENT_VERSION_ITEM_BA (cascade) - DEPLOYMENT_PLANRESULTKEYS (cascade)- Specified by:
deleteForDeploymentProjectin interfaceDeploymentVersionDao- Parameters:
deploymentProjectId- id of DeploymentProject- Returns:
- number of deleted DeploymentVersion records
-
deleteVersionItems
public int deleteVersionItems(long deploymentVersionId)
Affected tables: - DEPLOYMENT_VERSION_ITEM (manual, JPA) - DEPLOYMENT_VERSION_ITEM_BA (cascade)- Specified by:
deleteVersionItemsin 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:DeploymentVersionDaoSearch for versions using search criteria- Specified by:
findVersionsin interfaceDeploymentVersionDao- Parameters:
searchCriteria- search criteria- Returns:
- list of versions that match the criteria
-
findVersionDtos
@NotNull public @NotNull List<DeploymentVersionDto> findVersionDtos(DeploymentVersionSearchCriteria searchCriteria)
- Specified by:
findVersionDtosin interfaceDeploymentVersionDao
-
hasVersions
public boolean hasVersions(@NotNull @NotNull DeploymentVersionSearchCriteria searchCriteria)Description copied from interface:DeploymentVersionDaoTest if versions that match criteria do exist- Specified by:
hasVersionsin interfaceDeploymentVersionDao- Parameters:
searchCriteria- search criteria- Returns:
- true if there are versions that match criteria
-
isVersionNameConflicting
public boolean isVersionNameConflicting(@NotNull @NotNull String name, long deploymentProjectId)Description copied from interface:DeploymentVersionDaoCheck whether the version name is already being used by another version within this project- Specified by:
isVersionNameConflictingin 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:DeploymentVersionDaoRetrieve a specific version by name for a project- Specified by:
getDeploymentVersionByNamein 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:DeploymentVersionDaoFind 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:
findPreviousVersionin interfaceDeploymentVersionDao
-
findLatestVersionForProject
@Nullable public @Nullable MutableDeploymentVersion findLatestVersionForProject(long deploymentProjectId)
Description copied from interface:DeploymentVersionDaoFind the latest version for a deployment project. Comparison based on creation date.- Specified by:
findLatestVersionForProjectin 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:DeploymentVersionDaoFind the latest version for a deployment project. Comparison based on creation date.- Specified by:
findLatestVersionForProjectin 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
@NotNull public @NotNull Set<PlanResultKey> getRelatedPlanResultKeys(long deploymentVersionId)
- Specified by:
getRelatedPlanResultKeysin 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:DeploymentVersionDaoRetrieve the PlanResultKeys of ResultSummaries related to a particular DeploymentVersions- Specified by:
getRelatedPlanResultKeysin interfaceDeploymentVersionDao
-
getLatestVersionStatus
@Nullable public @Nullable MutableDeploymentVersionStatus getLatestVersionStatus(long deploymentVersionId)
Description copied from interface:DeploymentVersionDaoRetrieves deployment version status. For better performance, consider usingDeploymentVersionDao.getLatestVersionStatusDto(long)instead.- Specified by:
getLatestVersionStatusin interfaceDeploymentVersionDao- Returns:
- Latest deployment version status.
-
getLatestVersionStatusDtos
@NotNull public @NotNull Map<Long,DeploymentVersionStatusDto> getLatestVersionStatusDtos(@NotNull @NotNull List<Long> deploymentVersionIds)
- Specified by:
getLatestVersionStatusDtosin interfaceDeploymentVersionDao
-
getLatestVersionStatusDto
@Nullable public @Nullable DeploymentVersionStatusDto getLatestVersionStatusDto(long deploymentVersionId)
Description copied from interface:DeploymentVersionDaoRetrieves deployment version status.- Specified by:
getLatestVersionStatusDtoin interfaceDeploymentVersionDao- Returns:
- Latest deployment version status.
-
createNewVersionStatus
@NotNull public @NotNull MutableDeploymentVersionStatus createNewVersionStatus(long deploymentVersionId, DeploymentVersionState state, @NotNull @NotNull String userName)
Description copied from interface:DeploymentVersionDaoCreates a new vesion status for the given deployment version.- Specified by:
createNewVersionStatusin interfaceDeploymentVersionDao
-
getRelatedVersion
@Nullable public @Nullable MutableDeploymentVersion getRelatedVersion(long deploymentProjectId, @NotNull @NotNull PlanResultKey planResultKey)
Description copied from interface:DeploymentVersionDaoFind latest version of a deployment project that is related to specific plan result.- Specified by:
getRelatedVersionin interfaceDeploymentVersionDao- Returns:
-
getRelatedVersions
@NotNull public @NotNull List<MutableDeploymentVersion> getRelatedVersions(@NotNull @NotNull PlanResultKey planResultKey)
Description copied from interface:DeploymentVersionDaoAll versions project that are related to specific plan result.- Specified by:
getRelatedVersionsin interfaceDeploymentVersionDao
-
findNextVersionContainingResult
public MutableDeploymentVersion findNextVersionContainingResult(long deploymentProjectId, @NotNull @NotNull PlanResultKey planResultKey)
Description copied from interface:DeploymentVersionDaoFind the first version that is created from a result which is later than current result (not taking custom revision into account)- Specified by:
findNextVersionContainingResultin interfaceDeploymentVersionDao- Returns:
-
getVersionStatuses
@NotNull public @NotNull List<MutableDeploymentVersionStatus> getVersionStatuses(long deploymentVersionId)
Description copied from interface:DeploymentVersionDaoGetMutableDeploymentVersionStatuses by DeploymentVersion id- Specified by:
getVersionStatusesin interfaceDeploymentVersionDao
-
findVersionsBetween
public Iterable<MutableDeploymentVersion> findVersionsBetween(long deploymentProjectId, long version1Id, long version2Id)
Description copied from interface:DeploymentVersionDaoFind 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:
findVersionsBetweenin interfaceDeploymentVersionDao- Returns:
-
findVersionDtosBetween
@NotNull public @NotNull Iterable<DeploymentVersionDto> findVersionDtosBetween(long deploymentProjectId, long version1Id, long version2Id)
- Specified by:
findVersionDtosBetweenin interfaceDeploymentVersionDao
-
findVersionsAssociatedWithJiraIssue
@NotNull public @NotNull List<MutableDeploymentVersion> findVersionsAssociatedWithJiraIssue(long deploymentProjectId, @NotNull @NotNull String issueKey)
Description copied from interface:DeploymentVersionDaoFind all the versions of aDeploymentProjectthat are associated with a JIRA issue- Specified by:
findVersionsAssociatedWithJiraIssuein interfaceDeploymentVersionDao
-
findVersionsAssociatedWithJiraIssue
@NotNull public @NotNull List<MutableDeploymentVersion> findVersionsAssociatedWithJiraIssue(@NotNull @NotNull String issueKey)
Description copied from interface:DeploymentVersionDaoFind all the versions that are associated with a JIRA issue- Specified by:
findVersionsAssociatedWithJiraIssuein interfaceDeploymentVersionDao
-
findVersionIdentifiersAssociatedWithJiraIssue
public com.google.common.collect.Multimap<MutableDeploymentProject,Pair<Long,PlanResultKey>> findVersionIdentifiersAssociatedWithJiraIssue(@NotNull @NotNull String issueKey)
Description copied from interface:DeploymentVersionDaoFind all the version identifiers that are associated with a JIRA issue, grouped byDeploymentProjectNote: this API is in its intermittent form and is subject to change.- Specified by:
findVersionIdentifiersAssociatedWithJiraIssuein interfaceDeploymentVersionDao
-
findLatestKnownVersionsForEnvironmentsOfDeploymentProject
public List<MutableDeploymentVersion> findLatestKnownVersionsForEnvironmentsOfDeploymentProject(long deploymentProjectId)
Description copied from interface:DeploymentVersionDaoFind all the versions that are currently deployed on environments of a deployment projects. Return duplicates if deployed on more than one environments.- Specified by:
findLatestKnownVersionsForEnvironmentsOfDeploymentProjectin interfaceDeploymentVersionDao- Returns:
-
deleteVersionStatus
public int deleteVersionStatus(long deploymentVersionId)
Description copied from interface:DeploymentVersionDaoDelete DeploymentVersionStatus records related to a given version- Specified by:
deleteVersionStatusin 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:DeploymentVersionDaoDelete DeploymentVersionStatus records related to a given versions- Specified by:
deleteVersionStatusesin 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:DeploymentVersionDaoCount all versions- Specified by:
getVersionsCountin interfaceDeploymentVersionDao- Returns:
- number of versions created in all deployment projects
-
getVersionsCountForProject
public int getVersionsCountForProject(long deploymentProjectId)
Description copied from interface:DeploymentVersionDaoCount versions related to deployment project- Specified by:
getVersionsCountForProjectin 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:DeploymentVersionDaoCount versions related to deployment project and a specific plan branch- Specified by:
getVersionsCountForProjectAndBranchin 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:DeploymentVersionDaoUpdate planKey in DeploymentVersion's related entities when plan key has changed (ie after moving plan)- Specified by:
updatePlanKeyin interfaceDeploymentVersionDao- Parameters:
originalPlanKey- original PlanKeynewPlanKey- new PlanKey
-
-