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 PlanBranchPullRequest
create
(@NotNull ChainBranch chainBranch, @NotNull MutableVcsPullRequest vcsPullRequest) Creates a new link between chain branch and pull request.@NotNull PlanBranchPullRequest
Creates a new link between chain branch and pull request.boolean
deleteForChainBranch
(long branchId) Deletes a link for the given plan branch.boolean
deleteForChainBranch
(@NotNull PlanKey branchKey) Deletes a link for the given plan branch.int
deleteForVcsPullRequest
(long pullRequestId) Deletes all links for the given pull request.@NotNull List<PlanBranchPullRequest>
findForChain
(long chainId) Retrieves aPlanBranchPullRequest
connections 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 aPlanBranchPullRequest
connection for the givenplan branch
by branch id.@NotNull Optional<PlanBranchPullRequest>
findForChainBranch
(@NotNull PlanKey branchKey) Retrieves aPlanBranchPullRequest
connection for the givenplan branch
by branch key.@NotNull List<PlanBranchPullRequest>
findForPullRequest
(long pullRequestId) Retrieves allPlanBranchPullRequest
connections for the givenpull request
by pull request database id.
-
Method Details
-
findForChainBranch
Retrieves aPlanBranchPullRequest
connection for the givenplan branch
by branch id. Only one VCS pull request may be associated with a plan branch.- Parameters:
branchId
- id of the plan branch- Returns:
PlanBranchPullRequest
if found
-
findForChainBranch
@NotNull @NotNull Optional<PlanBranchPullRequest> findForChainBranch(@NotNull @NotNull PlanKey branchKey) Retrieves aPlanBranchPullRequest
connection for the givenplan branch
by branch key. Only one VCS pull request may be associated with a plan branch.- Parameters:
branchKey
- key of the plan branch- Returns:
PlanBranchPullRequest
if found
-
findForChainAndPullRequest
@NotNull @NotNull Optional<PlanBranchPullRequest> findForChainAndPullRequest(long chainId, long pullRequestId) Retrieves aPlanBranchPullRequest
connection for the givenchain
andpull request
. Should yield only one result, since a single pull requests should only create a singleplan branch
per plan. In clustered mode, there is NO consistency guarantee.- Parameters:
chainId
- id of the top level planpullRequestId
- id of the VCS pull request- Returns:
PlanBranchPullRequest
if found
-
findForChainAndPullRequestWithConsistencyGuarantee
@NotNull @NotNull Optional<PlanBranchPullRequest> findForChainAndPullRequestWithConsistencyGuarantee(long chainId, long pullRequestId) Retrieves aPlanBranchPullRequest
connection for the givenchain
andpull request
. Should yield only one result, since a single pull requests should only create a singleplan branch
per 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:
PlanBranchPullRequest
if found- Since:
- 9.4
-
findForChain
Retrieves aPlanBranchPullRequest
connections 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 aPlanBranchPullRequest
connection for the givenchain
andpull request
. Should yield only one result, since a single pull requests should only create a singleplan branch
per plan.- Parameters:
chainKey
- key of the top level planpullRequestId
- id of the VCS pull request- Returns:
PlanBranchPullRequest
if found
-
findForPullRequest
Retrieves allPlanBranchPullRequest
connections for the givenpull request
by 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
PlanBranchPullRequest
s
-
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
-