Class PlanCreationTemplate
java.lang.Object
com.atlassian.bamboo.build.creation.PlanCreationTemplate
- All Implemented Interfaces:
PlanCreationService
- Direct Known Subclasses:
ChainBranchCreationServiceImpl
,ChainCreationServiceImpl
,JobCreationServiceImpl
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.bamboo.build.creation.PlanCreationService
PlanCreationService.EnablePlan
-
Field Summary
Modifier and TypeFieldDescriptionprotected final BambooAclUpdateHelper
protected final ArtifactDefinitionManager
protected final ArtifactSubscriptionManager
protected final AuditLogService
protected final BambooAuthenticationContext
protected final BambooLicenseManager
protected final BranchCommitInformationManager
protected final BuildDefinitionConverter
protected final com.atlassian.event.api.EventPublisher
protected final NotificationManager
protected final PlanManager
protected final PlanValidationService
protected final ProjectManager
protected final RepositoryDefinitionManager
protected final TriggerConfigurationService
protected final VariableDefinitionManager
protected final VcsBranchManager
Fields inherited from interface com.atlassian.bamboo.build.creation.PlanCreationService
EXISTING_PROJECT_KEY, NEW_PROJECT_MARKER, PROJECT_DESCRIPTION, PROJECT_KEY, PROJECT_NAME
-
Constructor Summary
ModifierConstructorDescriptionprotected
PlanCreationTemplate
(PlanManager planManager, ProjectManager projectManager, BambooAclUpdateHelper aclUpdateHelper, BambooAuthenticationContext authenticationContext, BambooLicenseManager bambooLicenseManager, HibernateMutableAclService aclService, PlanScheduler planScheduler, com.atlassian.event.api.EventPublisher eventPublisher, PlanValidationService planValidationService, AuditLogService auditLogService, BuildDefinitionConverter buildDefinitionConverter, ArtifactDefinitionManager artifactDefinitionManager, ArtifactSubscriptionManager artifactSubscriptionManager, VariableDefinitionManager variableDefinitionManager, RepositoryDefinitionManager repositoryDefinitionManager, TaskConfigurationService taskConfigurationService, NotificationManager notificationManager, BranchCommitInformationManager branchCommitInformationManager, VcsBranchManager vcsBranchManager, TriggerConfigurationService triggerConfigurationService, BuildNumberGeneratorService buildNumberGeneratorService, TransactionAndHibernateTemplate hibernateTemplate) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
cleanBuildConfiguration
(@NotNull BuildConfiguration buildConfiguration, @NotNull Plan plan) Clean build configuration for saving.static void
cleanBuildConfiguration
(BuildConfiguration buildConfiguration) Performs general cleanup of the buildConfiguration, cleaning up properties we don't want to save mostly these are properties that get used for UI display.protected void
clonePlanPermissionsToSession
(Plan buildToClone, PlanCreationBean planCreationBean, String planOwner) protected String
createPlan
(@NotNull BuildConfiguration buildConfiguration, @NotNull ActionParametersMap actionParametersMap, @NotNull PlanCreationService.EnablePlan enabled, @NotNull BiConsumer<Plan, ActionParametersMap> preparePlanDetails) Creates and saves a planprotected abstract @Nullable org.acegisecurity.acls.MutableAcl
getDefaultPermissionsForPlan
(boolean accessForAllUsers) Generate the permissions to be stored against the plan on creation.protected void
logBuildConfiguration
(BuildConfiguration buildConfiguration) protected abstract boolean
performCloneIfRequired
(@NotNull BuildConfiguration buildConfiguration, @NotNull PlanCreationBean planCreationBean, @NotNull ActionParametersMap params) Using the action parameters determine if cloning is required and if so, perform the clone.protected abstract void
performPostCreateAction
(@NotNull Plan plan) Perform plan specific actions that need to be run immediately after plan creation.protected abstract void
postCreationSynchronisation
(@NotNull PlanCreationBean planCreationBean) Perform any state synchronisation required after creating plan.protected abstract void
prepareBuildConfiguration
(@NotNull BuildConfiguration buildConfiguration, @NotNull Plan plan, @NotNull PlanCreationBean planCreationBean) Prepare build configuration for saving.protected abstract void
saveAndUpdateParents
(@NotNull PlanCreationBean planCreationBean) Perform any necessary database operations required before saving the plan.protected void
saveAndUpdateParents
(@NotNull Plan plan) Deprecated.since 6.9.savePlan
(@NotNull PlanCreationBean planCreationBean) Saves a already created plan to the databaseprotected abstract void
setFullPlanKey
(@NotNull Plan plan) Set the full key for this planabstract 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.protected void
validateThrowingPlanCreationException
(boolean condition, String message) 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
createPlan, getBuildConfigurationWithDefaults, getNewInstance, validatePlan
-
Field Details
-
planManager
-
authenticationContext
-
projectManager
-
eventPublisher
protected final com.atlassian.event.api.EventPublisher eventPublisher -
planValidationService
-
auditLogService
-
buildDefinitionConverter
-
aclUpdateHelper
-
bambooLicenseManager
-
artifactDefinitionManager
-
artifactSubscriptionManager
-
variableDefinitionManager
-
repositoryDefinitionManager
-
notificationManager
-
branchCommitInformationManager
-
vcsBranchManager
-
triggerConfigurationService
-
-
Constructor Details
-
PlanCreationTemplate
protected PlanCreationTemplate(PlanManager planManager, ProjectManager projectManager, BambooAclUpdateHelper aclUpdateHelper, BambooAuthenticationContext authenticationContext, BambooLicenseManager bambooLicenseManager, HibernateMutableAclService aclService, PlanScheduler planScheduler, com.atlassian.event.api.EventPublisher eventPublisher, PlanValidationService planValidationService, AuditLogService auditLogService, BuildDefinitionConverter buildDefinitionConverter, ArtifactDefinitionManager artifactDefinitionManager, ArtifactSubscriptionManager artifactSubscriptionManager, VariableDefinitionManager variableDefinitionManager, RepositoryDefinitionManager repositoryDefinitionManager, TaskConfigurationService taskConfigurationService, NotificationManager notificationManager, BranchCommitInformationManager branchCommitInformationManager, VcsBranchManager vcsBranchManager, TriggerConfigurationService triggerConfigurationService, BuildNumberGeneratorService buildNumberGeneratorService, TransactionAndHibernateTemplate hibernateTemplate)
-
-
Method Details
-
performCloneIfRequired
protected abstract boolean performCloneIfRequired(@NotNull @NotNull BuildConfiguration buildConfiguration, @NotNull @NotNull PlanCreationBean planCreationBean, @NotNull @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:
buildConfiguration
- for any extra configuration to override when cloningplanCreationBean
- 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 @Nullable org.acegisecurity.acls.MutableAcl getDefaultPermissionsForPlan(boolean accessForAllUsers) Generate the permissions to be stored against the plan on creation.- Parameters:
accessForAllUsers
- anyone that can access Bamboo instance (logged-in users and depending on configuration anonymous) will be able to view this plan.- Returns:
- the permissions to be stored against the plan on creation
-
prepareBuildConfiguration
protected abstract void prepareBuildConfiguration(@NotNull @NotNull BuildConfiguration buildConfiguration, @NotNull @NotNull Plan plan, @NotNull @NotNull PlanCreationBean planCreationBean) 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 @NotNull BuildConfiguration buildConfiguration, @NotNull @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
Deprecated.since 6.9. UsesaveAndUpdateParents(PlanCreationBean)
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
-
saveAndUpdateParents
Perform any necessary database operations required before saving the plan. E.g. creation of new projects.- Parameters:
planCreationBean
- plan creation bean
-
postCreationSynchronisation
protected abstract void postCreationSynchronisation(@NotNull @NotNull PlanCreationBean planCreationBean) Perform any state synchronisation required after creating plan. E.g. updating collections.- Parameters:
planCreationBean
-
-
setFullPlanKey
Set the full key for this plan- Parameters:
plan
- - complete plan to be saved
-
performPostCreateAction
Perform plan specific actions that need to be run immediately after plan creation.- Parameters:
plan
- created plan
-
triggerCreationCompleteEvents
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 interfacePlanCreationService
-
createPlan
protected String createPlan(@NotNull @NotNull BuildConfiguration buildConfiguration, @NotNull @NotNull ActionParametersMap actionParametersMap, @NotNull @NotNull PlanCreationService.EnablePlan enabled, @NotNull @NotNull BiConsumer<Plan, ActionParametersMap> preparePlanDetails) throws PlanCreationDeniedException, PlanCreationExceptionCreates and saves a plan- Parameters:
buildConfiguration
- configuration of the planactionParametersMap
- any other params that are not in thebuildConfiguration
enabled
- whether the plan should start enabled or disabledpreparePlanDetails
- prepares the plan object for saving.- Returns:
- the full key of the created plan
- Throws:
PlanCreationDeniedException
PlanCreationException
-
savePlan
public String savePlan(@NotNull @NotNull PlanCreationBean planCreationBean) throws PlanCreationDeniedException, PlanCreationException Description copied from interface:PlanCreationService
Saves a already created plan to the database- Specified by:
savePlan
in interfacePlanCreationService
- 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
Performs general cleanup of the buildConfiguration, 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, String planOwner) -
logBuildConfiguration
-
validateThrowingPlanCreationException
@Contract("false,_ -> fail") protected void validateThrowingPlanCreationException(boolean condition, String message)
-