Package com.atlassian.bamboo.plan.branch
Class LightweightBranchCreationServiceImpl
- java.lang.Object
-
- com.atlassian.bamboo.plan.branch.LightweightBranchCreationServiceImpl
-
- All Implemented Interfaces:
LightweightBranchCreationService
public class LightweightBranchCreationServiceImpl extends Object implements LightweightBranchCreationService
-
-
Constructor Summary
Constructors Constructor Description LightweightBranchCreationServiceImpl(CachedPlanManager cachedPlanManager, ChainBranchCreationService chainBranchCreationService, CustomVariableContext customVariableContext, ErrorHandler errorHandler, JiraBranchLinkingService jiraBranchLinkingService, PlanManager planManager, RawRepositoryConfigurationXmlConverter rawRepositoryConfigurationXmlConverter, RepositoryDefinitionManager repositoryDefinitionManager, VcsBranchManager vcsBranchManager, VcsRepositoryManager vcsRepositoryManager, TriggerTypeManager triggerTypeManager, com.atlassian.event.api.EventPublisher eventPublisher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull ChainBranchCreationResultcreateChainBranch(@NotNull ImmutableChain chain, @NotNull PlanBranchWorkflow planBranchWorkflow, @NotNull String branchName, @Nullable String branchDescription, @Nullable PlanRepositoryDefinition defaultRepositoryDefinition, @Nullable VcsRepositoryModuleDescriptor moduleDescriptor, @Nullable VcsBranch newBranch, @NotNull BuildConfiguration buildConfiguration, PlanCreationService.EnablePlan enablePlan, boolean enableExpiry, @NotNull Consumer<PlanKey> branchPlanKeyConsumer, boolean expectingDivergentBranch)Creates a new lightweight plan branch for give chain.@NotNull ChainBranchCreationResultcreateChainBranch(@NotNull ImmutableChain chain, @NotNull PlanBranchWorkflow planBranchWorkflow, @NotNull String branchName, @Nullable String branchDescription, @Nullable PlanRepositoryDefinition defaultRepositoryDefinition, @Nullable VcsRepositoryModuleDescriptor moduleDescriptor, @Nullable VcsBranch newBranch, @NotNull BuildConfiguration buildConfiguration, PlanCreationService.EnablePlan enablePlan, boolean enableExpiry, @NotNull Consumer<PlanKey> branchPlanKeyConsumer, boolean expectingDivergentBranch, Optional<VcsPullRequest> pullRequest)Creates a new lightweight plan branch for give chain.@NotNull Collection<ChainBranchCreationResult>createChainBranches(@NotNull ImmutableChain chain, @NotNull PlanBranchWorkflow planBranchWorkflow, @NotNull Collection<VcsBranch> branches, @NotNull PlanRepositoryDefinition defaultRepositoryDefinition, @Nullable ErrorCollection errorCollection, PlanCreationService.EnablePlan enablePlan, boolean enableExpiry, @NotNull Consumer<PlanKey> consumer, boolean expectingDivergentBranch)Creates a new lightweight plan branch or enables existing one for each vcs branch in given collection under given chain.@NotNull ChainBranchCreationResultcreateOrEnableChainBranch(@NotNull ImmutableChain chain, @NotNull PlanBranchWorkflow planBranchWorkflow, @Nullable String branchName, @NotNull Function<VcsBranchConfigurator,VcsBranch> vcsBranchProvider, @Nullable BuildConfiguration buildConfiguration, PlanCreationService.EnablePlan enablePlan, boolean enableExpiry, @NotNull Consumer<PlanKey> branchPlanKeyConsumer, boolean expectingDivergentBranch)Given a branch name and (optionally) vcs branch name, check if branch already exists.@NotNull ChainBranchCreationResultcreateOrEnableChainBranch(@NotNull ImmutableChain chain, @NotNull PlanBranchWorkflow planBranchWorkflow, @Nullable String branchName, @NotNull Function<VcsBranchConfigurator,VcsBranch> vcsBranchProvider, @Nullable BuildConfiguration buildConfiguration, PlanCreationService.EnablePlan enablePlan, boolean enableExpiry, @NotNull Consumer<PlanKey> branchPlanKeyConsumer, boolean expectingDivergentBranch, Optional<VcsPullRequest> pullRequest)Given a branch name and (optionally) vcs branch name, check if branch already exists.@NotNull ChainBranchCreationResultenableExistingChainBranch(@NotNull ImmutableChain chain, @NotNull ImmutableChainBranch existingChainBranch, @NotNull VcsBranch vcsBranch, PlanCreationService.EnablePlan enablePlan, boolean expectingDivergentBranch)Enables existing chain branch.voidvalidateCreateChainBranch(@NotNull ImmutableChain chain, @NotNull PlanBranchWorkflow planBranchWorkflow, @NotNull String branchName, @Nullable String branchDescription, @Nullable PlanRepositoryDefinition defaultRepositoryDefinition, @Nullable VcsRepositoryModuleDescriptor moduleDescriptor, @Nullable VcsBranch newBranch, boolean enableExpiry, @NotNull com.atlassian.struts.ValidationAware validationAware)Validates configuration for creating chain branch
-
-
-
Constructor Detail
-
LightweightBranchCreationServiceImpl
public LightweightBranchCreationServiceImpl(CachedPlanManager cachedPlanManager, ChainBranchCreationService chainBranchCreationService, CustomVariableContext customVariableContext, ErrorHandler errorHandler, JiraBranchLinkingService jiraBranchLinkingService, PlanManager planManager, RawRepositoryConfigurationXmlConverter rawRepositoryConfigurationXmlConverter, RepositoryDefinitionManager repositoryDefinitionManager, VcsBranchManager vcsBranchManager, VcsRepositoryManager vcsRepositoryManager, TriggerTypeManager triggerTypeManager, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Detail
-
createChainBranches
@NotNull public @NotNull Collection<ChainBranchCreationResult> createChainBranches(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull PlanBranchWorkflow planBranchWorkflow, @NotNull @NotNull Collection<VcsBranch> branches, @NotNull @NotNull PlanRepositoryDefinition defaultRepositoryDefinition, @Nullable @Nullable ErrorCollection errorCollection, @NotNull PlanCreationService.EnablePlan enablePlan, boolean enableExpiry, @NotNull @NotNull Consumer<PlanKey> consumer, boolean expectingDivergentBranch)
Description copied from interface:LightweightBranchCreationServiceCreates a new lightweight plan branch or enables existing one for each vcs branch in given collection under given chain.- Specified by:
createChainBranchesin interfaceLightweightBranchCreationService- Parameters:
chain- to create branches underplanBranchWorkflow- which workflow led to creation of these branchesbranches- collection ov vcs branches for which plan branches should be createddefaultRepositoryDefinition- default repository of the givenchainerrorCollection- to add errors to, if you don't supply an error collection, they will just get loggedenablePlan- defines whether newly created branches should be enabled or disabled after creationenableExpiry- defines whether created branch can be removed due to branch expiration detectionconsumer- code should be executed before triggering events that new plan createdexpectingDivergentBranch- RSS will attempt updating this branch; post creation events should be deferred- Returns:
- keys of created plan branches
-
createOrEnableChainBranch
@NotNull public @NotNull ChainBranchCreationResult createOrEnableChainBranch(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull PlanBranchWorkflow planBranchWorkflow, @Nullable @Nullable String branchName, @NotNull @NotNull Function<VcsBranchConfigurator,VcsBranch> vcsBranchProvider, @Nullable @Nullable BuildConfiguration buildConfiguration, @NotNull PlanCreationService.EnablePlan enablePlan, boolean enableExpiry, @NotNull @NotNull Consumer<PlanKey> branchPlanKeyConsumer, boolean expectingDivergentBranch, Optional<VcsPullRequest> pullRequest) throws PlanCreationDeniedException
Description copied from interface:LightweightBranchCreationServiceGiven a branch name and (optionally) vcs branch name, check if branch already exists. If it does, enable it if it's disabled. Otherwise create a new lightweight plan branch. The overloaded method is aimed to deal with pull requests.- Specified by:
createOrEnableChainBranchin interfaceLightweightBranchCreationService- Parameters:
chain- to create branch underplanBranchWorkflow- which workflow led to creation of branchbranchName- optional name for the plan branch. If null name of vcs branch will be usedvcsBranchProvider- provides VcsBranch to use when overriding repository definitionbuildConfiguration- optional default fragment of configuration to create the chain branch withenablePlan- defines whether newly created branches should be enabled or disabled after creationenableExpiry- defines whether created branch can be removed due to branch expiration detectionbranchPlanKeyConsumer- code should be executed before triggering events that new plan createdexpectingDivergentBranch- RSS will attempt updating this branch; post creation events should be deferredpullRequest- optional pull requests object which contains potential source repository information- Returns:
- key of the created plan branch
- Throws:
PlanCreationDeniedException
-
createOrEnableChainBranch
@NotNull public @NotNull ChainBranchCreationResult createOrEnableChainBranch(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull PlanBranchWorkflow planBranchWorkflow, @Nullable @Nullable String branchName, @NotNull @NotNull Function<VcsBranchConfigurator,VcsBranch> vcsBranchProvider, @Nullable @Nullable BuildConfiguration buildConfiguration, @NotNull PlanCreationService.EnablePlan enablePlan, boolean enableExpiry, @NotNull @NotNull Consumer<PlanKey> branchPlanKeyConsumer, boolean expectingDivergentBranch) throws PlanCreationDeniedException
Description copied from interface:LightweightBranchCreationServiceGiven a branch name and (optionally) vcs branch name, check if branch already exists. If it does, enable it if it's disabled. Otherwise create a new lightweight plan branch.- Specified by:
createOrEnableChainBranchin interfaceLightweightBranchCreationService- Parameters:
chain- to create branch underplanBranchWorkflow- which workflow led to creation of branchbranchName- optional name for the plan branch. If null name of vcs branch will be usedvcsBranchProvider- provides VcsBranch to use when overriding repository definitionbuildConfiguration- optional default fragment of configuration to create the chain branch withenablePlan- defines whether newly created branches should be enabled or disabled after creationenableExpiry- defines whether created branch can be removed due to branch expiration detectionbranchPlanKeyConsumer- code should be executed before triggering events that new plan createdexpectingDivergentBranch- RSS will attempt updating this branch; post creation events should be deferred- Returns:
- key of the created plan branch
- Throws:
PlanCreationDeniedException
-
enableExistingChainBranch
@NotNull public @NotNull ChainBranchCreationResult enableExistingChainBranch(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull ImmutableChainBranch existingChainBranch, @NotNull @NotNull VcsBranch vcsBranch, @NotNull PlanCreationService.EnablePlan enablePlan, boolean expectingDivergentBranch)
Description copied from interface:LightweightBranchCreationServiceEnables existing chain branch.- Specified by:
enableExistingChainBranchin interfaceLightweightBranchCreationService
-
createChainBranch
@NotNull public @NotNull ChainBranchCreationResult createChainBranch(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull PlanBranchWorkflow planBranchWorkflow, @NotNull @NotNull String branchName, @Nullable @Nullable String branchDescription, @Nullable @Nullable PlanRepositoryDefinition defaultRepositoryDefinition, @Nullable @Nullable VcsRepositoryModuleDescriptor moduleDescriptor, @Nullable @Nullable VcsBranch newBranch, @NotNull @NotNull BuildConfiguration buildConfiguration, PlanCreationService.EnablePlan enablePlan, boolean enableExpiry, @NotNull @NotNull Consumer<PlanKey> branchPlanKeyConsumer, boolean expectingDivergentBranch, Optional<VcsPullRequest> pullRequest) throws PlanCreationDeniedException
Description copied from interface:LightweightBranchCreationServiceCreates a new lightweight plan branch for give chain. Does not check if plan branch for given VCS branch already exists. The overloaded method is aimed to deal with pull requests.- Specified by:
createChainBranchin interfaceLightweightBranchCreationService- Parameters:
chain- to create branches underplanBranchWorkflow- which workflow led to creation of branchbranchName- optional plan branch namebranchDescription- optional plan branch descriptiondefaultRepositoryDefinition- optional default repository of the givenchainmoduleDescriptor- module descriptor of the givendefaultRepositoryDefinitionnewBranch- VCS branch to usebuildConfiguration- optional default fragment of configuration to create the chain branch withenablePlan- defines whether newly created branches should be enabled or disabled after creationenableExpiry- defines whether created branch can be removed due to branch expiration detectionbranchPlanKeyConsumer- code should be executed before triggering events that new plan createdexpectingDivergentBranch- RSS will attempt updating this branch; post creation events should be deferredpullRequest- optional pull requests object which contains potential source repository information- Returns:
- key of the created plan branch
- Throws:
PlanCreationDeniedException
-
createChainBranch
@NotNull public @NotNull ChainBranchCreationResult createChainBranch(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull PlanBranchWorkflow planBranchWorkflow, @NotNull @NotNull String branchName, @Nullable @Nullable String branchDescription, @Nullable @Nullable PlanRepositoryDefinition defaultRepositoryDefinition, @Nullable @Nullable VcsRepositoryModuleDescriptor moduleDescriptor, @Nullable @Nullable VcsBranch newBranch, @NotNull @NotNull BuildConfiguration buildConfiguration, PlanCreationService.EnablePlan enablePlan, boolean enableExpiry, @NotNull @NotNull Consumer<PlanKey> branchPlanKeyConsumer, boolean expectingDivergentBranch) throws PlanCreationDeniedException
Description copied from interface:LightweightBranchCreationServiceCreates a new lightweight plan branch for give chain. Does not check if plan branch for given VCS branch already exists.- Specified by:
createChainBranchin interfaceLightweightBranchCreationService- Parameters:
chain- to create branches underplanBranchWorkflow- which workflow led to creation of branchbranchName- optional plan branch namebranchDescription- optional plan branch descriptiondefaultRepositoryDefinition- optional default repository of the givenchainmoduleDescriptor- module descriptor of the givendefaultRepositoryDefinitionnewBranch- VCS branch to usebuildConfiguration- optional default fragment of configuration to create the chain branch withenablePlan- defines whether newly created branches should be enabled or disabled after creationenableExpiry- defines whether created branch can be removed due to branch expiration detectionbranchPlanKeyConsumer- code should be executed before triggering events that new plan createdexpectingDivergentBranch- RSS will attempt updating this branch; post creation events should be deferred- Returns:
- key of the created plan branch
- Throws:
PlanCreationDeniedException
-
validateCreateChainBranch
public void validateCreateChainBranch(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull PlanBranchWorkflow planBranchWorkflow, @NotNull @NotNull String branchName, @Nullable @Nullable String branchDescription, @Nullable @Nullable PlanRepositoryDefinition defaultRepositoryDefinition, @Nullable @Nullable VcsRepositoryModuleDescriptor moduleDescriptor, @Nullable @Nullable VcsBranch newBranch, boolean enableExpiry, @NotNull @NotNull com.atlassian.struts.ValidationAware validationAware)Description copied from interface:LightweightBranchCreationServiceValidates configuration for creating chain branch- Specified by:
validateCreateChainBranchin interfaceLightweightBranchCreationService- Parameters:
chain- to create branches underplanBranchWorkflow- which workflow led to creation of branchbranchName- optional plan branch namebranchDescription- optional plan branch descriptiondefaultRepositoryDefinition- optional default repository of the givenchainmoduleDescriptor- module descriptor of the givendefaultRepositoryDefinitionnewBranch- VCS branch to useenableExpiry- defines whether created branch can be removed due to branch expiration * detectionvalidationAware- to add errors to
-
-