com.atlassian.bamboo.deployments.versions.persistence
Class DeploymentVersionDaoImpl

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate.support.HibernateDaoSupport
          extended by com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
              extended by 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
DeploymentVersionDaoImpl()
           
 
Method Summary
 void delete(MutableDeploymentVersion deploymentVersion)
          Delete MutableDeploymentVersion
 int deleteForDeploymentProject(long deploymentProjectId)
          Affected tables: - DEPLOYMENT_VERSION (manual, JDBC) - DEPLOYMENT_VERSION_ITEM (manual, JDBC) - DEPLOYMENT_VERSION_ITEM_BA (manual, JDBC) - DEPLOYMENT_PLANRESULTKEYS (manual, JDBC)
 int deleteVersionStatus(long deploymentVersionId)
          Delete DeploymentVersionStatus records related to a given version
 int deleteVersionStatuses(DeploymentVersionDeletionAdapter deletionAdapter)
          Delete DeploymentVersionStatus records related to a given versions
 MutableDeploymentVersion findLatestVersion(long deploymentProjectId)
          Find the latest version created for this deployment project.
 MutableDeploymentVersion findNextVersionContainingResult(long deploymentProjectId, PlanResultKey planResultKey)
          Find the first version that is created from a result which is later than current result (not taking custom revision into account)
 MutableDeploymentVersion findPreviousVersion(long deploymentProjectId, MutableDeploymentVersion deploymentVersion)
          Find the last version created before this one.
 java.lang.Iterable<MutableDeploymentVersion> findVersionsBetween(long deploymentProjectId, long version1Id, long version2Id)
          Find versions created between version1 and version2.
 java.util.List<MutableDeploymentVersion> findVersionsWithNameLike(long deploymentProjectId, java.lang.String name)
          Search for version in a project by name.
 MutableDeploymentVersion getDeploymentVersion(long deploymentVersionId)
          Get MutableDeploymentVersion by id
 MutableDeploymentVersion getDeploymentVersionByName(java.lang.String existingVersionName, long deploymentProjectId)
          Retrieve a specific version by name for a project
 java.util.List<MutableDeploymentVersion> getDeploymentVersionsForDeploymentProject(long deploymentProjectId)
          Get MutableDeploymentVersion by DeploymentProject id
 MutableDeploymentVersion getLatestVersionForProject(long id)
          Find the latest version for a deployment project.
 MutableDeploymentVersionStatus getLatestVersionStatus(long deploymentVersionId)
           
 java.util.Set<PlanResultKey> getRelatedPlanResultKeys(long deploymentVersionId)
           
 MutableDeploymentVersion getRelatedVersion(long deploymentProjectId, PlanResultKey planResultKey)
          Find latest version of a deployment project that is related to specific plan result.
 int getVersionsCountForProject(long deploymentProjectId)
           
 java.util.List<MutableDeploymentVersionStatus> getVersionStatuses(long deploymentVersionId)
          Get MutableDeploymentVersionStatuses by DeploymentVersion id
 boolean isVersionNameConflicting(java.lang.String name, long deploymentProjectId)
          Check whether the version name is already being used by another version within this project
 void save(MutableDeploymentVersion deploymentVersion)
          MutableDeploymentVersionItem members of MutableDeploymentVersion.getItems() are persisted in a cascade
 void updatePlanKey(PlanKey originalPlanKey, PlanKey newPlanKey)
          Update planKey in DeploymentVersion's related entities when plan key has changed (ie after moving plan)
 MutableDeploymentVersionStatus updateVersionStatus(long deploymentVersionId, DeploymentVersionState state, java.lang.String userName)
           
 
Methods inherited from class com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
getCacheAwareHibernateTemplate
 
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
 

Constructor Detail

DeploymentVersionDaoImpl

public DeploymentVersionDaoImpl()
Method Detail

getDeploymentVersionsForDeploymentProject

@NotNull
public java.util.List<MutableDeploymentVersion> getDeploymentVersionsForDeploymentProject(long deploymentProjectId)
Description copied from interface: DeploymentVersionDao
Get MutableDeploymentVersion by DeploymentProject id

Specified by:
getDeploymentVersionsForDeploymentProject in interface DeploymentVersionDao

getDeploymentVersion

public MutableDeploymentVersion getDeploymentVersion(long deploymentVersionId)
Description copied from interface: DeploymentVersionDao
Get MutableDeploymentVersion by id

Specified by:
getDeploymentVersion in interface DeploymentVersionDao

save

public void save(@NotNull
                 MutableDeploymentVersion deploymentVersion)
MutableDeploymentVersionItem members of MutableDeploymentVersion.getItems() are persisted in a cascade

Specified by:
save in interface DeploymentVersionDao
Parameters:
deploymentVersion - MutableDeploymentVersion to be persisted

delete

public void delete(MutableDeploymentVersion deploymentVersion)
Description copied from interface: DeploymentVersionDao
Delete MutableDeploymentVersion

Specified by:
delete in interface DeploymentVersionDao

deleteForDeploymentProject

public int deleteForDeploymentProject(long deploymentProjectId)
Affected tables: - DEPLOYMENT_VERSION (manual, JDBC) - DEPLOYMENT_VERSION_ITEM (manual, JDBC) - DEPLOYMENT_VERSION_ITEM_BA (manual, JDBC) - DEPLOYMENT_PLANRESULTKEYS (manual, JDBC)

Specified by:
deleteForDeploymentProject in interface DeploymentVersionDao
Parameters:
deploymentProjectId - id of DeploymentProject
Returns:
number of deleted DeploymentVersion records

findVersionsWithNameLike

@NotNull
public java.util.List<MutableDeploymentVersion> findVersionsWithNameLike(long deploymentProjectId,
                                                                                 @NotNull
                                                                                 java.lang.String name)
Description copied from interface: DeploymentVersionDao
Search for version in a project by name.

Specified by:
findVersionsWithNameLike in interface DeploymentVersionDao
Parameters:
deploymentProjectId - deployment project to get versions of
name - to compare version name to. Should already contain %'s for matching
Returns:
list of versions that match the criteria

isVersionNameConflicting

public boolean isVersionNameConflicting(@NotNull
                                        java.lang.String name,
                                        long deploymentProjectId)
Description copied from interface: DeploymentVersionDao
Check whether the version name is already being used by another version within this project

Specified by:
isVersionNameConflicting in interface DeploymentVersionDao
Parameters:
name - to check
deploymentProjectId - project to filter by
Returns:
true if name is already being used.

getDeploymentVersionByName

@Nullable
public MutableDeploymentVersion getDeploymentVersionByName(@NotNull
                                                                    java.lang.String existingVersionName,
                                                                    long deploymentProjectId)
Description copied from interface: DeploymentVersionDao
Retrieve a specific version by name for a project

Specified by:
getDeploymentVersionByName in interface DeploymentVersionDao
Parameters:
existingVersionName - name of version to find
deploymentProjectId - of project to look in
Returns:
version with specified name in the given project. Null if could not be found.

findPreviousVersion

@Nullable
public MutableDeploymentVersion findPreviousVersion(long deploymentProjectId,
                                                             @NotNull
                                                             MutableDeploymentVersion deploymentVersion)
Description copied from interface: DeploymentVersionDao
Find the last version created before this one.

Specified by:
findPreviousVersion in interface DeploymentVersionDao

findLatestVersion

@Nullable
public MutableDeploymentVersion findLatestVersion(long deploymentProjectId)
Description copied from interface: DeploymentVersionDao
Find the latest version created for this deployment project.

Specified by:
findLatestVersion in interface DeploymentVersionDao

getRelatedPlanResultKeys

@NotNull
public java.util.Set<PlanResultKey> getRelatedPlanResultKeys(long deploymentVersionId)
Specified by:
getRelatedPlanResultKeys in interface DeploymentVersionDao
Returns:
Retrieve the PlanResultKeys of ResultSummaries related to a particular DeploymentVersion

getLatestVersionStatus

public MutableDeploymentVersionStatus getLatestVersionStatus(long deploymentVersionId)
Specified by:
getLatestVersionStatus in interface DeploymentVersionDao

updateVersionStatus

public MutableDeploymentVersionStatus updateVersionStatus(long deploymentVersionId,
                                                          DeploymentVersionState state,
                                                          java.lang.String userName)
Specified by:
updateVersionStatus in interface DeploymentVersionDao

getLatestVersionForProject

public MutableDeploymentVersion getLatestVersionForProject(long id)
Description copied from interface: DeploymentVersionDao
Find the latest version for a deployment project. Comparison based on creation date.

Specified by:
getLatestVersionForProject in interface DeploymentVersionDao
Parameters:
id - of the deployment project
Returns:
the latest version for a deployment project

getRelatedVersion

@Nullable
public MutableDeploymentVersion getRelatedVersion(long deploymentProjectId,
                                                           @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 interface DeploymentVersionDao
Returns:

findNextVersionContainingResult

public MutableDeploymentVersion findNextVersionContainingResult(long deploymentProjectId,
                                                                @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 interface DeploymentVersionDao
Returns:

getVersionStatuses

@NotNull
public java.util.List<MutableDeploymentVersionStatus> getVersionStatuses(long deploymentVersionId)
Description copied from interface: DeploymentVersionDao
Get MutableDeploymentVersionStatuses by DeploymentVersion id

Specified by:
getVersionStatuses in interface DeploymentVersionDao

findVersionsBetween

public java.lang.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 interface DeploymentVersionDao
Returns:

deleteVersionStatus

public int deleteVersionStatus(long deploymentVersionId)
Description copied from interface: DeploymentVersionDao
Delete DeploymentVersionStatus records related to a given version

Specified by:
deleteVersionStatus in interface DeploymentVersionDao
Parameters:
deploymentVersionId - id of the DeploymentVersion
Returns:
number of deleted DeploymentVersionStatus records

deleteVersionStatuses

public int deleteVersionStatuses(@NotNull
                                 DeploymentVersionDeletionAdapter deletionAdapter)
Description copied from interface: DeploymentVersionDao
Delete DeploymentVersionStatus records related to a given versions

Specified by:
deleteVersionStatuses in interface DeploymentVersionDao
Parameters:
deletionAdapter - DeletionSQLAdapter.getInClause() should provide range of DeploymentVersions to remove
Returns:
number of deleted DeploymentVersionStatus records

getVersionsCountForProject

public int getVersionsCountForProject(long deploymentProjectId)
Specified by:
getVersionsCountForProject in interface DeploymentVersionDao
Returns:
number of versions existing for a deployment project

updatePlanKey

public void updatePlanKey(@NotNull
                          PlanKey originalPlanKey,
                          @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 interface DeploymentVersionDao
Parameters:
originalPlanKey - original PlanKey
newPlanKey - new PlanKey


Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.