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
TheSCMSourceRequest
for bitbucket.- Since:
- 2.2.0
-
-
Nested Class Summary
-
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
Constructors Modifier Constructor Description protected
BitbucketSCMSourceRequest(BitbucketSCMSource source, BitbucketSCMSourceContext context, TaskListener listener)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Iterable<BitbucketBranch>
getBranches()
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.Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy>
getForkPRStrategies()
Returns theChangeRequestCheckoutStrategy
to create for each fork pull request.Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy>
getOriginPRStrategies()
Returns theChangeRequestCheckoutStrategy
to create for each origin pull request.Map<Boolean,Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy>>
getPRStrategies()
Returns theChangeRequestCheckoutStrategy
to create for each pull request.Set<jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy>
getPRStrategies(boolean fork)
Returns theChangeRequestCheckoutStrategy
to create for pull requests of the specified type.BitbucketPullRequest
getPullRequestById(Integer id)
Retrieves the full details of a pull request.Iterable<BitbucketPullRequest>
getPullRequests()
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.String
getRepoOwner()
Returns theBitbucketSCMSource.getRepoOwner()
String
getRepository()
Returns theBitbucketSCMSource.getRepository()
.Set<String>
getRequestedOriginBranchNames()
Gets requested origin branch names.Set<String>
getRequestedPullRequestNumbers()
Returns requested pull request numbers.Set<String>
getRequestedTagNames()
Gets requested tag names.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.boolean
isFetchBranches()
Returnstrue
if branch details need to be fetched.boolean
isFetchForkPRs()
Returnstrue
if fork pull request details need to be fetched.boolean
isFetchOriginPRs()
Returnstrue
if origin pull request details need to be fetched.boolean
isFetchPRs()
Returnstrue
if pull request details need to be fetched.boolean
isFetchTags()
Returnstrue
if tag details need to be fetched.boolean
isSkipPublicPRs()
Returnstrue
if pull requests from public repositories should be skipped.void
setBranches(Iterable<BitbucketBranch> branches)
Provides the requests with the branch details.void
setPullRequests(Iterable<BitbucketPullRequest> pullRequests)
Provides the requests with the pull request details.void
setTags(Iterable<BitbucketBranch> tags)
Provides the requests with the tag details.
-
-
-
Constructor Detail
-
BitbucketSCMSourceRequest
protected BitbucketSCMSourceRequest(@NonNull BitbucketSCMSource source, @NonNull BitbucketSCMSourceContext context, @CheckForNull TaskListener listener)
Constructor.- Parameters:
source
- the source.context
- the context.listener
- the listener.
-
-
Method Detail
-
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
@CheckForNull public final Set<String> 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
@CheckForNull public final Set<String> 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
@CheckForNull public final Set<String> getRequestedTagNames()
Gets requested tag names.- Returns:
- the requested tag names or
null
if the request was not scoped to a subset of tags.
-
getRepoOwner
@NonNull public final String getRepoOwner()
Returns theBitbucketSCMSource.getRepoOwner()
- Returns:
- the
BitbucketSCMSource.getRepoOwner()
-
getRepository
@NonNull public final String getRepository()
Returns theBitbucketSCMSource.getRepository()
.- Returns:
- the
BitbucketSCMSource.getRepository()
.
-
setPullRequests
public final void setPullRequests(@CheckForNull Iterable<BitbucketPullRequest> pullRequests)
Provides the requests with the pull request details.- Parameters:
pullRequests
- the pull request details.
-
getPullRequests
@NonNull public final Iterable<BitbucketPullRequest> getPullRequests()
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.- Returns:
- the pull request details (may be empty)
-
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
public final void setBranches(@CheckForNull Iterable<BitbucketBranch> branches)
Provides the requests with the branch details.- Parameters:
branches
- the branch details.
-
getBranches
@NonNull public final Iterable<BitbucketBranch> getBranches()
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.- Returns:
- the branch details (may be empty)
-
setTags
public final void setTags(@CheckForNull Iterable<BitbucketBranch> tags)
Provides the requests with the tag details.- Parameters:
tags
- the tag details.
-
getTags
@NonNull public 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.- Returns:
- the tag details (may be empty)
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classjenkins.scm.api.trait.SCMSourceRequest
- Throws:
IOException
-
-