com.atlassian.bamboo.deployments.versions.service
Class VersionNamingServiceImpl

java.lang.Object
  extended by com.atlassian.bamboo.deployments.versions.service.VersionNamingServiceImpl
All Implemented Interfaces:
VersionNamingService

public class VersionNamingServiceImpl
extends Object
implements VersionNamingService


Constructor Summary
VersionNamingServiceImpl(DeploymentProjectDao deploymentProjectDao, DeploymentResultDao deploymentResultDao, ScopedExclusionService exclusionService, DeploymentVersionDao deploymentVersionDao, VariableDefinitionManager variableDefinitionManager, VariableConfigurationService variableConfigurationService, VariableSubstitutorFactory variableSubstitutorFactory)
           
 
Method Summary
 String getIncrementedVersionName(String versionName)
          Calculates an increment of a version name.
protected  String getUniqueVersionName(long deploymentProjectId, String versionName)
           
protected  com.atlassian.fugue.Pair<String,String> getUniqueVersionNameByAutoIncrementing(long deploymentProjectId, MutableVersionNamingScheme versionNamingScheme, String nextSubstitutedName, VariableSubstitutor variableSubstitutor)
           
 MutableVersionNamingScheme getVersionNamingSchemeForProject(long deploymentProjectId)
          Get the version naming configuration for a project
 MutableDeploymentVersion nameAndCreateVersion(InternalDeploymentProject deploymentProject, ImmutablePlan linkedPlan, MutableDeploymentVersion deploymentVersion, String versionName, String nextVersionName, Map<String,VariableDefinitionContext> variables)
          Takes a new deployment version, if new version name supplied, uses that, otherwise generates unique name based on version naming scheme.
 MutableDeploymentVersion renameVersion(long deploymentProjectId, DeploymentVersion deploymentVersion, String newVersionName)
          Rename a version.
 MutableVersionNamingScheme updateVersionNamingSchemeForProject(long deploymentProjectId, String nextVersionName, boolean autoIncrement, Set<String> variablesToAutoIncrement)
          update the version naming configuration for a project
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionNamingServiceImpl

public VersionNamingServiceImpl(DeploymentProjectDao deploymentProjectDao,
                                DeploymentResultDao deploymentResultDao,
                                ScopedExclusionService exclusionService,
                                DeploymentVersionDao deploymentVersionDao,
                                VariableDefinitionManager variableDefinitionManager,
                                VariableConfigurationService variableConfigurationService,
                                VariableSubstitutorFactory variableSubstitutorFactory)
Method Detail

getVersionNamingSchemeForProject

@Nullable
public MutableVersionNamingScheme getVersionNamingSchemeForProject(long deploymentProjectId)
Description copied from interface: VersionNamingService
Get the version naming configuration for a project

Specified by:
getVersionNamingSchemeForProject in interface VersionNamingService
Parameters:
deploymentProjectId - of the project
Returns:
version naming scheme for a project

updateVersionNamingSchemeForProject

@NotNull
public MutableVersionNamingScheme updateVersionNamingSchemeForProject(long deploymentProjectId,
                                                                              String nextVersionName,
                                                                              boolean autoIncrement,
                                                                              @NotNull
                                                                              Set<String> variablesToAutoIncrement)
Description copied from interface: VersionNamingService
update the version naming configuration for a project

Specified by:
updateVersionNamingSchemeForProject in interface VersionNamingService
Parameters:
deploymentProjectId - of the project
nextVersionName - the value to be used for the next version name
autoIncrement - whether the version name should be auto-incremented
variablesToAutoIncrement - variables to increment
Returns:
the updated version naming scheme.

nameAndCreateVersion

@NotNull
public MutableDeploymentVersion nameAndCreateVersion(@NotNull
                                                             InternalDeploymentProject deploymentProject,
                                                             @NotNull
                                                             ImmutablePlan linkedPlan,
                                                             @NotNull
                                                             MutableDeploymentVersion deploymentVersion,
                                                             @Nullable
                                                             String versionName,
                                                             @Nullable
                                                             String nextVersionName,
                                                             @NotNull
                                                             Map<String,VariableDefinitionContext> variables)
                                              throws WebValidationException
Description copied from interface: VersionNamingService
Takes a new deployment version, if new version name supplied, uses that, otherwise generates unique name based on version naming scheme. Version is then saved and the version naming scheme updated with the next version name.

Specified by:
nameAndCreateVersion in interface VersionNamingService
Parameters:
deploymentProject - the version belongs to
deploymentVersion - the version to be named and saved.
versionName - (optional) name to be used for this version
nextVersionName - (optional) the value the next version name should be set to.
variables - map containing variables available for version name creation (doesn't have to contain GLOBAL and SYSTEM variables)
Returns:
the persisted version.
Throws:
WebValidationException - on any error

getIncrementedVersionName

@NotNull
public String getIncrementedVersionName(@NotNull
                                                String versionName)
Description copied from interface: VersionNamingService
Calculates an increment of a version name. Increments last number in the name. If nothing found to increment will return passed in value.

Specified by:
getIncrementedVersionName in interface VersionNamingService
Parameters:
versionName - to increment
Returns:
incremented version name.

renameVersion

@NotNull
public MutableDeploymentVersion renameVersion(long deploymentProjectId,
                                                      DeploymentVersion deploymentVersion,
                                                      String newVersionName)
                                       throws WebValidationException
Description copied from interface: VersionNamingService
Rename a version.

Specified by:
renameVersion in interface VersionNamingService
Returns:
modified version object
Throws:
WebValidationException

getUniqueVersionNameByAutoIncrementing

@Nullable
protected com.atlassian.fugue.Pair<String,String> getUniqueVersionNameByAutoIncrementing(long deploymentProjectId,
                                                                                                  MutableVersionNamingScheme versionNamingScheme,
                                                                                                  String nextSubstitutedName,
                                                                                                  VariableSubstitutor variableSubstitutor)

getUniqueVersionName

protected String getUniqueVersionName(long deploymentProjectId,
                                      String versionName)


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.