Class BitbucketServerPullRequestDetector
- java.lang.Object
-
- com.atlassian.bamboo.plugins.stash.v2.AbstractBitbucketServerExecutor
-
- com.atlassian.bamboo.plugins.stash.BitbucketServerPullRequestDetector
-
- All Implemented Interfaces:
IdentifyingExecutor<VcsPullRequestDetector>
,VcsPullRequestDetector
public class BitbucketServerPullRequestDetector extends AbstractBitbucketServerExecutor implements VcsPullRequestDetector
-
-
Field Summary
Fields Modifier and Type Field Description static SystemProperty.BooleanSystemProperty
ENFORCE_PULLREQUEST_POLLING_ONLY
-
Fields inherited from class com.atlassian.bamboo.plugins.stash.v2.AbstractBitbucketServerExecutor
vcsRepositoryManager
-
-
Constructor Summary
Constructors Constructor Description BitbucketServerPullRequestDetector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull List<VcsPullRequest>
getOpenPullRequests(@NotNull VcsRepositoryData repositoryData)
List
of open pull requests that are discovered in the repository.protected com.atlassian.stash.rest.client.api.entity.Page<com.atlassian.stash.rest.client.api.entity.PullRequestStatus>
getPullRequestsByRepository(com.atlassian.applinks.api.ApplicationLink applicationLink, String project, String repoSlug, Integer startIndex, long limit, long repositoryId)
@Nullable ContextualVcsId<VcsPullRequestDetector>
getVcsIdForExecutor(@NotNull VcsRepositoryData vcsRepositoryData)
Returned id has to fulfill the following: Given two VcsRepositoryData objects A and B, and executor e returning equal ContextualVcsId (in terms of equals()), for any operation foo() provided by the executor, the calls e::foo(A) and e::foo(B) should be equivalent.boolean
supportsForkedPullRequests()
Whether pull requests from forked repositories are handled.boolean
usePollingForPullRequestDetection(@NotNull VcsRepositoryData repositoryData)
Check if Bamboo needs to actively poll in order to detect new/deleted pull requests for specific repository configuration.-
Methods inherited from class com.atlassian.bamboo.plugins.stash.v2.AbstractBitbucketServerExecutor
bitbucketServerToGitData, executeOnMirrorWithPrimaryFallback, executeOnMirrorWithPrimaryFallback, getGitModuleDescriptor, shouldFallbackToPolling
-
-
-
-
Field Detail
-
ENFORCE_PULLREQUEST_POLLING_ONLY
public static final SystemProperty.BooleanSystemProperty ENFORCE_PULLREQUEST_POLLING_ONLY
-
-
Method Detail
-
getVcsIdForExecutor
@Nullable public @Nullable ContextualVcsId<VcsPullRequestDetector> getVcsIdForExecutor(@NotNull @NotNull VcsRepositoryData vcsRepositoryData)
Description copied from interface:IdentifyingExecutor
Returned id has to fulfill the following: Given two VcsRepositoryData objects A and B, and executor e returning equal ContextualVcsId (in terms of equals()), for any operation foo() provided by the executor, the calls e::foo(A) and e::foo(B) should be equivalent. To be more precise: given any time point t and any variable context v, calling a::foo(A) should yield the same results as calling e::foo(B). Given the above it follows that - calculation of the id should take into account global and plan variables. This means, that calling this method on the same object in different variable context can (possibly must) yield different results. - equal ids need not (and should not) guarantee equal call results over indefinite time. In particular, result of e:foo(A).equals(e::foo(A)) is allowed to be false, since 2 calls to e::foo(A) do not happen at the same time. Example: 2 git repositories with the same url and credentials are considered equal in context ofVcsBranchDetector
. If they also point to the same branch, they are considered equal in context ofVcsChangeDetector
- Specified by:
getVcsIdForExecutor
in interfaceIdentifyingExecutor<VcsPullRequestDetector>
- Returns:
- the id of repository, can be null if no feasible identification algorithm exists
-
getOpenPullRequests
@NotNull public @NotNull List<VcsPullRequest> getOpenPullRequests(@NotNull @NotNull VcsRepositoryData repositoryData) throws RepositoryException
Description copied from interface:VcsPullRequestDetector
List
of open pull requests that are discovered in the repository. Used for monitoring repositories for new PRs.- Specified by:
getOpenPullRequests
in interfaceVcsPullRequestDetector
- Parameters:
repositoryData
- repository- Returns:
List
of open pull requests. May be empty.- Throws:
RepositoryException
-
getPullRequestsByRepository
protected com.atlassian.stash.rest.client.api.entity.Page<com.atlassian.stash.rest.client.api.entity.PullRequestStatus> getPullRequestsByRepository(com.atlassian.applinks.api.ApplicationLink applicationLink, String project, String repoSlug, Integer startIndex, long limit, long repositoryId) throws RepositoryException
- Throws:
RepositoryException
-
usePollingForPullRequestDetection
public boolean usePollingForPullRequestDetection(@NotNull @NotNull VcsRepositoryData repositoryData)
Description copied from interface:VcsPullRequestDetector
Check if Bamboo needs to actively poll in order to detect new/deleted pull requests for specific repository configuration.- Specified by:
usePollingForPullRequestDetection
in interfaceVcsPullRequestDetector
- Parameters:
repositoryData
- repository- Returns:
- - true if Bamboo need periodically contact the remote repository in order to update list of known pull requests. - false if repository is capable of detecting pull requests using one of available "push" method, e.g. REST resource, remote event.
-
supportsForkedPullRequests
public boolean supportsForkedPullRequests()
Description copied from interface:VcsPullRequestDetector
Whether pull requests from forked repositories are handled.- Specified by:
supportsForkedPullRequests
in interfaceVcsPullRequestDetector
- Returns:
- - true if detector supports pull requests from forked repositories - false if it does not
-
-