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 PlanBranchPullRequestcreate(@NotNull ChainBranch chainBranch, @NotNull MutableVcsPullRequest vcsPullRequest)Creates a new link between chain branch and pull request.@NotNull PlanBranchPullRequestcreate(@NotNull PlanKey branchKey, long pullRequestId)Creates 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.
-
-
-
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:PlanBranchPullRequestServiceRetrieves aPlanBranchPullRequestconnection for the givenplan branchby branch id. Only one VCS pull request may be associated with a plan branch.- Specified by:
findForChainBranchin interfacePlanBranchPullRequestService- Parameters:
branchId- id of the plan branch- Returns:
PlanBranchPullRequestif found
-
findForChainBranch
@NotNull public @NotNull Optional<PlanBranchPullRequest> findForChainBranch(@NotNull @NotNull PlanKey branchKey)
Description copied from interface:PlanBranchPullRequestServiceRetrieves aPlanBranchPullRequestconnection for the givenplan branchby branch key. Only one VCS pull request may be associated with a plan branch.- Specified by:
findForChainBranchin interfacePlanBranchPullRequestService- Parameters:
branchKey- key of the plan branch- Returns:
PlanBranchPullRequestif found
-
findForChainAndPullRequest
@NotNull public @NotNull Optional<PlanBranchPullRequest> findForChainAndPullRequest(long chainId, long pullRequestId)
Description copied from interface:PlanBranchPullRequestServiceRetrieves 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.- Specified by:
findForChainAndPullRequestin interfacePlanBranchPullRequestService- Parameters:
chainId- id of the top level planpullRequestId- id of the VCS pull request- Returns:
PlanBranchPullRequestif found
-
findForChainAndPullRequestWithConsistencyGuarantee
@NotNull public @NotNull Optional<PlanBranchPullRequest> findForChainAndPullRequestWithConsistencyGuarantee(long chainId, long pullRequestId)
Description copied from interface:PlanBranchPullRequestServiceRetrieves 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.- Specified by:
findForChainAndPullRequestWithConsistencyGuaranteein interfacePlanBranchPullRequestService- Parameters:
chainId- id of the top level planpullRequestId- id of the VCS pull request- Returns:
PlanBranchPullRequestif found
-
findForChain
@NotNull public @NotNull List<PlanBranchPullRequest> findForChain(long chainId)
Description copied from interface:PlanBranchPullRequestServiceRetrieves aPlanBranchPullRequestconnections for the givenchain.- Specified by:
findForChainin 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:PlanBranchPullRequestServiceRetrieves aPlanBranchPullRequestconnection for the givenchainandpull request. Should yield only one result, since a single pull requests should only create a singleplan branchper plan.- Specified by:
findForChainAndPullRequestin interfacePlanBranchPullRequestService- Parameters:
chainKey- key of the top level planpullRequestId- id of the VCS pull request- Returns:
PlanBranchPullRequestif found
-
findForPullRequest
@NotNull public @NotNull List<PlanBranchPullRequest> findForPullRequest(long pullRequestId)
Description copied from interface:PlanBranchPullRequestServiceRetrieves allPlanBranchPullRequestconnections for the givenpull requestby pull request database id. Multiple plan branches may be associated with a single pull request.- Specified by:
findForPullRequestin interfacePlanBranchPullRequestService- Parameters:
pullRequestId- id of the pull request- Returns:
- a list of
PlanBranchPullRequests
-
create
@NotNull public @NotNull PlanBranchPullRequest create(@NotNull @NotNull PlanKey branchKey, long pullRequestId)
Description copied from interface:PlanBranchPullRequestServiceCreates a new link between chain branch and pull request.- Specified by:
createin 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:PlanBranchPullRequestServiceCreates a new link between chain branch and pull request.- Specified by:
createin 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:PlanBranchPullRequestServiceDeletes a link for the given plan branch.- Specified by:
deleteForChainBranchin 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:PlanBranchPullRequestServiceDeletes a link for the given plan branch.- Specified by:
deleteForChainBranchin 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:PlanBranchPullRequestServiceDeletes all links for the given pull request.- Specified by:
deleteForVcsPullRequestin interfacePlanBranchPullRequestService- Parameters:
pullRequestId- id of the vcs pull request- Returns:
- number of deleted links, 0 if none were found
-
-