Class PlanCreationTemplate
- java.lang.Object
-
- com.atlassian.bamboo.build.creation.PlanCreationTemplate
-
- All Implemented Interfaces:
PlanCreationService
- Direct Known Subclasses:
ChainBranchCreationServiceImpl
,ChainCreationServiceImpl
,JobCreationServiceImpl
public abstract class PlanCreationTemplate extends Object implements PlanCreationService
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.atlassian.bamboo.build.creation.PlanCreationService
PlanCreationService.EnablePlan
-
-
Field Summary
Fields Modifier and Type Field Description protected BambooAclUpdateHelper
aclUpdateHelper
protected ArtifactDefinitionManager
artifactDefinitionManager
protected ArtifactSubscriptionManager
artifactSubscriptionManager
protected AuditLogService
auditLogService
protected BambooAuthenticationContext
authenticationContext
protected BambooLicenseManager
bambooLicenseManager
protected BranchCommitInformationManager
branchCommitInformationManager
protected BuildDefinitionConverter
buildDefinitionConverter
protected com.atlassian.event.api.EventPublisher
eventPublisher
protected NotificationManager
notificationManager
protected PlanManager
planManager
protected PlanValidationService
planValidationService
protected ProjectManager
projectManager
protected RepositoryDefinitionManager
repositoryDefinitionManager
protected TriggerConfigurationService
triggerConfigurationService
protected VariableDefinitionManager
variableDefinitionManager
protected VcsBranchManager
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
Constructors Modifier Constructor Description 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 Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected 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
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.String
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 Detail
-
planManager
protected final PlanManager planManager
-
authenticationContext
protected final BambooAuthenticationContext authenticationContext
-
projectManager
protected final ProjectManager projectManager
-
eventPublisher
protected final com.atlassian.event.api.EventPublisher eventPublisher
-
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
-
variableDefinitionManager
protected final VariableDefinitionManager variableDefinitionManager
-
repositoryDefinitionManager
protected final RepositoryDefinitionManager repositoryDefinitionManager
-
notificationManager
protected final NotificationManager notificationManager
-
branchCommitInformationManager
protected final BranchCommitInformationManager branchCommitInformationManager
-
vcsBranchManager
protected final VcsBranchManager vcsBranchManager
-
triggerConfigurationService
protected final TriggerConfigurationService triggerConfigurationService
-
-
Constructor Detail
-
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 Detail
-
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 protected void saveAndUpdateParents(@NotNull @NotNull Plan plan)
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
protected abstract void saveAndUpdateParents(@NotNull @NotNull PlanCreationBean planCreationBean)
Perform any necessary database operations required before saving the plan. E.g. creation of new projects.- Parameters:
planCreationBean
- plan creation bean
-
setFullPlanKey
protected abstract void setFullPlanKey(@NotNull @NotNull Plan plan)
Set the full key for this plan- Parameters:
plan
- - complete plan to be saved
-
performPostCreateAction
protected abstract void performPostCreateAction(@NotNull @NotNull Plan plan)
Perform plan specific actions that need to be run immediately after plan creation.- Parameters:
plan
- created plan
-
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 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, PlanCreationException
Creates 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
public 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.- Parameters:
buildConfiguration
- to clean
-
clonePlanPermissionsToSession
protected void clonePlanPermissionsToSession(Plan buildToClone, PlanCreationBean planCreationBean, String planOwner)
-
logBuildConfiguration
protected void logBuildConfiguration(BuildConfiguration buildConfiguration)
-
validateThrowingPlanCreationException
@Contract("false,_ -> fail") protected void validateThrowingPlanCreationException(boolean condition, String message)
-
-