Class BitbucketSCMSourceRequest
java.lang.Object
jenkins.scm.api.trait.SCMSourceRequest
com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSourceRequest
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class BitbucketSCMSourceRequest
extends jenkins.scm.api.trait.SCMSourceRequest
The
SCMSourceRequest
for bitbucket.- Since:
- 2.2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Nested classes/interfaces inherited from class jenkins.scm.api.trait.SCMSourceRequest
jenkins.scm.api.trait.SCMSourceRequest.IntermediateLambda<I extends Object>, jenkins.scm.api.trait.SCMSourceRequest.LazyRevisionLambda<H extends jenkins.scm.api.SCMHead,
R extends jenkins.scm.api.SCMRevision, I extends Object>, jenkins.scm.api.trait.SCMSourceRequest.ProbeLambda<H extends jenkins.scm.api.SCMHead, I extends Object>, jenkins.scm.api.trait.SCMSourceRequest.RevisionLambda<H extends jenkins.scm.api.SCMHead, R extends jenkins.scm.api.SCMRevision>, jenkins.scm.api.trait.SCMSourceRequest.Witness<H extends jenkins.scm.api.SCMHead, R extends jenkins.scm.api.SCMRevision> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BitbucketSCMSourceRequest
(BitbucketSCMSource source, BitbucketSCMSourceContext context, TaskListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
final Iterable<BitbucketBranch>
Returns the branch details or an empty list if either the request did not specify toisFetchBranches()
or if the branch details have not been provided bysetBranches(Iterable)
yet.final Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy>
Returns theChangeRequestCheckoutStrategy
to create for each fork pull request.final Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy>
Returns theChangeRequestCheckoutStrategy
to create for each origin pull request.Returns theChangeRequestCheckoutStrategy
to create for each pull request.final Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy>
getPRStrategies
(boolean fork) Returns theChangeRequestCheckoutStrategy
to create for pull requests of the specified type.final BitbucketPullRequest
Retrieves the full details of a pull request.final Iterable<BitbucketPullRequest>
Returns the pull request details or an empty list if either the request did not specify toisFetchPRs()
or if the pull request details have not been provided bysetPullRequests(Iterable)
yet.final String
Returns theBitbucketSCMSource.getRepoOwner()
final String
Returns theBitbucketSCMSource.getRepository()
.Gets requested origin branch names.Returns requested pull request numbers.Gets requested tag names.final Iterable<BitbucketBranch>
getTags()
Returns the branch details or an empty list if either the request did not specify toisFetchTags()
or if the tag details have not been provided bysetTags(Iterable)
yet.final boolean
Returnstrue
if branch details need to be fetched.final boolean
Returnstrue
if fork pull request details need to be fetched.final boolean
Returnstrue
if origin pull request details need to be fetched.final boolean
Returnstrue
if pull request details need to be fetched.final boolean
Returnstrue
if tag details need to be fetched.final boolean
Returnstrue
if pull requests from public repositories should be skipped.final <H extends jenkins.scm.api.SCMHead,
I, R extends jenkins.scm.api.SCMRevision>
booleanprocess
(H head, jenkins.scm.api.trait.SCMSourceRequest.IntermediateLambda<I> intermediateFactory) Processes a head in the context of the current request where an intermediary operation is required before theSCMRevision
can be instantiated.final void
setBranches
(Iterable<BitbucketBranch> branches) Provides the requests with the branch details.final void
setPullRequests
(Iterable<BitbucketPullRequest> pullRequests) Provides the requests with the pull request details.final void
setTags
(Iterable<BitbucketBranch> tags) Provides the requests with the tag details.Methods inherited from class jenkins.scm.api.trait.SCMSourceRequest
getCriteria, isComplete, isExcluded, isTrusted, listener, manage, process, process, process
-
Constructor Details
-
BitbucketSCMSourceRequest
protected BitbucketSCMSourceRequest(@NonNull BitbucketSCMSource source, @NonNull BitbucketSCMSourceContext context, @CheckForNull TaskListener listener) Constructor.- Parameters:
source
- the source.context
- the context.listener
- the listener.
-
-
Method Details
-
isFetchBranches
public final boolean isFetchBranches()Returnstrue
if branch details need to be fetched.- Returns:
true
if branch details need to be fetched.
-
isFetchTags
public final boolean isFetchTags()Returnstrue
if tag details need to be fetched.- Returns:
true
if tag details need to be fetched.
-
isFetchPRs
public final boolean isFetchPRs()Returnstrue
if pull request details need to be fetched.- Returns:
true
if pull request details need to be fetched.
-
isFetchOriginPRs
public final boolean isFetchOriginPRs()Returnstrue
if origin pull request details need to be fetched.- Returns:
true
if origin pull request details need to be fetched.
-
isFetchForkPRs
public final boolean isFetchForkPRs()Returnstrue
if fork pull request details need to be fetched.- Returns:
true
if fork pull request details need to be fetched.
-
isSkipPublicPRs
public final boolean isSkipPublicPRs()Returnstrue
if pull requests from public repositories should be skipped.- Returns:
true
if pull requests from public repositories should be skipped.
-
getOriginPRStrategies
@NonNull public final Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy> getOriginPRStrategies()Returns theChangeRequestCheckoutStrategy
to create for each origin pull request.- Returns:
- the
ChangeRequestCheckoutStrategy
to create for each origin pull request.
-
getForkPRStrategies
@NonNull public final Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy> getForkPRStrategies()Returns theChangeRequestCheckoutStrategy
to create for each fork pull request.- Returns:
- the
ChangeRequestCheckoutStrategy
to create for each fork pull request.
-
getPRStrategies
@NonNull public final Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy> getPRStrategies(boolean fork) Returns theChangeRequestCheckoutStrategy
to create for pull requests of the specified type.- Parameters:
fork
-true
to return strategies for the fork pull requests,false
for origin pull requests.- Returns:
- the
ChangeRequestCheckoutStrategy
to create for each pull request.
-
getPRStrategies
public final Map<Boolean,Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy>> getPRStrategies()Returns theChangeRequestCheckoutStrategy
to create for each pull request.- Returns:
- a map of the
ChangeRequestCheckoutStrategy
to create for each pull request keyed by whether the strategy applies to forks or not (Boolean.FALSE
is the key for origin pull requests)
-
getRequestedPullRequestNumbers
Returns requested pull request numbers.- Returns:
- the requested pull request numbers or
null
if the request was not scoped to a subset of pull requests.
-
getRequestedOriginBranchNames
Gets requested origin branch names.- Returns:
- the requested origin branch names or
null
if the request was not scoped to a subset of branches.
-
getRequestedTagNames
Gets requested tag names.- Returns:
- the requested tag names or
null
if the request was not scoped to a subset of tags.
-
getRepoOwner
Returns theBitbucketSCMSource.getRepoOwner()
- Returns:
- the
BitbucketSCMSource.getRepoOwner()
-
getRepository
Returns theBitbucketSCMSource.getRepository()
.- Returns:
- the
BitbucketSCMSource.getRepository()
.
-
setPullRequests
Provides the requests with the pull request details.- Parameters:
pullRequests
- the pull request details.
-
getPullRequests
@NonNull public final Iterable<BitbucketPullRequest> getPullRequests() throws IOException, InterruptedExceptionReturns the pull request details or an empty list if either the request did not specify toisFetchPRs()
or if the pull request details have not been provided bysetPullRequests(Iterable)
yet.- Returns:
- the pull request details (may be empty)
- Throws:
IOException
- If the request to retrieve the full details encounters an issue.InterruptedException
- If the request to retrieve the full details is interrupted.
-
getPullRequestById
public final BitbucketPullRequest getPullRequestById(Integer id) throws IOException, InterruptedException Retrieves the full details of a pull request.- Parameters:
id
- The id of the pull request to retrieve the details about.- Returns:
- The
BitbucketPullRequest
object. - Throws:
IOException
- If the request to retrieve the full details encounters an issue.InterruptedException
- If the request to retrieve the full details is interrupted.
-
setBranches
Provides the requests with the branch details.- Parameters:
branches
- the branch details.
-
getBranches
@NonNull public final Iterable<BitbucketBranch> getBranches() throws IOException, InterruptedExceptionReturns the branch details or an empty list if either the request did not specify toisFetchBranches()
or if the branch details have not been provided bysetBranches(Iterable)
yet.- Returns:
- the branch details (may be empty)
- Throws:
IOException
- if there was a network communications error.InterruptedException
- if interrupted while waiting on remote communications.
-
setTags
Provides the requests with the tag details.- Parameters:
tags
- the tag details.
-
getTags
Returns the branch details or an empty list if either the request did not specify toisFetchTags()
or if the tag details have not been provided bysetTags(Iterable)
yet.- Returns:
- the tag details (may be empty)
- Throws:
IOException
- if there was a network communications error.InterruptedException
- if interrupted while waiting on remote communications.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classjenkins.scm.api.trait.SCMSourceRequest
- Throws:
IOException
-
process
public final <H extends jenkins.scm.api.SCMHead,I, boolean processR extends jenkins.scm.api.SCMRevision> (@NonNull H head, @CheckForNull jenkins.scm.api.trait.SCMSourceRequest.IntermediateLambda<I> intermediateFactory) throws IOException, InterruptedException Processes a head in the context of the current request where an intermediary operation is required before theSCMRevision
can be instantiated.- Type Parameters:
H
- the type ofSCMHead
.I
- the type of the intermediary operation result.R
- the type ofSCMRevision
.- Parameters:
head
- theSCMHead
to process.intermediateFactory
- factory method that provides the seed information for both theSCMSourceRequest.ProbeLambda
and theSCMSourceRequest.LazyRevisionLambda
.- Returns:
true
if theSCMHeadObserver
for this request has completed observing,false
to continue processing.- Throws:
IOException
- if there was an I/O error.InterruptedException
- if the processing was interrupted.
-