com.atlassian.bamboo.build.creation
Class PlanValidationServiceImpl

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

public class PlanValidationServiceImpl
extends Object
implements PlanValidationService


Field Summary
static String CHAIN_PREFIX
           
static String JOB_PREFIX
           
static Pattern KEY_PATTERN
           
static String PLAN_PREFIX
           
static String PROJECT_PREFIX
           
static String STAGE_PREFIX
           
static String SUB_BUILD_KEY
           
 
Fields inherited from interface com.atlassian.bamboo.build.creation.PlanValidationService
KEY_REGEXP
 
Constructor Summary
PlanValidationServiceImpl(ValidationService validationService, ProjectManager projectManager, PlanManager planManager, com.opensymphony.xwork2.TextProvider textProvider, RepositoryConfigHelper repositoryConfigHelper, WebRepositoryConfigHelper webRepositoryConfigHelper, ChainBranchManager chainBranchManager)
           
 
Method Summary
 RepositoryConfigHelper getRepositoryConfigHelper()
           
 WebRepositoryConfigHelper getWebRepositoryConfigHelper()
           
 void validateDescription(com.atlassian.struts.ValidationAware validationAware, String fieldName, String description)
          Validate the description field of any object.
 void validateDescription(com.opensymphony.xwork.ValidationAware validationAware, String fieldName, String description)
          Validate the description field of any object.
 void validateKey(com.atlassian.struts.ValidationAware validationAware, String fieldName, String errorPrefix, String key)
          Validate any String against Bamboo's generic rules for keys.
 void validateKey(com.opensymphony.xwork.ValidationAware validationAware, String fieldName, String errorPrefix, String key)
          Validate any String against Bamboo's generic rules for keys.
 void validateName(com.atlassian.struts.ValidationAware validationAware, String fieldName, String errorPrefix, String name)
          Validate any String against Bamboo's generic rules for names.
 void validateName(com.opensymphony.xwork.ValidationAware validationAware, String fieldName, String errorPrefix, String name)
          Validate any String against Bamboo's generic rules for names.
 void validateNewChainForExistingProject(com.atlassian.struts.ValidationAware validationAware, String existingProjectKey, String buildName)
          Validate that new chain name (only) is unique within the project
 void validateNewChainForExistingProject(com.opensymphony.xwork.ValidationAware validationAware, String existingProjectKey, String chainName)
          Validate that new chain name (only) is unique within the project
 void validateNewChainForExistingProject(com.atlassian.struts.ValidationAware validationAware, String existingProjectKey, String buildKey, String buildName)
          Validate that new chain name and key is unique within the project
 void validateNewChainForExistingProject(com.opensymphony.xwork.ValidationAware validationAware, String existingProjectKey, String chainKey, String chainName)
          Validate that new chain name and key is unique within the project
 void validateNewJobForExistingChain(com.atlassian.struts.ValidationAware validationAware, Chain existingChain, String buildKey, String buildName)
           
 void validateNewJobForExistingChain(com.opensymphony.xwork.ValidationAware validationAware, Chain existingChain, String buildKey, String buildName)
           
 void validateNewPlanBranchForMaster(com.atlassian.struts.ValidationAware validationAware, ImmutableChain masterChain, String branchName)
          Validate that new plan branch name (only) is unique within a set of branches with a common master
 void validateNewPlanBranchForMaster(com.opensymphony.xwork.ValidationAware validationAware, ImmutableChain masterChain, String branchName)
          Validate that new plan branch name (only) is unique within a set of branches with a common master
 void validateNewPlanDetails(com.atlassian.struts.ValidationAware validationAware, String buildKey, String buildName)
          Ensure that the build key & name are valid
 void validateNewPlanDetails(com.opensymphony.xwork.ValidationAware validationAware, String buildKey, String buildName)
          Ensure that the build key & name are valid
 void validateNewProjectDetails(com.atlassian.struts.ValidationAware validationAware, String projectName, String projectKey)
          Validate that the new project details are valid
 void validateNewProjectDetails(com.opensymphony.xwork.ValidationAware validationAware, String projectName, String projectKey)
          Validate that the new project details are valid
 void validateNewStageForChain(com.atlassian.struts.ValidationAware validationAware, Chain chain, String stageName)
          Validate the the new stage can be added to the given chain
 void validateNewStageForChain(com.opensymphony.xwork.ValidationAware validationAware, Chain chain, String stageName)
          Validate the the new stage can be added to the given chain
 void validatePlanToCloneExists(com.atlassian.struts.ValidationAware validationAware, String buildKeyToClone)
          Validate that the plan t clone exists
 void validatePlanToCloneExists(com.opensymphony.xwork.ValidationAware validationAware, String buildKeyToClone)
          Validate that the plan t clone exists
 void validateStageExistsForChain(com.atlassian.struts.ValidationAware validationAware, Chain chain, String stageName)
          Ensures that the stage currently exists for a chain
 void validateStageExistsForChain(com.opensymphony.xwork.ValidationAware validationAware, Chain chain, 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

KEY_PATTERN

public static final Pattern KEY_PATTERN

PLAN_PREFIX

public static final String PLAN_PREFIX
See Also:
Constant Field Values

PROJECT_PREFIX

public static final String PROJECT_PREFIX
See Also:
Constant Field Values

CHAIN_PREFIX

public static final String CHAIN_PREFIX
See Also:
Constant Field Values

JOB_PREFIX

public static final String JOB_PREFIX
See Also:
Constant Field Values

STAGE_PREFIX

public static final String STAGE_PREFIX
See Also:
Constant Field Values

SUB_BUILD_KEY

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

PlanValidationServiceImpl

public PlanValidationServiceImpl(ValidationService validationService,
                                 ProjectManager projectManager,
                                 PlanManager planManager,
                                 com.opensymphony.xwork2.TextProvider textProvider,
                                 RepositoryConfigHelper repositoryConfigHelper,
                                 WebRepositoryConfigHelper webRepositoryConfigHelper,
                                 ChainBranchManager chainBranchManager)
Method Detail

validateKey

public void validateKey(@NotNull
                        com.atlassian.struts.ValidationAware validationAware,
                        String fieldName,
                        String errorPrefix,
                        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.atlassian.struts.ValidationAware validationAware,
                         String fieldName,
                         String errorPrefix,
                         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.atlassian.struts.ValidationAware validationAware,
                                String fieldName,
                                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.atlassian.struts.ValidationAware validationAware,
                                      @Nullable
                                      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.atlassian.struts.ValidationAware validationAware,
                                   String buildKey,
                                   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.atlassian.struts.ValidationAware validationAware,
                                           @NotNull
                                           Chain existingChain,
                                           @NotNull
                                           String buildKey,
                                           @Nullable
                                           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.atlassian.struts.ValidationAware validationAware,
                                               String existingProjectKey,
                                               String buildKey,
                                               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.atlassian.struts.ValidationAware validationAware,
                                               @NotNull
                                               String existingProjectKey,
                                               @NotNull
                                               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.atlassian.struts.ValidationAware validationAware,
                                           @NotNull
                                           ImmutableChain masterChain,
                                           @NotNull
                                           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.atlassian.struts.ValidationAware validationAware,
                                      String projectName,
                                      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.atlassian.struts.ValidationAware validationAware,
                                     @NotNull
                                     Chain chain,
                                     @Nullable
                                     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.atlassian.struts.ValidationAware validationAware,
                                        Chain chain,
                                        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

getWebRepositoryConfigHelper

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

validateKey

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

Specified by:
validateKey in interface PlanValidationServiceXWork1
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,
                         String fieldName,
                         String errorPrefix,
                         String name)
Description copied from interface: PlanValidationServiceXWork1
Validate any String against Bamboo's generic rules for names.

Specified by:
validateName in interface PlanValidationServiceXWork1
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,
                                String fieldName,
                                String description)
Description copied from interface: PlanValidationServiceXWork1
Validate the description field of any object. All it really does is check length

Specified by:
validateDescription in interface PlanValidationServiceXWork1
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
                                      String buildKeyToClone)
Description copied from interface: PlanValidationServiceXWork1
Validate that the plan t clone exists

Specified by:
validatePlanToCloneExists in interface PlanValidationServiceXWork1
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,
                                   @Nullable
                                   String buildKey,
                                   @Nullable
                                   String buildName)
Description copied from interface: PlanValidationServiceXWork1
Ensure that the build key & name are valid

Specified by:
validateNewPlanDetails in interface PlanValidationServiceXWork1
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
                                           String buildKey,
                                           @Nullable
                                           String buildName)
Specified by:
validateNewJobForExistingChain in interface PlanValidationServiceXWork1
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,
                                               String existingProjectKey,
                                               String chainKey,
                                               String chainName)
Description copied from interface: PlanValidationServiceXWork1
Validate that new chain name and key is unique within the project

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

validateNewChainForExistingProject

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

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

validateNewPlanBranchForMaster

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

Specified by:
validateNewPlanBranchForMaster in interface PlanValidationServiceXWork1
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,
                                      @Nullable
                                      String projectName,
                                      @Nullable
                                      String projectKey)
Description copied from interface: PlanValidationServiceXWork1
Validate that the new project details are valid

Specified by:
validateNewProjectDetails in interface PlanValidationServiceXWork1
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(com.opensymphony.xwork.ValidationAware validationAware,
                                     Chain chain,
                                     String stageName)
Description copied from interface: PlanValidationServiceXWork1
Validate the the new stage can be added to the given chain

Specified by:
validateNewStageForChain in interface PlanValidationServiceXWork1
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,
                                        String stageName)
Description copied from interface: PlanValidationServiceXWork1
Ensures that the stage currently exists for a chain

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


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