com.atlassian.bamboo.deployments.versions.persistence
Interface DeploymentVersionDao

All Known Implementing Classes:
DeploymentVersionDaoImpl

public interface DeploymentVersionDao


Method Summary
 void delete(MutableDeploymentVersion deploymentVersion)
          Delete MutableDeploymentVersion
 int deleteForDeploymentProject(long deploymentProjectId)
          Delete DeploymentVersion records related to given DeploymentProject.
 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 deploymentVersionId, long version1Id, long version2Id)
          Find versions created between version1 and version2.
 java.util.List<MutableDeploymentVersion> findVersionsWithNameLike(long deploymentProjectId, java.lang.String nameLike)
          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)
          Save MutableDeploymentVersion
 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)
           
 

Method Detail

getDeploymentVersion

@Nullable
MutableDeploymentVersion getDeploymentVersion(long deploymentVersionId)
Get MutableDeploymentVersion by id


getDeploymentVersionsForDeploymentProject

@NotNull
java.util.List<MutableDeploymentVersion> getDeploymentVersionsForDeploymentProject(long deploymentProjectId)
Get MutableDeploymentVersion by DeploymentProject id


save

void save(@NotNull
          MutableDeploymentVersion deploymentVersion)
Save MutableDeploymentVersion


delete

void delete(MutableDeploymentVersion deploymentVersion)
Delete MutableDeploymentVersion


deleteForDeploymentProject

int deleteForDeploymentProject(long deploymentProjectId)
Delete DeploymentVersion records related to given DeploymentProject. This will only attempt to remove DeploymentVersion and data that is normally cascaded by Hibernate. For complete DeploymentVersion deletion please see DeploymentVersionDeletionService.

Parameters:
deploymentProjectId - id of DeploymentProject
Returns:
number of deleted DeploymentVersion records

findVersionsWithNameLike

@NotNull
java.util.List<MutableDeploymentVersion> findVersionsWithNameLike(long deploymentProjectId,
                                                                          @NotNull
                                                                          java.lang.String nameLike)
Search for version in a project by name.

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

isVersionNameConflicting

boolean isVersionNameConflicting(@NotNull
                                 java.lang.String name,
                                 long deploymentProjectId)
Check whether the version name is already being used by another version within this project

Parameters:
name - to check
deploymentProjectId - project to filter by
Returns:
true if name is already being used.

getDeploymentVersionByName

@Nullable
MutableDeploymentVersion getDeploymentVersionByName(@NotNull
                                                             java.lang.String existingVersionName,
                                                             long deploymentProjectId)
Retrieve a specific version by name for a project

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
MutableDeploymentVersion findPreviousVersion(long deploymentProjectId,
                                                      @NotNull
                                                      MutableDeploymentVersion deploymentVersion)
Find the last version created before this one.


findLatestVersion

@Nullable
MutableDeploymentVersion findLatestVersion(long deploymentProjectId)
Find the latest version created for this deployment project.


getRelatedPlanResultKeys

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

getLatestVersionStatus

MutableDeploymentVersionStatus getLatestVersionStatus(long deploymentVersionId)

updateVersionStatus

MutableDeploymentVersionStatus updateVersionStatus(long deploymentVersionId,
                                                   DeploymentVersionState state,
                                                   java.lang.String userName)

getVersionStatuses

@NotNull
java.util.List<MutableDeploymentVersionStatus> getVersionStatuses(long deploymentVersionId)
Get MutableDeploymentVersionStatuses by DeploymentVersion id


findVersionsBetween

java.lang.Iterable<MutableDeploymentVersion> findVersionsBetween(long deploymentVersionId,
                                                                 long version1Id,
                                                                 long version2Id)
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)

Parameters:
deploymentVersionId -
version1Id -
version2Id -
Returns:
Throws:
java.lang.IllegalArgumentException - if any of the version doesn't exist

deleteVersionStatus

int deleteVersionStatus(long deploymentVersionId)
Delete DeploymentVersionStatus records related to a given version

Parameters:
deploymentVersionId - id of the DeploymentVersion
Returns:
number of deleted DeploymentVersionStatus records

deleteVersionStatuses

int deleteVersionStatuses(@NotNull
                          DeploymentVersionDeletionAdapter deletionAdapter)
Delete DeploymentVersionStatus records related to a given versions

Parameters:
deletionAdapter - DeletionSQLAdapter.getInClause() should provide range of DeploymentVersions to remove
Returns:
number of deleted DeploymentVersionStatus records

getVersionsCountForProject

int getVersionsCountForProject(long deploymentProjectId)
Parameters:
deploymentProjectId -
Returns:
number of versions existing for a deployment project

getLatestVersionForProject

@Nullable
MutableDeploymentVersion getLatestVersionForProject(long id)
Find the latest version for a deployment project. Comparison based on creation date.

Parameters:
id - of the deployment project
Returns:
the latest version for a deployment project

getRelatedVersion

@Nullable
MutableDeploymentVersion getRelatedVersion(long deploymentProjectId,
                                                    @NotNull
                                                    PlanResultKey planResultKey)
Find latest version of a deployment project that is related to specific plan result.

Parameters:
deploymentProjectId -
planResultKey -
Returns:

findNextVersionContainingResult

@Nullable
MutableDeploymentVersion 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)

Parameters:
deploymentProjectId -
planResultKey -
Returns:

updatePlanKey

void updatePlanKey(@NotNull
                   PlanKey originalPlanKey,
                   @NotNull
                   PlanKey newPlanKey)
Update planKey in DeploymentVersion's related entities when plan key has changed (ie after moving plan)

Parameters:
originalPlanKey - original PlanKey
newPlanKey - new PlanKey


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