com.atlassian.bamboo.build.creation
Class PlanCreationTemplate

java.lang.Object
  extended by com.atlassian.bamboo.build.creation.PlanCreationTemplate
All Implemented Interfaces:
PlanCreationService
Direct Known Subclasses:
BuildCreationService, ChainCreationService, JobCreationService

public abstract class PlanCreationTemplate
extends java.lang.Object
implements PlanCreationService


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.bamboo.build.creation.PlanCreationService
PlanCreationService.EnablePlan
 
Field Summary
protected  BambooAclUpdateHelper aclUpdateHelper
           
protected  ArtifactDefinitionManager artifactDefinitionManager
           
protected  ArtifactSubscriptionManager artifactSubscriptionManager
           
protected  AuditLogService auditLogService
           
protected  BambooAuthenticationContext authenticationContext
           
protected  BambooLicenseManager bambooLicenseManager
           
protected  BuildDefinitionConverter buildDefinitionConverter
           
protected  BuildStrategyConfigHelper buildStrategyConfigHelper
           
protected  com.atlassian.event.EventManager eventManager
           
protected  PlanManager planManager
           
protected  PlanValidationService planValidationService
           
protected  ProjectManager projectManager
           
protected  RepositoryConfigHelper repositoryConfigHelper
           
protected  WebRepositoryConfigHelper webRepositoryConfigHelper
           
 
Constructor Summary
protected PlanCreationTemplate(PlanManager planManager, ProjectManager projectManager, BambooAclUpdateHelper aclUpdateHelper, BambooAuthenticationContext authenticationContext, BambooLicenseManager bambooLicenseManager, HibernateMutableAclService aclService, PlanScheduler planScheduler, RepositoryConfigHelper repositoryConfigHelper, BuildStrategyConfigHelper buildStrategyConfigHelper, WebRepositoryConfigHelper webRepositoryConfigHelper, com.atlassian.event.EventManager eventManager, PlanValidationService planValidationService, AuditLogService auditLogService, BuildDefinitionConverter buildDefinitionConverter, ArtifactDefinitionManager artifactDefinitionManager, ArtifactSubscriptionManager artifactSubscriptionManager)
           
 
Method Summary
static void cleanBuildConfiguration(BuildConfiguration buildConfiguration)
          Performs general cleanup of the builcConfiguration, cleaning up properties we don't want to save mostly these are properties that get used for UI display.
protected abstract  void cleanBuildConfiguration(BuildConfiguration buildConfiguration, Plan plan)
          Clean build configuration for saving.
protected  void clonePlanPermissionsToSession(Plan buildToClone, PlanCreationBean planCreationBean, java.lang.String planOwner)
           
 java.lang.String createPlan(BuildConfiguration buildConfiguration, ActionParametersMap actionParametersMap, PlanCreationService.EnablePlan enabled)
          Creates a plan from its components and saves it to the database
protected abstract  org.acegisecurity.acls.MutableAcl getDefaultPermissionsForPlan()
          Generate the permissions to be stored against the plan on creation
protected  void logBuildConfiguration(BuildConfiguration buildConfiguration)
           
protected abstract  boolean performCloneIfRequired(PlanCreationBean planCreationBean, ActionParametersMap params)
          Using the action parameters determine if cloning is required and if so, perform the clone.
protected abstract  void prepareBuildConfiguration(BuildConfiguration buildConfiguration, Plan plan)
          Prepare build configuration for saving.
protected abstract  void preparePlanDetails(Plan plan, ActionParametersMap params)
          Prepare the plan object for saving.
protected abstract  void saveAndUpdateParents(Plan plan)
          Perform any necessary database operations required before saving the plan.
 java.lang.String savePlan(PlanCreationBean planCreationBean)
          Saves a already created plan to the database
protected abstract  void setFullPlanKey(Plan plan)
          Set the full key for this plan
abstract  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.
 
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
getBuildConfigurationWithDefaults, getNewInstance, validatePlan
 

Field Detail

planManager

protected final PlanManager planManager

authenticationContext

protected final BambooAuthenticationContext authenticationContext

projectManager

protected final ProjectManager projectManager

repositoryConfigHelper

protected final RepositoryConfigHelper repositoryConfigHelper

buildStrategyConfigHelper

protected final BuildStrategyConfigHelper buildStrategyConfigHelper

webRepositoryConfigHelper

protected final WebRepositoryConfigHelper webRepositoryConfigHelper

eventManager

protected final com.atlassian.event.EventManager eventManager

planValidationService

protected final PlanValidationService planValidationService

auditLogService

protected final AuditLogService auditLogService

buildDefinitionConverter

protected final BuildDefinitionConverter buildDefinitionConverter

aclUpdateHelper

protected final BambooAclUpdateHelper aclUpdateHelper

bambooLicenseManager

protected final BambooLicenseManager bambooLicenseManager

artifactDefinitionManager

protected final ArtifactDefinitionManager artifactDefinitionManager

artifactSubscriptionManager

protected final ArtifactSubscriptionManager artifactSubscriptionManager
Constructor Detail

PlanCreationTemplate

protected PlanCreationTemplate(PlanManager planManager,
                               ProjectManager projectManager,
                               BambooAclUpdateHelper aclUpdateHelper,
                               BambooAuthenticationContext authenticationContext,
                               BambooLicenseManager bambooLicenseManager,
                               HibernateMutableAclService aclService,
                               PlanScheduler planScheduler,
                               RepositoryConfigHelper repositoryConfigHelper,
                               BuildStrategyConfigHelper buildStrategyConfigHelper,
                               WebRepositoryConfigHelper webRepositoryConfigHelper,
                               com.atlassian.event.EventManager eventManager,
                               PlanValidationService planValidationService,
                               AuditLogService auditLogService,
                               BuildDefinitionConverter buildDefinitionConverter,
                               ArtifactDefinitionManager artifactDefinitionManager,
                               ArtifactSubscriptionManager artifactSubscriptionManager)
Method Detail

preparePlanDetails

protected abstract void preparePlanDetails(@NotNull
                                           Plan plan,
                                           @NotNull
                                           ActionParametersMap params)
Prepare the plan object for saving.

Parameters:
plan - to add properties to
params - containing any properties provided from the UI.

performCloneIfRequired

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

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:
PlanCreationException - if cloning is required but fails.
PlanCreationDeniedException - if cloning required but can't be completed due to licensing restrictions

getDefaultPermissionsForPlan

@Nullable
protected abstract org.acegisecurity.acls.MutableAcl getDefaultPermissionsForPlan()
Generate the permissions to be stored against the plan on creation

Returns:
the permissions to be stored against the plan on creation

prepareBuildConfiguration

protected abstract void prepareBuildConfiguration(@NotNull
                                                  BuildConfiguration buildConfiguration,
                                                  @NotNull
                                                  Plan plan)
Prepare build configuration for saving. Only occurs if cloning did NOT occur.

Parameters:
buildConfiguration - the current build configuration.
plan - the current plan (will already have details populated)

cleanBuildConfiguration

protected abstract void cleanBuildConfiguration(@NotNull
                                                BuildConfiguration buildConfiguration,
                                                @NotNull
                                                Plan plan)
Clean build configuration for saving. Build Config may have been cloned.

Parameters:
buildConfiguration - the current build configuration.
plan - the current plan (will already have details populated)

saveAndUpdateParents

protected abstract void saveAndUpdateParents(@NotNull
                                             Plan plan)
Perform any necessary database operations required before saving the plan. E.g. creation of new projects.

Parameters:
plan - - complete plan (except for full key) to be saved

setFullPlanKey

protected abstract void setFullPlanKey(@NotNull
                                       Plan plan)
Set the full key for this plan

Parameters:
plan - - complete plan to be saved

triggerCreationCompleteEvents

public abstract 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.

Specified by:
triggerCreationCompleteEvents in interface PlanCreationService
Parameters:
planKey -

createPlan

public java.lang.String createPlan(BuildConfiguration buildConfiguration,
                                   ActionParametersMap actionParametersMap,
                                   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
Parameters:
buildConfiguration - of the plan to create
actionParametersMap - 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

savePlan

public java.lang.String savePlan(PlanCreationBean planCreationBean)
                          throws PlanCreationDeniedException,
                                 PlanCreationException
Description copied from interface: PlanCreationService
Saves a already created plan to the database

Specified by:
savePlan in interface PlanCreationService
Parameters:
planCreationBean - containing the required components for saving
Returns:
The full key of the build just created
Throws:
PlanCreationDeniedException - if plan creation fails because you already have too many plans.
PlanCreationException - if plan creation fails for any other reason

cleanBuildConfiguration

public static void cleanBuildConfiguration(BuildConfiguration buildConfiguration)
Performs general cleanup of the builcConfiguration, cleaning up properties we don't want to save mostly these are properties that get used for UI display.

Parameters:
buildConfiguration - to clean

clonePlanPermissionsToSession

protected void clonePlanPermissionsToSession(Plan buildToClone,
                                             PlanCreationBean planCreationBean,
                                             java.lang.String planOwner)

logBuildConfiguration

protected void logBuildConfiguration(BuildConfiguration buildConfiguration)


Copyright © 2011 Atlassian. All Rights Reserved.