Package com.atlassian.bamboo.build
Interface PlanBranchPullRequestService
- All Known Implementing Classes:
PlanBranchPullRequestServiceImpl
@ExperimentalApi
public interface PlanBranchPullRequestService
Service for managing relations between
plan branches and pull requests.- Since:
- 6.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescription@NotNull PlanBranchPullRequestcreate(@NotNull ChainBranch chainBranch, @NotNull MutableVcsPullRequest vcsPullRequest) Creates a new link between chain branch and pull request.@NotNull PlanBranchPullRequestCreates a new link between chain branch and pull request.booleandeleteForChainBranch(long branchId) Deletes a link for the given plan branch.booleandeleteForChainBranch(@NotNull PlanKey branchKey) Deletes a link for the given plan branch.intdeleteForVcsPullRequest(long pullRequestId) Deletes all links for the given pull request.@NotNull List<PlanBranchPullRequest>findForChain(long chainId) Retrieves aPlanBranchPullRequestconnections for the givenchain.@NotNull Optional<PlanBranchPullRequest>findForChainAndPullRequest(long chainId, long pullRequestId) @NotNull Optional<PlanBranchPullRequest>findForChainAndPullRequest(@NotNull PlanKey chainKey, long pullRequestId) @NotNull Optional<PlanBranchPullRequest>findForChainAndPullRequestWithConsistencyGuarantee(long chainId, long pullRequestId) @NotNull Optional<PlanBranchPullRequest>findForChainBranch(long branchId) Retrieves aPlanBranchPullRequestconnection for the givenplan branchby branch id.@NotNull Optional<PlanBranchPullRequest>findForChainBranch(@NotNull PlanKey branchKey) Retrieves aPlanBranchPullRequestconnection for the givenplan branchby branch key.@NotNull List<PlanBranchPullRequest>findForPullRequest(long pullRequestId) Retrieves allPlanBranchPullRequestconnections for the givenpull requestby pull request database id.
-
Method Details
-
findForChainBranch
Retrieves aPlanBranchPullRequestconnection for the givenplan branchby branch id. Only one VCS pull request may be associated with a plan branch.- Parameters:
branchId- id of the plan branch- Returns:
PlanBranchPullRequestif found
-
findForChainBranch
@NotNull @NotNull Optional<PlanBranchPullRequest> findForChainBranch(@NotNull @NotNull PlanKey branchKey) Retrieves aPlanBranchPullRequestconnection for the givenplan branchby branch key. Only one VCS pull request may be associated with a plan branch.- Parameters:
branchKey- key of the plan branch- Returns:
PlanBranchPullRequestif found
-
findForChainAndPullRequest
@NotNull @NotNull Optional<PlanBranchPullRequest> findForChainAndPullRequest(long chainId, long pullRequestId) Retrieves aPlanBranchPullRequestconnection for the givenchainandpull request. Should yield only one result, since a single pull requests should only create a singleplan branchper plan. In clustered mode, there is NO consistency guarantee.- Parameters:
chainId- id of the top level planpullRequestId- id of the VCS pull request- Returns:
PlanBranchPullRequestif found
-
findForChainAndPullRequestWithConsistencyGuarantee
@NotNull @NotNull Optional<PlanBranchPullRequest> findForChainAndPullRequestWithConsistencyGuarantee(long chainId, long pullRequestId) Retrieves aPlanBranchPullRequestconnection for the givenchainandpull request. Should yield only one result, since a single pull requests should only create a singleplan branchper plan. There is a guarantee that the data will be up-to-date.- Parameters:
chainId- id of the top level planpullRequestId- id of the VCS pull request- Returns:
PlanBranchPullRequestif found- Since:
- 9.4
-
findForChain
Retrieves aPlanBranchPullRequestconnections for the givenchain.- Parameters:
chainId- id of the top level plan- Returns:
- a list of
PlanBranchPullRequest - Since:
- 8.2.7
-
findForChainAndPullRequest
@NotNull @NotNull Optional<PlanBranchPullRequest> findForChainAndPullRequest(@NotNull @NotNull PlanKey chainKey, long pullRequestId) Retrieves aPlanBranchPullRequestconnection for the givenchainandpull request. Should yield only one result, since a single pull requests should only create a singleplan branchper plan.- Parameters:
chainKey- key of the top level planpullRequestId- id of the VCS pull request- Returns:
PlanBranchPullRequestif found
-
findForPullRequest
Retrieves allPlanBranchPullRequestconnections for the givenpull requestby pull request database id. Multiple plan branches may be associated with a single pull request.- Parameters:
pullRequestId- id of the pull request- Returns:
- a list of
PlanBranchPullRequests
-
create
@NotNull @NotNull PlanBranchPullRequest create(@NotNull @NotNull PlanKey branchKey, long pullRequestId) Creates a new link between chain branch and pull request.- Parameters:
branchKey- key of the chain branch to linkpullRequestId- id of the pull request to link- Returns:
- newly created link between chain branch and pull request
- Throws:
IllegalStateException- if any pull request is already linked to the given plan branch
-
create
@NotNull @NotNull PlanBranchPullRequest create(@NotNull @NotNull ChainBranch chainBranch, @NotNull @NotNull MutableVcsPullRequest vcsPullRequest) Creates a new link between chain branch and pull request.- Parameters:
chainBranch- chain branch to linkvcsPullRequest- pull request to link- Returns:
- newly created link between chain branch and pull request
- Throws:
IllegalStateException- if any pull request is already linked to the given plan branch
-
deleteForChainBranch
boolean deleteForChainBranch(long branchId) Deletes a link for the given plan branch.- Parameters:
branchId- id of the plan branch- Returns:
- true if a link was found and deleted, false otherwise
-
deleteForChainBranch
Deletes a link for the given plan branch.- Parameters:
branchKey- key of the plan branch- Returns:
- true if a link was found and deleted, false otherwise
-
deleteForVcsPullRequest
int deleteForVcsPullRequest(long pullRequestId) Deletes all links for the given pull request.- Parameters:
pullRequestId- id of the vcs pull request- Returns:
- number of deleted links, 0 if none were found
-