Package com.atlassian.bamboo.plan.branch
Interface LightweightBranchCreationService
-
- All Known Implementing Classes:
LightweightBranchCreationServiceImpl
@Internal public interface LightweightBranchCreationService
Service for creating lightweight branches. You probably want to useBranchCreationFacade
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull ChainBranchCreationResult
createChainBranch(@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 ChainBranchCreationResult
createChainBranch(@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> branchPlanKeyConsumer, boolean expectingDivergentBranch)
Creates a new lightweight plan branch or enables existing one for each vcs branch in given collection under given chain.@NotNull ChainBranchCreationResult
createOrEnableChainBranch(@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 ChainBranchCreationResult
createOrEnableChainBranch(@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 ChainBranchCreationResult
enableExistingChainBranch(@NotNull ImmutableChain chain, @NotNull ImmutableChainBranch existingChainBranch, @NotNull VcsBranch vcsBranch, PlanCreationService.EnablePlan enablePlan, boolean expectingDivergentBranch)
Enables existing chain branch.void
validateCreateChainBranch(@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
-
-
-
Method Detail
-
createOrEnableChainBranch
@NotNull @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
Given 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.- 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
-
createOrEnableChainBranch
@NotNull @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
Given 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.- 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
-
enableExistingChainBranch
@NotNull @NotNull ChainBranchCreationResult enableExistingChainBranch(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull ImmutableChainBranch existingChainBranch, @NotNull @NotNull VcsBranch vcsBranch, @NotNull PlanCreationService.EnablePlan enablePlan, boolean expectingDivergentBranch)
Enables existing chain branch.
-
createChainBranches
@NotNull @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> branchPlanKeyConsumer, boolean expectingDivergentBranch)
Creates a new lightweight plan branch or enables existing one for each vcs branch in given collection under given chain.- 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 givenchain
errorCollection
- 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 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:
- keys of created plan branches
-
createChainBranch
@NotNull @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
Creates a new lightweight plan branch for give chain. Does not check if plan branch for given VCS branch already exists.- 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 givenchain
moduleDescriptor
- module descriptor of the givendefaultRepositoryDefinition
newBranch
- 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
-
createChainBranch
@NotNull @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
Creates 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.- 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 givenchain
moduleDescriptor
- module descriptor of the givendefaultRepositoryDefinition
newBranch
- 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
-
validateCreateChainBranch
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)
Validates configuration for creating chain branch- 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 givenchain
moduleDescriptor
- module descriptor of the givendefaultRepositoryDefinition
newBranch
- VCS branch to useenableExpiry
- defines whether created branch can be removed due to branch expiration * detectionvalidationAware
- to add errors to
-
-