public class DeploymentVersionServiceImpl extends Object implements DeploymentVersionService, DeploymentVersionDtoManager
Constructor and Description |
---|
DeploymentVersionServiceImpl(DeploymentProjectDao deploymentProjectDao,
DeploymentVersionDao deploymentVersionDao,
ResultsSummaryManager resultsSummaryManager,
DeploymentVersionChainResultDataCollector deploymentVersionChainResultDataCollector,
com.opensymphony.xwork2.TextProvider textProvider,
EnvironmentService environmentService,
GravatarService gravatarService,
BambooUserManager bambooUserService,
VariableDefinitionManager variableDefinitionManager,
VariableDefinitionFactory variableDefinitionFactory,
CustomVariableContext customVariableContext,
com.atlassian.event.api.EventPublisher eventPublisher,
CachedPlanManager cachedPlanManager,
ScopedExclusionService scopedExclusionService,
ResultsSummaryVariableAccessor resultsSummaryVariableAccessor,
RepositoryDefinitionManager repositoryDefinitionManager,
VcsRepositoryManager vcsRepositoryManager) |
Modifier and Type | Method and Description |
---|---|
DeploymentVersion |
createDeploymentVersion(long deploymentProjectId,
PlanResultKey planResultKey)
Create a deployment version out of a deployment project and plan result.
|
DeploymentVersion |
createDeploymentVersion(long deploymentProjectId,
PlanResultKey planResultKey,
com.atlassian.user.User user,
String versionName,
String nextVersionName)
Create a deployment version with a specific name.
|
Map<DeploymentVersion,Integer> |
findLatestKnownVersionsForEnvironmentsOfDeploymentProject(DeploymentProject deploymentProject)
Find all
DeploymentVersion that are currently deployed on environments of a DeploymentProject
For each version found give number of environments it is present on. |
DeploymentVersion |
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)
|
DeploymentVersion |
findPreviousVersion(long deploymentProjectId,
long versionId) |
List<DeploymentVersion> |
findVersionsAssociatedWithJiraIssue(long deploymentProjectId,
String issueKey)
Find all the versions of a
DeploymentProject that are associated with a JIRA issue |
com.google.common.collect.Multimap<DeploymentProject,DeploymentVersion> |
findVersionsAssociatedWithJiraIssue(String issueKey)
Find all the version that are associated with a JIRA issue, grouped by
DeploymentProject |
List<DeploymentVersion> |
findVersionsBetween(long deploymentProjectId,
DeploymentVersion version1,
DeploymentVersion version2)
Find versions created between version1 and version2.
|
List<DeploymentVersion> |
getDeploymentProjectVersions(long deploymentProjectId)
Retrieves the list of all the version for the deployment project, sorted by CreationDate (the most recent
Deployment Versions will be returned as firsts)
|
DeploymentVersion |
getDeploymentVersion(DeploymentVersionDto dto,
DeploymentProject project)
Convert a DeploymentVersionDto to a
DeploymentVersion . |
DeploymentVersion |
getDeploymentVersion(long deploymentVersionId)
Get DeploymentVersion by id
|
DeploymentVersion |
getDeploymentVersionByName(String existingVersionName,
long deploymentProjectId)
Get a specific version by name
|
String |
getEvaluatedVersionName(String nextVersionName,
Map<String,VariableDefinitionContext> variables,
Set<String> variablesToIncrement) |
String |
getIncrementedVersionName(String versionName)
Calculates an increment of a version name.
|
DeploymentVersion |
getLatestVersionForProject(long deploymentProjectId)
Find the latest version for a deployment project regardless of branch used to create it.
|
DeploymentVersion |
getLatestVersionForProject(long deploymentProjectId,
PlanKey branchKey)
Find the latest version for a deployment project.
|
DeploymentVersionStatus |
getLatestVersionStatus(long deploymentVersionId) |
DeploymentVersion |
getOrCreateDeploymentVersion(long deploymentProjectId,
PlanResultKey planResultKey)
Given a build result, find a deployment version that matches it, or create it if it doesn't exist.
|
Map<String,VariableDefinitionContext> |
getPossibleVersionVariables(ImmutablePlan linkedPlan,
boolean includeUndeterminable)
Provides a map of variables which might show up on a version.
|
Map<String,VariableDefinitionContext> |
getPossibleVersionVariables(ImmutablePlan linkedPlan,
PlanResultKey planResultKey,
boolean includeUndeterminable)
Provides a map of variables which might show up on a version.
|
Set<PlanResultKey> |
getRelatedPlanResultKeys(long deploymentVersionId) |
DeploymentVersion |
getRelatedVersion(long deploymentProjectId,
PlanResultKey planResultKey)
Find latest version of a deployment project that is related to specific plan result.
|
Set<String> |
getResultPlanKeysHavingDeploymentProjectVersions(long deploymentProjectId)
Returns keys of result plans (branch) that have at least one deployment project version (release)
|
com.google.common.collect.Multimap<String,Artifact> |
getVersionArtifacts(DeploymentVersion deploymentVersion)
Find all
Artifact related to a version. |
String |
getVersionNamePreview(ResultsSummary resultsSummary,
String versionName)
Given a version name and a result summary, what would the version name look like after substitution.
|
int |
getVersionsCount()
Count all versions
|
int |
getVersionsCountForProject(long deploymentProjectId)
Count versions related to deployment project
|
boolean |
hasVersionsUnrelatedToBranch(long deploymentProjectId,
PlanKey branchKey)
Test if there are
DeploymentVersion s in a DeploymentProject that are unrelated to given branch |
boolean |
isFromTheSameBranch(long firstVersionId,
long secondVersionId)
Checks if both deployment versions come from the same branch
|
boolean |
isFromTheSameBranch(String planKey,
long versionId)
Checks if the specified build result is on the same branch as the specified version ID
|
boolean |
isVersionNameConflicting(long deploymentProjectId,
String name)
Check whether the version name is already being used by another version within this project
|
DeploymentVersion |
renameVersion(long deploymentProjectId,
DeploymentVersion deploymentVersion,
String newVersionName)
Rename a version.
|
void |
resetVersionsAge(DeploymentVersion deploymentVersion)
Resets version's age to 0.
|
List<DeploymentVersion> |
searchVersionsByBranch(long deploymentProjectId,
PlanKey branchKey)
Search for deployment versions in a project whose name contains the searchTerm, sorted by CreationDate (the most recent
Deployment Versions will be returned as firsts)
|
List<DeploymentVersion> |
searchVersionsByBranchAndName(long deploymentProjectId,
PlanKey branchKey,
String searchTerm)
Search for deployment versions in a project whose name contains the searchTerm, sorted by CreationDate (the most recent
Deployment Versions will be returned as firsts)
|
List<DeploymentVersion> |
searchVersionsByName(long deploymentProjectId,
String searchTerm)
Search for deployment versions in a project whose name contains the searchTerm, sorted by CreationDate (the most recent
Deployment Versions will be returned as firsts)
|
void |
updatePlanKey(PlanKey originalPlanKey,
PlanKey newPlanKey)
Update planKey in DeploymentVersion's related entities when plan key has changed (ie after moving plan)
|
DeploymentVersionStatus |
updateVersionStatus(long deploymentVersionId,
DeploymentVersionState status,
String userName)
Updates the version status for given deployment version.
|
ErrorCollection |
validateCreateDeploymentVersion(long deploymentProjectId,
PlanResultKey planResultKey,
String name,
String nextVersionName)
Validates values to be used for creating a new version.
|
ErrorCollection |
validateDeploymentVersionRename(long deploymentProjectId,
DeploymentVersion deploymentVersion,
String name)
Validates values to be used for renaming version.
|
public DeploymentVersionServiceImpl(@NotNull DeploymentProjectDao deploymentProjectDao, @NotNull DeploymentVersionDao deploymentVersionDao, @NotNull ResultsSummaryManager resultsSummaryManager, @NotNull DeploymentVersionChainResultDataCollector deploymentVersionChainResultDataCollector, @NotNull com.opensymphony.xwork2.TextProvider textProvider, @NotNull EnvironmentService environmentService, @NotNull GravatarService gravatarService, @NotNull BambooUserManager bambooUserService, @NotNull VariableDefinitionManager variableDefinitionManager, @NotNull VariableDefinitionFactory variableDefinitionFactory, @NotNull CustomVariableContext customVariableContext, @NotNull com.atlassian.event.api.EventPublisher eventPublisher, @NotNull CachedPlanManager cachedPlanManager, @NotNull ScopedExclusionService scopedExclusionService, @NotNull ResultsSummaryVariableAccessor resultsSummaryVariableAccessor, @NotNull RepositoryDefinitionManager repositoryDefinitionManager, @NotNull VcsRepositoryManager vcsRepositoryManager)
@NotNull public ErrorCollection validateDeploymentVersionRename(long deploymentProjectId, @NotNull DeploymentVersion deploymentVersion, @Nullable String name)
DeploymentVersionService
validateDeploymentVersionRename
in interface DeploymentVersionService
@NotNull public DeploymentVersion renameVersion(long deploymentProjectId, @NotNull DeploymentVersion deploymentVersion, @NotNull String newVersionName) throws WebValidationException
DeploymentVersionService
renameVersion
in interface DeploymentVersionService
WebValidationException
@NotNull public ErrorCollection validateCreateDeploymentVersion(long deploymentProjectId, @NotNull PlanResultKey planResultKey, @Nullable String name, @Nullable String nextVersionName)
DeploymentVersionService
validateCreateDeploymentVersion
in interface DeploymentVersionService
deploymentProjectId
- id of the deployment projectplanResultKey
- key of the build result on which this version is createdname
- version namenextVersionName
- name of the next versionpublic boolean isVersionNameConflicting(long deploymentProjectId, @NotNull String name)
DeploymentVersionService
isVersionNameConflicting
in interface DeploymentVersionService
deploymentProjectId
- project to filter byname
- to check@NotNull public DeploymentVersion getOrCreateDeploymentVersion(long deploymentProjectId, @NotNull PlanResultKey planResultKey) throws WebValidationException
DeploymentVersionService
getOrCreateDeploymentVersion
in interface DeploymentVersionService
deploymentProjectId
- of project to create version forplanResultKey
- of the result to pull artifacts fromWebValidationException
@NotNull public DeploymentVersion createDeploymentVersion(long deploymentProjectId, @NotNull PlanResultKey planResultKey) throws WebValidationException
DeploymentVersionService
createDeploymentVersion
in interface DeploymentVersionService
deploymentProjectId
- of project to create version forplanResultKey
- of the result to pull artifacts fromWebValidationException
@NotNull public DeploymentVersion createDeploymentVersion(long deploymentProjectId, @NotNull PlanResultKey planResultKey, @Nullable com.atlassian.user.User user, @Nullable String versionName, @Nullable String nextVersionName) throws WebValidationException
DeploymentVersionService
createDeploymentVersion
in interface DeploymentVersionService
deploymentProjectId
- project the version is getting created forplanResultKey
- of the result to pull artifacts fromuser
- the person who is creating this versionversionName
- name for the version to createnextVersionName
- the name for the next version (to be updated in version naming scheme)WebValidationException
public String getVersionNamePreview(ResultsSummary resultsSummary, String versionName)
DeploymentVersionService
getVersionNamePreview
in interface DeploymentVersionService
resultsSummary
- the version would get created fromversionName
- the potential name of the versionpublic void resetVersionsAge(@NotNull DeploymentVersion deploymentVersion)
DeploymentVersionService
resetVersionsAge
in interface DeploymentVersionService
@NotNull public Map<String,VariableDefinitionContext> getPossibleVersionVariables(@NotNull ImmutablePlan linkedPlan, boolean includeUndeterminable)
DeploymentVersionService
getPossibleVersionVariables
in interface DeploymentVersionService
linkedPlan
- plan the deployment project is linked toincludeUndeterminable
- if true include variables that we don't currently know the value, with a nice example (used for display purposes)@NotNull public Map<String,VariableDefinitionContext> getPossibleVersionVariables(@NotNull ImmutablePlan linkedPlan, @Nullable PlanResultKey planResultKey, boolean includeUndeterminable)
DeploymentVersionService
getPossibleVersionVariables
in interface DeploymentVersionService
linkedPlan
- plan the deployment project is linked toplanResultKey
- resultKey for result variables contextincludeUndeterminable
- if true include variables that we don't currently know the value, with a nice example (used for display purposes)@Nullable public DeploymentVersion getDeploymentVersion(long deploymentVersionId)
DeploymentVersionService
getDeploymentVersion
in interface DeploymentVersionService
@Nullable @Internal public DeploymentVersion getDeploymentVersion(@Nullable DeploymentVersionDto dto, @NotNull DeploymentProject project) throws org.acegisecurity.AccessDeniedException
DeploymentVersionDtoManager
DeploymentVersion
.getDeploymentVersion
in interface DeploymentVersionDtoManager
org.acegisecurity.AccessDeniedException
- if the DeploymentVersion
is inaccessible to the current user, but also
marks the current transaction as rollback-only@NotNull public Set<String> getResultPlanKeysHavingDeploymentProjectVersions(long deploymentProjectId)
DeploymentVersionService
getResultPlanKeysHavingDeploymentProjectVersions
in interface DeploymentVersionService
deploymentProjectId
- id of the deployment project@NotNull public List<DeploymentVersion> getDeploymentProjectVersions(long deploymentProjectId)
DeploymentVersionService
getDeploymentProjectVersions
in interface DeploymentVersionService
deploymentProjectId
- id of the deployment project@Nullable public DeploymentVersion getLatestVersionForProject(long deploymentProjectId)
DeploymentVersionService
getLatestVersionForProject
in interface DeploymentVersionService
deploymentProjectId
- of the deployment project@Nullable public DeploymentVersion getLatestVersionForProject(long deploymentProjectId, @NotNull PlanKey branchKey)
DeploymentVersionService
getLatestVersionForProject
in interface DeploymentVersionService
deploymentProjectId
- of the deployment projectbranchKey
- key of the PlanBranch@Nullable public DeploymentVersion getDeploymentVersionByName(@NotNull String existingVersionName, long deploymentProjectId)
DeploymentVersionService
getDeploymentVersionByName
in interface DeploymentVersionService
existingVersionName
- name of the version@NotNull public List<DeploymentVersion> searchVersionsByName(long deploymentProjectId, @NotNull String searchTerm)
DeploymentVersionService
searchVersionsByName
in interface DeploymentVersionService
deploymentProjectId
- deployment project to search withinsearchTerm
- term to look for.@NotNull public List<DeploymentVersion> searchVersionsByBranch(long deploymentProjectId, @NotNull PlanKey branchKey)
DeploymentVersionService
searchVersionsByBranch
in interface DeploymentVersionService
deploymentProjectId
- deployment project to search withinbranchKey
- plan branch to narrow search result@NotNull public List<DeploymentVersion> searchVersionsByBranchAndName(long deploymentProjectId, @NotNull PlanKey branchKey, @NotNull String searchTerm)
DeploymentVersionService
searchVersionsByBranchAndName
in interface DeploymentVersionService
deploymentProjectId
- deployment project to search withinbranchKey
- plan branch to narrow search resultsearchTerm
- term to look for.public int getVersionsCount()
DeploymentVersionService
getVersionsCount
in interface DeploymentVersionService
public int getVersionsCountForProject(long deploymentProjectId)
DeploymentVersionService
getVersionsCountForProject
in interface DeploymentVersionService
deploymentProjectId
- id of deployment project@NotNull public Set<PlanResultKey> getRelatedPlanResultKeys(long deploymentVersionId)
getRelatedPlanResultKeys
in interface DeploymentVersionService
public boolean isFromTheSameBranch(long firstVersionId, long secondVersionId)
DeploymentVersionService
isFromTheSameBranch
in interface DeploymentVersionService
firstVersionId
- first deployment versionsecondVersionId
- second deployment versionpublic boolean isFromTheSameBranch(String planKey, long versionId)
DeploymentVersionService
isFromTheSameBranch
in interface DeploymentVersionService
planKey
- the planKey of the build result you want to compareversionId
- the version ID of the version you want to compare@Nullable public DeploymentVersionStatus getLatestVersionStatus(long deploymentVersionId)
getLatestVersionStatus
in interface DeploymentVersionService
@NotNull public DeploymentVersionStatus updateVersionStatus(long deploymentVersionId, @NotNull DeploymentVersionState status, @NotNull String userName)
DeploymentVersionService
updateVersionStatus
in interface DeploymentVersionService
@NotNull public List<DeploymentVersion> findVersionsBetween(long deploymentProjectId, @NotNull DeploymentVersion version1, @NotNull DeploymentVersion version2)
DeploymentVersionService
DeploymentProject
The order of the argument is irrelevant: the method will determine which of the versions is the lower bound.
Lower bound is not included in result but upper bound is.
The result is sorted by creation date (newest first)findVersionsBetween
in interface DeploymentVersionService
@Nullable public DeploymentVersion findPreviousVersion(long deploymentProjectId, long versionId)
findPreviousVersion
in interface DeploymentVersionService
@NotNull public com.google.common.collect.Multimap<String,Artifact> getVersionArtifacts(@NotNull DeploymentVersion deploymentVersion)
DeploymentVersionService
Artifact
related to a version.getVersionArtifacts
in interface DeploymentVersionService
@Nullable public DeploymentVersion getRelatedVersion(long deploymentProjectId, @NotNull PlanResultKey planResultKey)
DeploymentVersionService
getRelatedVersion
in interface DeploymentVersionService
public DeploymentVersion findNextVersionContainingResult(long deploymentProjectId, @NotNull PlanResultKey planResultKey)
DeploymentVersionService
findNextVersionContainingResult
in interface DeploymentVersionService
@NotNull public String getIncrementedVersionName(@NotNull String versionName)
DeploymentVersionService
getIncrementedVersionName
in interface DeploymentVersionService
versionName
- to increment@NotNull public String getEvaluatedVersionName(String nextVersionName, Map<String,VariableDefinitionContext> variables, Set<String> variablesToIncrement)
getEvaluatedVersionName
in interface DeploymentVersionService
public void updatePlanKey(@NotNull PlanKey originalPlanKey, @NotNull PlanKey newPlanKey)
DeploymentVersionService
updatePlanKey
in interface DeploymentVersionService
originalPlanKey
- original PlanKeynewPlanKey
- new PlanKey@NotNull public List<DeploymentVersion> findVersionsAssociatedWithJiraIssue(long deploymentProjectId, @NotNull String issueKey)
DeploymentVersionService
DeploymentProject
that are associated with a JIRA issuefindVersionsAssociatedWithJiraIssue
in interface DeploymentVersionService
@NotNull public com.google.common.collect.Multimap<DeploymentProject,DeploymentVersion> findVersionsAssociatedWithJiraIssue(@NotNull String issueKey)
DeploymentVersionService
DeploymentProject
findVersionsAssociatedWithJiraIssue
in interface DeploymentVersionService
@NotNull public Map<DeploymentVersion,Integer> findLatestKnownVersionsForEnvironmentsOfDeploymentProject(DeploymentProject deploymentProject)
DeploymentVersionService
DeploymentVersion
that are currently deployed on environments of a DeploymentProject
For each version found give number of environments it is present on.findLatestKnownVersionsForEnvironmentsOfDeploymentProject
in interface DeploymentVersionService
public boolean hasVersionsUnrelatedToBranch(long deploymentProjectId, @NotNull PlanKey branchKey)
DeploymentVersionService
DeploymentVersion
s in a DeploymentProject
that are unrelated to given branchhasVersionsUnrelatedToBranch
in interface DeploymentVersionService
deploymentProjectId
- identifies deployment projectbranchKey
- key of the branchCopyright © 2017 Atlassian Software Systems Pty Ltd. All rights reserved.