Class LightweightBranchCreationServiceImpl

    • 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: LightweightBranchCreationService
        Creates a new lightweight plan branch or enables existing one for each vcs branch in given collection under given chain.
        Specified by:
        createChainBranches in interface LightweightBranchCreationService
        Parameters:
        chain - to create branches under
        planBranchWorkflow - which workflow led to creation of these branches
        branches - collection ov vcs branches for which plan branches should be created
        defaultRepositoryDefinition - default repository of the given chain
        errorCollection - to add errors to, if you don't supply an error collection, they will just get logged
        enablePlan - defines whether newly created branches should be enabled or disabled after creation
        enableExpiry - defines whether created branch can be removed due to branch expiration detection
        consumer - code should be executed before triggering events that new plan created
        expectingDivergentBranch - 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: LightweightBranchCreationService
        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.
        Specified by:
        createOrEnableChainBranch in interface LightweightBranchCreationService
        Parameters:
        chain - to create branch under
        planBranchWorkflow - which workflow led to creation of branch
        branchName - optional name for the plan branch. If null name of vcs branch will be used
        vcsBranchProvider - provides VcsBranch to use when overriding repository definition
        buildConfiguration - optional default fragment of configuration to create the chain branch with
        enablePlan - defines whether newly created branches should be enabled or disabled after creation
        enableExpiry - defines whether created branch can be removed due to branch expiration detection
        branchPlanKeyConsumer - code should be executed before triggering events that new plan created
        expectingDivergentBranch - RSS will attempt updating this branch; post creation events should be deferred
        pullRequest - 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: LightweightBranchCreationService
        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.
        Specified by:
        createOrEnableChainBranch in interface LightweightBranchCreationService
        Parameters:
        chain - to create branch under
        planBranchWorkflow - which workflow led to creation of branch
        branchName - optional name for the plan branch. If null name of vcs branch will be used
        vcsBranchProvider - provides VcsBranch to use when overriding repository definition
        buildConfiguration - optional default fragment of configuration to create the chain branch with
        enablePlan - defines whether newly created branches should be enabled or disabled after creation
        enableExpiry - defines whether created branch can be removed due to branch expiration detection
        branchPlanKeyConsumer - code should be executed before triggering events that new plan created
        expectingDivergentBranch - RSS will attempt updating this branch; post creation events should be deferred
        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,
                                                                    Optional<VcsPullRequest> pullRequest)
                                                             throws PlanCreationDeniedException
        Description copied from interface: LightweightBranchCreationService
        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.
        Specified by:
        createChainBranch in interface LightweightBranchCreationService
        Parameters:
        chain - to create branches under
        planBranchWorkflow - which workflow led to creation of branch
        branchName - optional plan branch name
        branchDescription - optional plan branch description
        defaultRepositoryDefinition - optional default repository of the given chain
        moduleDescriptor - module descriptor of the given defaultRepositoryDefinition
        newBranch - VCS branch to use
        buildConfiguration - optional default fragment of configuration to create the chain branch with
        enablePlan - defines whether newly created branches should be enabled or disabled after creation
        enableExpiry - defines whether created branch can be removed due to branch expiration detection
        branchPlanKeyConsumer - code should be executed before triggering events that new plan created
        expectingDivergentBranch - RSS will attempt updating this branch; post creation events should be deferred
        pullRequest - 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: LightweightBranchCreationService
        Creates a new lightweight plan branch for give chain. Does not check if plan branch for given VCS branch already exists.
        Specified by:
        createChainBranch in interface LightweightBranchCreationService
        Parameters:
        chain - to create branches under
        planBranchWorkflow - which workflow led to creation of branch
        branchName - optional plan branch name
        branchDescription - optional plan branch description
        defaultRepositoryDefinition - optional default repository of the given chain
        moduleDescriptor - module descriptor of the given defaultRepositoryDefinition
        newBranch - VCS branch to use
        buildConfiguration - optional default fragment of configuration to create the chain branch with
        enablePlan - defines whether newly created branches should be enabled or disabled after creation
        enableExpiry - defines whether created branch can be removed due to branch expiration detection
        branchPlanKeyConsumer - code should be executed before triggering events that new plan created
        expectingDivergentBranch - 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: LightweightBranchCreationService
        Validates configuration for creating chain branch
        Specified by:
        validateCreateChainBranch in interface LightweightBranchCreationService
        Parameters:
        chain - to create branches under
        planBranchWorkflow - which workflow led to creation of branch
        branchName - optional plan branch name
        branchDescription - optional plan branch description
        defaultRepositoryDefinition - optional default repository of the given chain
        moduleDescriptor - module descriptor of the given defaultRepositoryDefinition
        newBranch - VCS branch to use
        enableExpiry - defines whether created branch can be removed due to branch expiration * detection
        validationAware - to add errors to