com.atlassian.bamboo.build.creation
Class ChainCreationServiceImpl

java.lang.Object
  extended by com.atlassian.bamboo.build.creation.PlanCreationTemplate
      extended by com.atlassian.bamboo.build.creation.ChainCreationServiceImpl
All Implemented Interfaces:
ChainCreationService, PlanCreationService

public class ChainCreationServiceImpl
extends PlanCreationTemplate
implements ChainCreationService


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.bamboo.build.creation.PlanCreationService
PlanCreationService.EnablePlan
 
Field Summary
 
Fields inherited from class com.atlassian.bamboo.build.creation.PlanCreationTemplate
aclUpdateHelper, artifactDefinitionManager, artifactSubscriptionManager, auditLogService, authenticationContext, bambooLicenseManager, branchCommitInformationManager, buildDefinitionConverter, buildStrategyConfigHelper, eventPublisher, notificationManager, planManager, planValidationService, projectManager, repositoryConfigHelper, repositoryDefinitionManager, variableDefinitionManager, vcsBranchManager, webRepositoryConfigHelper
 
Fields inherited from interface com.atlassian.bamboo.build.creation.ChainCreationService
CHAIN_KEY
 
Constructor Summary
ChainCreationServiceImpl(PlanManager planManager, ProjectManager projectManager, BambooAclUpdateHelper aclUpdateHelper, BambooAuthenticationContext authenticationContext, BambooLicenseManager bambooLicenseManager, HibernateMutableAclService aclService, PlanScheduler planScheduler, RepositoryConfigHelper repositoryConfigHelper, BuildStrategyConfigHelper buildStrategyConfigHelper, WebRepositoryConfigHelper webRepositoryConfigHelper, com.atlassian.event.api.EventPublisher eventPublisher, PlanValidationService planValidationService, AuditLogService auditLogService, BuildDefinitionConverter buildDefinitionConverter, NotificationManager notificationManager, JobCreationService jobCreationService, ArtifactDefinitionManager artifactDefinitionManager, ArtifactSubscriptionManager artifactSubscriptionManager, VariableDefinitionManager variableDefinitionManager, RepositoryDefinitionManager repositoryDefinitionManager, TaskConfigurationService taskConfigurationService, ScopedExclusionService scopedExclusionService, BranchCommitInformationManager branchCommitInformationManager, VcsBranchManager vcsBranchManager, BranchDetectionService branchDetectionService)
           
 
Method Summary
 void cleanBuildConfiguration(BuildConfiguration buildConfiguration, Plan plan)
          Clean build configuration for saving.
 java.lang.String createPlan(BuildConfiguration buildConfiguration, ActionParametersMap params, PlanCreationService.EnablePlan enabled)
          Creates a plan from its components and saves it to the database
 BuildConfiguration getBuildConfigurationWithDefaults()
           
protected  org.acegisecurity.acls.MutableAcl getDefaultPermissionsForPlan()
          Generate the permissions to be stored against the plan on creation
 Chain getNewInstance()
           
protected  boolean performCloneIfRequired(PlanCreationBean planCreationBean, ActionParametersMap params)
          Using the action parameters determine if cloning is required and if so, perform the clone.
protected  void performPostCreateAction(Plan plan)
          Perform plan specific actions that need to be run immediately after plan creation.
protected  void prepareBuildConfiguration(BuildConfiguration buildConfiguration, Plan plan, PlanCreationBean planCreationBean)
          Prepare build configuration for saving.
protected  void preparePlanDetails(Plan plan, ActionParametersMap params)
          Prepare the plan object for saving.
protected  void saveAndUpdateParents(Plan plan)
          Perform any necessary database operations required before saving the plan.
protected  void setFullPlanKey(Plan plan)
          Set the full key for this plan
 void triggerCreationCompleteEvents(PlanKey planKey)
          Trigger the appropriate events after the plan has been saved successfully Calling this method is responsibility of class using this template.
 void validateChainDetails(com.opensymphony.xwork.ValidationAware validationAware, ActionParametersMap params)
           
 void validateCloneDetails(com.opensymphony.xwork.ValidationAware validationAware, ActionParametersMap params)
           
 void validatePlan(com.opensymphony.xwork.ValidationAware validationAware, BuildConfiguration buildConfiguration, ActionParametersMap params)
          Validates plan details and build configuration details for initial plan creation.
 
Methods inherited from class com.atlassian.bamboo.build.creation.PlanCreationTemplate
cleanBuildConfiguration, clonePlanPermissionsToSession, logBuildConfiguration, savePlan
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.bamboo.build.creation.PlanCreationService
savePlan
 

Constructor Detail

ChainCreationServiceImpl

public ChainCreationServiceImpl(PlanManager planManager,
                                ProjectManager projectManager,
                                BambooAclUpdateHelper aclUpdateHelper,
                                BambooAuthenticationContext authenticationContext,
                                BambooLicenseManager bambooLicenseManager,
                                HibernateMutableAclService aclService,
                                PlanScheduler planScheduler,
                                RepositoryConfigHelper repositoryConfigHelper,
                                BuildStrategyConfigHelper buildStrategyConfigHelper,
                                WebRepositoryConfigHelper webRepositoryConfigHelper,
                                com.atlassian.event.api.EventPublisher eventPublisher,
                                PlanValidationService planValidationService,
                                AuditLogService auditLogService,
                                BuildDefinitionConverter buildDefinitionConverter,
                                NotificationManager notificationManager,
                                JobCreationService jobCreationService,
                                ArtifactDefinitionManager artifactDefinitionManager,
                                ArtifactSubscriptionManager artifactSubscriptionManager,
                                VariableDefinitionManager variableDefinitionManager,
                                RepositoryDefinitionManager repositoryDefinitionManager,
                                TaskConfigurationService taskConfigurationService,
                                ScopedExclusionService scopedExclusionService,
                                BranchCommitInformationManager branchCommitInformationManager,
                                VcsBranchManager vcsBranchManager,
                                BranchDetectionService branchDetectionService)
Method Detail

validatePlan

public void validatePlan(com.opensymphony.xwork.ValidationAware validationAware,
                         BuildConfiguration buildConfiguration,
                         ActionParametersMap params)
Description copied from interface: PlanCreationService
Validates plan details and build configuration details for initial plan creation. Adds errors to the validationAware object.

Specified by:
validatePlan in interface PlanCreationService
Parameters:
validationAware - - object to add errors to (usually an action class)
buildConfiguration - - build configuration to validate
params - - parameter map containing any plan details not in the build configuration.

validateChainDetails

public void validateChainDetails(com.opensymphony.xwork.ValidationAware validationAware,
                                 ActionParametersMap params)
Specified by:
validateChainDetails in interface ChainCreationService

validateCloneDetails

public void validateCloneDetails(com.opensymphony.xwork.ValidationAware validationAware,
                                 ActionParametersMap params)
Specified by:
validateCloneDetails in interface ChainCreationService

getNewInstance

public Chain getNewInstance()
Specified by:
getNewInstance in interface PlanCreationService
Returns:
A new plan instance, concrete type determined by implementation classes

getDefaultPermissionsForPlan

protected org.acegisecurity.acls.MutableAcl getDefaultPermissionsForPlan()
Description copied from class: PlanCreationTemplate
Generate the permissions to be stored against the plan on creation

Specified by:
getDefaultPermissionsForPlan in class PlanCreationTemplate
Returns:
the permissions to be stored against the plan on creation

getBuildConfigurationWithDefaults

public BuildConfiguration getBuildConfigurationWithDefaults()
Specified by:
getBuildConfigurationWithDefaults in interface PlanCreationService
Returns:
A buildConfiguration instance with the requried defaults populated

preparePlanDetails

protected void preparePlanDetails(@NotNull
                                  Plan plan,
                                  @NotNull
                                  ActionParametersMap params)
Description copied from class: PlanCreationTemplate
Prepare the plan object for saving.

Specified by:
preparePlanDetails in class PlanCreationTemplate
Parameters:
plan - to add properties to
params - containing any properties provided from the UI.

performCloneIfRequired

protected boolean performCloneIfRequired(@NotNull
                                         PlanCreationBean planCreationBean,
                                         @NotNull
                                         ActionParametersMap params)
                                  throws PlanCreationDeniedException
Description copied from class: PlanCreationTemplate
Using the action parameters determine if cloning is required and if so, perform the clone. Cloned details are put in the PlanCreationBean.

Specified by:
performCloneIfRequired in class PlanCreationTemplate
Parameters:
planCreationBean - containing the plan and acls (currently does not contain buildConfiguration)
params - containing any properties provided from the UI
Returns:
true if cloning has been completed
Throws:
PlanCreationDeniedException - if cloning required but can't be completed due to licensing restrictions

prepareBuildConfiguration

protected void prepareBuildConfiguration(@NotNull
                                         BuildConfiguration buildConfiguration,
                                         @NotNull
                                         Plan plan,
                                         @NotNull
                                         PlanCreationBean planCreationBean)
Description copied from class: PlanCreationTemplate
Prepare build configuration for saving. Only occurs if cloning did NOT occur.

Specified by:
prepareBuildConfiguration in class PlanCreationTemplate
Parameters:
buildConfiguration - the current build configuration.
plan - the current plan (will already have details populated)

cleanBuildConfiguration

public void cleanBuildConfiguration(@NotNull
                                    BuildConfiguration buildConfiguration,
                                    @NotNull
                                    Plan plan)
Description copied from class: PlanCreationTemplate
Clean build configuration for saving. Build Config may have been cloned.

Specified by:
cleanBuildConfiguration in interface ChainCreationService
Specified by:
cleanBuildConfiguration in class PlanCreationTemplate
Parameters:
buildConfiguration - the current build configuration.
plan - the current plan (will already have details populated)

createPlan

public java.lang.String createPlan(@NotNull
                                   BuildConfiguration buildConfiguration,
                                   @NotNull
                                   ActionParametersMap params,
                                   @NotNull
                                   PlanCreationService.EnablePlan enabled)
                            throws PlanCreationDeniedException,
                                   PlanCreationException
Description copied from interface: PlanCreationService
Creates a plan from its components and saves it to the database

Specified by:
createPlan in interface PlanCreationService
Overrides:
createPlan in class PlanCreationTemplate
Parameters:
buildConfiguration - of the plan to create
params - containing any other required params NOT in the buildConfiguration
enabled - whether the plan should start enabled or disabled
Returns:
the full key of the created plan
Throws:
PlanCreationDeniedException - if plan creation fails because you already have too many plans.
PlanCreationException - if plan creation fails for any other reason

setFullPlanKey

protected void setFullPlanKey(@NotNull
                              Plan plan)
Description copied from class: PlanCreationTemplate
Set the full key for this plan

Specified by:
setFullPlanKey in class PlanCreationTemplate
Parameters:
plan - - complete plan to be saved

saveAndUpdateParents

protected void saveAndUpdateParents(@NotNull
                                    Plan plan)
Description copied from class: PlanCreationTemplate
Perform any necessary database operations required before saving the plan. E.g. creation of new projects.

Specified by:
saveAndUpdateParents in class PlanCreationTemplate
Parameters:
plan - - complete plan (except for full key) to be saved

performPostCreateAction

protected void performPostCreateAction(@NotNull
                                       Plan plan)
Description copied from class: PlanCreationTemplate
Perform plan specific actions that need to be run immediately after plan creation.

Specified by:
performPostCreateAction in class PlanCreationTemplate
Parameters:
plan - created plan

triggerCreationCompleteEvents

public void triggerCreationCompleteEvents(PlanKey planKey)
Description copied from class: PlanCreationTemplate
Trigger the appropriate events after the plan has been saved successfully Calling this method is responsibility of class using this template.

Specified by:
triggerCreationCompleteEvents in interface PlanCreationService
Specified by:
triggerCreationCompleteEvents in class PlanCreationTemplate


Copyright © 2012 Atlassian. All Rights Reserved.