com.atlassian.bamboo.build.creation
Class PlanValidationServiceImpl

java.lang.Object
  extended by com.atlassian.bamboo.build.creation.PlanValidationServiceImpl
All Implemented Interfaces:
PlanValidationService

public class PlanValidationServiceImpl
extends java.lang.Object
implements PlanValidationService


Field Summary
static java.lang.String CHAIN_PREFIX
           
static java.lang.String ILLEGAL_NAME_CHARACTERS
           
static java.lang.String JOB_PREFIX
           
static java.util.regex.Pattern KEY_PATTERN
           
static java.lang.String PLAN_PREFIX
           
static java.lang.String PROJECT_PREFIX
           
static java.lang.String STAGE_PREFIX
           
static java.lang.String SUB_BUILD_KEY
           
 
Fields inherited from interface com.atlassian.bamboo.build.creation.PlanValidationService
KEY_REGEXP
 
Constructor Summary
PlanValidationServiceImpl(ProjectManager projectManager, PlanManager planManager, com.opensymphony.xwork.TextProvider textProvider, RepositoryConfigHelper repositoryConfigHelper, WebRepositoryConfigHelper webRepositoryConfigHelper, BuildStrategyConfigHelper buildStrategyConfigHelper, ChainBranchManager chainBranchManager)
           
 
Method Summary
 BuildStrategyConfigHelper getBuildStrategyConfigHelper()
           
 RepositoryConfigHelper getRepositoryConfigHelper()
           
 WebRepositoryConfigHelper getWebRepositoryConfigHelper()
           
 void validateDescription(com.opensymphony.xwork.ValidationAware validationAware, java.lang.String fieldName, java.lang.String description)
          Validate the description field of any object.
 void validateKey(com.opensymphony.xwork.ValidationAware validationAware, java.lang.String fieldName, java.lang.String errorPrefix, java.lang.String key)
          Validate any String against Bamboo's generic rules for keys.
 void validateName(com.opensymphony.xwork.ValidationAware validationAware, java.lang.String fieldName, java.lang.String errorPrefix, java.lang.String name)
          Validate any String against Bamboo's generic rules for names.
 void validateNewChainForExistingProject(com.opensymphony.xwork.ValidationAware validationAware, java.lang.String existingProjectKey, java.lang.String buildName)
          Validate that new chain name (only) is unique within the project
 void validateNewChainForExistingProject(com.opensymphony.xwork.ValidationAware validationAware, java.lang.String existingProjectKey, java.lang.String buildKey, java.lang.String buildName)
          Validate that new chain name and key is unique within the project
 void validateNewJobForExistingChain(com.opensymphony.xwork.ValidationAware validationAware, Chain existingChain, java.lang.String buildKey, java.lang.String buildName)
           
 void validateNewPlanBranchForMaster(com.opensymphony.xwork.ValidationAware validationAware, ImmutableChain masterChain, java.lang.String branchName)
          Validate that new plan branch name (only) is unique within a set of branches with a common master
 void validateNewPlanDetails(com.opensymphony.xwork.ValidationAware validationAware, java.lang.String buildKey, java.lang.String buildName)
          Ensure that the build key & name are valid
 void validateNewProjectDetails(com.opensymphony.xwork.ValidationAware validationAware, java.lang.String projectName, java.lang.String projectKey)
          Validate that the new project details are valid
 void validateNewStageForChain(com.opensymphony.xwork.ValidationAware validationAware, Chain chain, java.lang.String stageName)
          Validate the the new stage can be added to the given chain
 void validatePlanToCloneExists(com.opensymphony.xwork.ValidationAware validationAware, java.lang.String buildKeyToClone)
          Validate that the plan t clone exists
 void validateStageExistsForChain(com.opensymphony.xwork.ValidationAware validationAware, Chain chain, java.lang.String stageName)
          Ensures that the stage currently exists for a chain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ILLEGAL_NAME_CHARACTERS

public static final java.lang.String ILLEGAL_NAME_CHARACTERS
See Also:
Constant Field Values

KEY_PATTERN

public static final java.util.regex.Pattern KEY_PATTERN

PLAN_PREFIX

public static final java.lang.String PLAN_PREFIX
See Also:
Constant Field Values

PROJECT_PREFIX

public static final java.lang.String PROJECT_PREFIX
See Also:
Constant Field Values

CHAIN_PREFIX

public static final java.lang.String CHAIN_PREFIX
See Also:
Constant Field Values

JOB_PREFIX

public static final java.lang.String JOB_PREFIX
See Also:
Constant Field Values

STAGE_PREFIX

public static final java.lang.String STAGE_PREFIX
See Also:
Constant Field Values

SUB_BUILD_KEY

public static final java.lang.String SUB_BUILD_KEY
See Also:
Constant Field Values
Constructor Detail

PlanValidationServiceImpl

public PlanValidationServiceImpl(ProjectManager projectManager,
                                 PlanManager planManager,
                                 com.opensymphony.xwork.TextProvider textProvider,
                                 RepositoryConfigHelper repositoryConfigHelper,
                                 WebRepositoryConfigHelper webRepositoryConfigHelper,
                                 BuildStrategyConfigHelper buildStrategyConfigHelper,
                                 ChainBranchManager chainBranchManager)
Method Detail

validateKey

public void validateKey(@NotNull
                        com.opensymphony.xwork.ValidationAware validationAware,
                        java.lang.String fieldName,
                        java.lang.String errorPrefix,
                        java.lang.String key)
Description copied from interface: PlanValidationService
Validate any String against Bamboo's generic rules for keys.

Specified by:
validateKey in interface PlanValidationService
Parameters:
validationAware - - the object to add errors to if any are found
fieldName - - the name of the field to add the errors to
errorPrefix - - the prefix to put in front of the standardised error keys. (e.g. "plan", "chain")
key - - the actual string to validate

validateName

public void validateName(@NotNull
                         com.opensymphony.xwork.ValidationAware validationAware,
                         java.lang.String fieldName,
                         java.lang.String errorPrefix,
                         java.lang.String name)
Description copied from interface: PlanValidationService
Validate any String against Bamboo's generic rules for names.

Specified by:
validateName in interface PlanValidationService
Parameters:
validationAware - - the object to add errors to if any are found
fieldName - - the name of the field to add the errors to
errorPrefix - - the prefix to put in front of the standardised error keys. (e.g. "plan", "chain")
name - - the actual string to validate

validateDescription

public void validateDescription(@NotNull
                                com.opensymphony.xwork.ValidationAware validationAware,
                                java.lang.String fieldName,
                                java.lang.String description)
Description copied from interface: PlanValidationService
Validate the description field of any object. All it really does is check length

Specified by:
validateDescription in interface PlanValidationService
Parameters:
validationAware - - the object to add errors to if any are found
fieldName - - the name of the field to add the errors to
description - - the actual text to validate

validatePlanToCloneExists

public void validatePlanToCloneExists(@NotNull
                                      com.opensymphony.xwork.ValidationAware validationAware,
                                      @Nullable
                                      java.lang.String buildKeyToClone)
Description copied from interface: PlanValidationService
Validate that the plan t clone exists

Specified by:
validatePlanToCloneExists in interface PlanValidationService
Parameters:
validationAware - - object to add errors to if any are found
buildKeyToClone - - the key of the plan to clone

validateNewPlanDetails

public void validateNewPlanDetails(@NotNull
                                   com.opensymphony.xwork.ValidationAware validationAware,
                                   java.lang.String buildKey,
                                   java.lang.String buildName)
Description copied from interface: PlanValidationService
Ensure that the build key & name are valid

Specified by:
validateNewPlanDetails in interface PlanValidationService
Parameters:
validationAware - - object to add errors to if any are found
buildKey - - the key for the plan
buildName - - the name for the plan

validateNewJobForExistingChain

public void validateNewJobForExistingChain(@NotNull
                                           com.opensymphony.xwork.ValidationAware validationAware,
                                           @NotNull
                                           Chain existingChain,
                                           @NotNull
                                           java.lang.String buildKey,
                                           @Nullable
                                           java.lang.String buildName)
Specified by:
validateNewJobForExistingChain in interface PlanValidationService
Parameters:
validationAware - - object to add errors to if any are found
existingChain - - the chain the new job will be added to
buildKey - - the key for the job
buildName - - the name for the job.

validateNewChainForExistingProject

public void validateNewChainForExistingProject(@NotNull
                                               com.opensymphony.xwork.ValidationAware validationAware,
                                               java.lang.String existingProjectKey,
                                               java.lang.String buildKey,
                                               java.lang.String buildName)
Description copied from interface: PlanValidationService
Validate that new chain name and key is unique within the project

Specified by:
validateNewChainForExistingProject in interface PlanValidationService
Parameters:
validationAware - - object to add errors to if any are found
existingProjectKey - - the key of an existing project
buildKey - - the key for the new chain
buildName - - the name of the new chain

validateNewChainForExistingProject

public void validateNewChainForExistingProject(@NotNull
                                               com.opensymphony.xwork.ValidationAware validationAware,
                                               @NotNull
                                               java.lang.String existingProjectKey,
                                               @NotNull
                                               java.lang.String buildName)
Description copied from interface: PlanValidationService
Validate that new chain name (only) is unique within the project

Specified by:
validateNewChainForExistingProject in interface PlanValidationService
Parameters:
validationAware - - object to add errors to if any are found
existingProjectKey - - the key of an existing project
buildName - - the name of the new chain

validateNewPlanBranchForMaster

public void validateNewPlanBranchForMaster(@NotNull
                                           com.opensymphony.xwork.ValidationAware validationAware,
                                           @NotNull
                                           ImmutableChain masterChain,
                                           @NotNull
                                           java.lang.String branchName)
Description copied from interface: PlanValidationService
Validate that new plan branch name (only) is unique within a set of branches with a common master

Specified by:
validateNewPlanBranchForMaster in interface PlanValidationService
Parameters:
validationAware - object to add errors to if any are found
masterChain - the master chain
branchName - the name of the new chain

validateNewProjectDetails

public void validateNewProjectDetails(@NotNull
                                      com.opensymphony.xwork.ValidationAware validationAware,
                                      java.lang.String projectName,
                                      java.lang.String projectKey)
Description copied from interface: PlanValidationService
Validate that the new project details are valid

Specified by:
validateNewProjectDetails in interface PlanValidationService
Parameters:
validationAware - - object to add errors to if any are found
projectName - - name of the project to validate
projectKey - - key of the project to validate

validateNewStageForChain

public void validateNewStageForChain(@NotNull
                                     com.opensymphony.xwork.ValidationAware validationAware,
                                     @NotNull
                                     Chain chain,
                                     @Nullable
                                     java.lang.String stageName)
Description copied from interface: PlanValidationService
Validate the the new stage can be added to the given chain

Specified by:
validateNewStageForChain in interface PlanValidationService
Parameters:
validationAware - - to add any errors to
chain - - the chain the stage will be added to
stageName - - the stage to be added

validateStageExistsForChain

public void validateStageExistsForChain(com.opensymphony.xwork.ValidationAware validationAware,
                                        Chain chain,
                                        java.lang.String stageName)
Description copied from interface: PlanValidationService
Ensures that the stage currently exists for a chain

Specified by:
validateStageExistsForChain in interface PlanValidationService
Parameters:
validationAware - - to add the errors to
chain - - the chain the stage should exist in
stageName - - the stage to check for

getRepositoryConfigHelper

public RepositoryConfigHelper getRepositoryConfigHelper()
Specified by:
getRepositoryConfigHelper in interface PlanValidationService
Returns:
Helper object to manipulate repository configuration

getBuildStrategyConfigHelper

public BuildStrategyConfigHelper getBuildStrategyConfigHelper()
Specified by:
getBuildStrategyConfigHelper in interface PlanValidationService
Returns:
Helper object to manipulate build strategy configuration

getWebRepositoryConfigHelper

public WebRepositoryConfigHelper getWebRepositoryConfigHelper()
Specified by:
getWebRepositoryConfigHelper in interface PlanValidationService
Returns:
Helper object to manipulate web repository configuration


Copyright © 2012 Atlassian. All Rights Reserved.