Class JobCreationServiceImpl
- java.lang.Object
-
- com.atlassian.bamboo.build.creation.PlanCreationTemplate
-
- com.atlassian.bamboo.build.creation.JobCreationServiceImpl
-
- All Implemented Interfaces:
JobCreationService
,PlanCreationService
public class JobCreationServiceImpl extends PlanCreationTemplate implements JobCreationService
-
-
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, eventPublisher, notificationManager, planManager, planValidationService, projectManager, repositoryDefinitionManager, triggerConfigurationService, variableDefinitionManager, 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 Constructor Description JobCreationServiceImpl(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, ChainBranchManager chainBranchManager, BuildNumberGeneratorService buildNumberGeneratorService, VcsRepositoryManager vcsRepositoryManager, DockerPipelineValidationService dockerPipelineValidationService, TaskManager taskManager, TransactionAndHibernateTemplate hibernateTemplate)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
cleanBuildConfiguration(@NotNull BuildConfiguration buildConfiguration, @NotNull Plan plan)
Clean build configuration for saving.boolean
cloneBuildable(@NotNull PlanCreationBean planCreationBean, @NotNull ActionParametersMap params, Job jobToClone, Job job)
List<PlanKey>
createJobAndBranches(@NotNull BuildConfiguration buildConfiguration, @NotNull ActionParametersMap actionParametersMap, @NotNull PlanCreationService.EnablePlan enabled)
String
createPlan(@NotNull BuildConfiguration buildConfiguration, @NotNull ActionParametersMap actionParametersMap, @NotNull PlanCreationService.EnablePlan enabled)
Deprecated.since 4.0 use @{link #createJobAndBranches}String
createSingleJob(@NotNull BuildConfiguration buildConfiguration, @NotNull ActionParametersMap actionParametersMap, @NotNull PlanCreationService.EnablePlan enabled)
BuildConfiguration
getBuildConfigurationWithDefaults()
List<PlanConfigHelper>
getComponentsOnPage()
protected org.acegisecurity.acls.MutableAcl
getDefaultPermissionsForPlan(boolean accessForAllUsers)
Generate the permissions to be stored against the plan on creation.Job
getNewInstance()
protected 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 void
performPostCreateAction(@NotNull Plan plan)
Perform plan specific actions that need to be run immediately after plan creation.protected void
prepareBuildConfiguration(@NotNull BuildConfiguration buildConfiguration, @NotNull Plan plan, @NotNull PlanCreationBean planCreationBean)
Prepare build configuration for saving.void
saveAndUpdateParents(@NotNull PlanCreationBean planCreationBean)
Perform any necessary database operations required before saving the plan.void
setFullPlanKey(@NotNull Plan plan)
Set the full key for this planvoid
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
validatePlan(com.atlassian.struts.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, createPlan, logBuildConfiguration, saveAndUpdateParents, savePlan, validateThrowingPlanCreationException
-
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
-
JobCreationServiceImpl
public JobCreationServiceImpl(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, ChainBranchManager chainBranchManager, BuildNumberGeneratorService buildNumberGeneratorService, VcsRepositoryManager vcsRepositoryManager, DockerPipelineValidationService dockerPipelineValidationService, TaskManager taskManager, TransactionAndHibernateTemplate hibernateTemplate)
-
-
Method Detail
-
validatePlan
public void validatePlan(com.atlassian.struts.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 interfacePlanCreationService
- Parameters:
validationAware
- - object to add errors to (usually an action class)buildConfiguration
- - build configuration to validateparams
- - parameter map containing any plan details not in the build configuration.
-
getNewInstance
public Job getNewInstance()
- Specified by:
getNewInstance
in interfaceJobCreationService
- Specified by:
getNewInstance
in interfacePlanCreationService
- Returns:
- A new plan instance, concrete type determined by implementation classes
-
getDefaultPermissionsForPlan
protected org.acegisecurity.acls.MutableAcl getDefaultPermissionsForPlan(boolean accessForAllUsers)
Description copied from class:PlanCreationTemplate
Generate the permissions to be stored against the plan on creation.- Specified by:
getDefaultPermissionsForPlan
in classPlanCreationTemplate
- 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
-
getBuildConfigurationWithDefaults
public BuildConfiguration getBuildConfigurationWithDefaults()
- Specified by:
getBuildConfigurationWithDefaults
in interfacePlanCreationService
- Returns:
- A buildConfiguration instance with the required defaults populated
-
performCloneIfRequired
protected boolean performCloneIfRequired(@NotNull @NotNull BuildConfiguration buildConfiguration, @NotNull @NotNull PlanCreationBean planCreationBean, @NotNull @NotNull ActionParametersMap params)
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 classPlanCreationTemplate
- 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
-
cloneBuildable
public boolean cloneBuildable(@NotNull @NotNull PlanCreationBean planCreationBean, @NotNull @NotNull ActionParametersMap params, Job jobToClone, Job job)
-
prepareBuildConfiguration
protected void prepareBuildConfiguration(@NotNull @NotNull BuildConfiguration buildConfiguration, @NotNull @NotNull Plan plan, @NotNull @NotNull PlanCreationBean planCreationBean)
Description copied from class:PlanCreationTemplate
Prepare build configuration for saving. Only occurs if cloning did NOT occur.- Specified by:
prepareBuildConfiguration
in classPlanCreationTemplate
- Parameters:
buildConfiguration
- the current build configuration.plan
- the current plan (will already have details populated)
-
cleanBuildConfiguration
public void cleanBuildConfiguration(@NotNull @NotNull BuildConfiguration buildConfiguration, @NotNull @NotNull Plan plan)
Description copied from class:PlanCreationTemplate
Clean build configuration for saving. Build Config may have been cloned.- Specified by:
cleanBuildConfiguration
in classPlanCreationTemplate
- Parameters:
buildConfiguration
- the current build configuration.plan
- the current plan (will already have details populated)
-
setFullPlanKey
public void setFullPlanKey(@NotNull @NotNull Plan plan)
Description copied from class:PlanCreationTemplate
Set the full key for this plan- Specified by:
setFullPlanKey
in classPlanCreationTemplate
- Parameters:
plan
- - complete plan to be saved
-
saveAndUpdateParents
public void saveAndUpdateParents(@NotNull @NotNull PlanCreationBean planCreationBean)
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 classPlanCreationTemplate
- Parameters:
planCreationBean
- plan creation bean
-
performPostCreateAction
protected void performPostCreateAction(@NotNull @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 classPlanCreationTemplate
- 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 interfacePlanCreationService
- Specified by:
triggerCreationCompleteEvents
in classPlanCreationTemplate
-
getComponentsOnPage
public List<PlanConfigHelper> getComponentsOnPage()
-
createSingleJob
public String createSingleJob(@NotNull @NotNull BuildConfiguration buildConfiguration, @NotNull @NotNull ActionParametersMap actionParametersMap, @NotNull @NotNull PlanCreationService.EnablePlan enabled) throws PlanCreationDeniedException, PlanCreationException
- Specified by:
createSingleJob
in interfaceJobCreationService
- Throws:
PlanCreationDeniedException
PlanCreationException
-
createPlan
@Deprecated public String createPlan(@NotNull @NotNull BuildConfiguration buildConfiguration, @NotNull @NotNull ActionParametersMap actionParametersMap, @NotNull @NotNull PlanCreationService.EnablePlan enabled) throws PlanCreationDeniedException, PlanCreationException
Deprecated.since 4.0 use @{link #createJobAndBranches}This method will also create the job branches- Specified by:
createPlan
in interfaceJobCreationService
- Specified by:
createPlan
in interfacePlanCreationService
- Parameters:
buildConfiguration
- of the plan to createactionParametersMap
- containing any other required params NOT in the buildConfigurationenabled
- 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
-
createJobAndBranches
public List<PlanKey> createJobAndBranches(@NotNull @NotNull BuildConfiguration buildConfiguration, @NotNull @NotNull ActionParametersMap actionParametersMap, @NotNull @NotNull PlanCreationService.EnablePlan enabled) throws PlanCreationDeniedException, PlanCreationException
- Specified by:
createJobAndBranches
in interfaceJobCreationService
- Throws:
PlanCreationDeniedException
PlanCreationException
-
-