Package com.atlassian.bamboo.build
Class PlanBranchPullRequestServiceImpl
- java.lang.Object
-
- com.atlassian.bamboo.build.PlanBranchPullRequestServiceImpl
-
- All Implemented Interfaces:
PlanBranchPullRequestService
public class PlanBranchPullRequestServiceImpl extends Object implements PlanBranchPullRequestService
-
-
Constructor Summary
Constructors Constructor Description PlanBranchPullRequestServiceImpl(CachedPlanManager cachedPlanManager, com.atlassian.event.api.EventPublisher eventPublisher, PlanBranchPullRequestDao planBranchPullRequestDao, PlanManager planManager, VcsPullRequestDao vcsPullRequestDao)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull PlanBranchPullRequest
create(@NotNull ChainBranch chainBranch, @NotNull MutableVcsPullRequest vcsPullRequest)
Creates a new link between chain branch and pull request.@NotNull PlanBranchPullRequest
create(@NotNull PlanKey branchKey, long pullRequestId)
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.
-
-
-
Constructor Detail
-
PlanBranchPullRequestServiceImpl
@Inject public PlanBranchPullRequestServiceImpl(CachedPlanManager cachedPlanManager, com.atlassian.event.api.EventPublisher eventPublisher, PlanBranchPullRequestDao planBranchPullRequestDao, PlanManager planManager, VcsPullRequestDao vcsPullRequestDao)
-
-
Method Detail
-
findForChainBranch
@NotNull public @NotNull Optional<PlanBranchPullRequest> findForChainBranch(long branchId)
Description copied from interface:PlanBranchPullRequestService
Retrieves aPlanBranchPullRequest
connection for the givenplan branch
by branch id. Only one VCS pull request may be associated with a plan branch.- Specified by:
findForChainBranch
in interfacePlanBranchPullRequestService
- Parameters:
branchId
- id of the plan branch- Returns:
PlanBranchPullRequest
if found
-
findForChainBranch
@NotNull public @NotNull Optional<PlanBranchPullRequest> findForChainBranch(@NotNull @NotNull PlanKey branchKey)
Description copied from interface:PlanBranchPullRequestService
Retrieves aPlanBranchPullRequest
connection for the givenplan branch
by branch key. Only one VCS pull request may be associated with a plan branch.- Specified by:
findForChainBranch
in interfacePlanBranchPullRequestService
- Parameters:
branchKey
- key of the plan branch- Returns:
PlanBranchPullRequest
if found
-
findForChainAndPullRequest
@NotNull public @NotNull Optional<PlanBranchPullRequest> findForChainAndPullRequest(long chainId, long pullRequestId)
Description copied from interface:PlanBranchPullRequestService
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.- Specified by:
findForChainAndPullRequest
in interfacePlanBranchPullRequestService
- Parameters:
chainId
- id of the top level planpullRequestId
- id of the VCS pull request- Returns:
PlanBranchPullRequest
if found
-
findForChainAndPullRequestWithConsistencyGuarantee
@NotNull public @NotNull Optional<PlanBranchPullRequest> findForChainAndPullRequestWithConsistencyGuarantee(long chainId, long pullRequestId)
Description copied from interface:PlanBranchPullRequestService
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.- Specified by:
findForChainAndPullRequestWithConsistencyGuarantee
in interfacePlanBranchPullRequestService
- Parameters:
chainId
- id of the top level planpullRequestId
- id of the VCS pull request- Returns:
PlanBranchPullRequest
if found
-
findForChain
@NotNull public @NotNull List<PlanBranchPullRequest> findForChain(long chainId)
Description copied from interface:PlanBranchPullRequestService
Retrieves aPlanBranchPullRequest
connections for the givenchain
.- Specified by:
findForChain
in interfacePlanBranchPullRequestService
- Parameters:
chainId
- id of the top level plan- Returns:
- a list of
PlanBranchPullRequest
-
findForChainAndPullRequest
@NotNull public @NotNull Optional<PlanBranchPullRequest> findForChainAndPullRequest(@NotNull @NotNull PlanKey chainKey, long pullRequestId)
Description copied from interface:PlanBranchPullRequestService
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.- Specified by:
findForChainAndPullRequest
in interfacePlanBranchPullRequestService
- Parameters:
chainKey
- key of the top level planpullRequestId
- id of the VCS pull request- Returns:
PlanBranchPullRequest
if found
-
findForPullRequest
@NotNull public @NotNull List<PlanBranchPullRequest> findForPullRequest(long pullRequestId)
Description copied from interface:PlanBranchPullRequestService
Retrieves allPlanBranchPullRequest
connections for the givenpull request
by pull request database id. Multiple plan branches may be associated with a single pull request.- Specified by:
findForPullRequest
in interfacePlanBranchPullRequestService
- Parameters:
pullRequestId
- id of the pull request- Returns:
- a list of
PlanBranchPullRequest
s
-
create
@NotNull public @NotNull PlanBranchPullRequest create(@NotNull @NotNull PlanKey branchKey, long pullRequestId)
Description copied from interface:PlanBranchPullRequestService
Creates a new link between chain branch and pull request.- Specified by:
create
in interfacePlanBranchPullRequestService
- 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
-
create
@NotNull public @NotNull PlanBranchPullRequest create(@NotNull @NotNull ChainBranch chainBranch, @NotNull @NotNull MutableVcsPullRequest vcsPullRequest)
Description copied from interface:PlanBranchPullRequestService
Creates a new link between chain branch and pull request.- Specified by:
create
in interfacePlanBranchPullRequestService
- Parameters:
chainBranch
- chain branch to linkvcsPullRequest
- pull request to link- Returns:
- newly created link between chain branch and pull request
-
deleteForChainBranch
public boolean deleteForChainBranch(long branchId)
Description copied from interface:PlanBranchPullRequestService
Deletes a link for the given plan branch.- Specified by:
deleteForChainBranch
in interfacePlanBranchPullRequestService
- Parameters:
branchId
- id of the plan branch- Returns:
- true if a link was found and deleted, false otherwise
-
deleteForChainBranch
public boolean deleteForChainBranch(@NotNull @NotNull PlanKey branchKey)
Description copied from interface:PlanBranchPullRequestService
Deletes a link for the given plan branch.- Specified by:
deleteForChainBranch
in interfacePlanBranchPullRequestService
- Parameters:
branchKey
- key of the plan branch- Returns:
- true if a link was found and deleted, false otherwise
-
deleteForVcsPullRequest
public int deleteForVcsPullRequest(long pullRequestId)
Description copied from interface:PlanBranchPullRequestService
Deletes all links for the given pull request.- Specified by:
deleteForVcsPullRequest
in interfacePlanBranchPullRequestService
- Parameters:
pullRequestId
- id of the vcs pull request- Returns:
- number of deleted links, 0 if none were found
-
-