Class AbstractPullRequestFilter<T>
- java.lang.Object
-
- jenkins.scm.api.trait.SCMHeadFilter
-
- org.jenkinsci.plugins.bitbucket.pullrequests.filter.filters.AbstractPullRequestFilter<T>
-
- Type Parameters:
T
- data type to validation
- Direct Known Subclasses:
PullRequestSourceBranchMatchesFilter
,PullRequestTargetBranchMatchesFilter
,PullRequestTitlePhraseExistsFilter
public abstract class AbstractPullRequestFilter<T> extends jenkins.scm.api.trait.SCMHeadFilter
ASCMHead
filter to exclusion the pull requests due to not match by user filter.- Since:
- 0.1.0
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPullRequestFilter(TypeFilter<T> filter)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract T
getData(com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketPullRequest pullRequest)
Extracts data from pull requests to validate.protected TypeFilter<T>
getFilter()
Return instance of a filter to validate the data.protected abstract String
getMessage(com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketPullRequest pullRequest)
Prepare a message for user to logs.protected boolean
isAccepted(com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketPullRequest pullRequest)
Validates the pull requests is accepted by the filter.boolean
isExcluded(jenkins.scm.api.trait.SCMSourceRequest request, jenkins.scm.api.SCMHead head)
-
-
-
Constructor Detail
-
AbstractPullRequestFilter
protected AbstractPullRequestFilter(TypeFilter<T> filter)
Constructor.- Parameters:
filter
-TypeFilter
to validate the data
-
-
Method Detail
-
isExcluded
public boolean isExcluded(@Nonnull jenkins.scm.api.trait.SCMSourceRequest request, @Nonnull jenkins.scm.api.SCMHead head) throws IOException, InterruptedException
- Specified by:
isExcluded
in classjenkins.scm.api.trait.SCMHeadFilter
- Throws:
IOException
InterruptedException
-
isAccepted
protected boolean isAccepted(com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketPullRequest pullRequest)
Validates the pull requests is accepted by the filter.- Parameters:
pullRequest
- theBitbucketPullRequest
- Returns:
true
if and only if the pull requests was verified positive by the filter
-
getFilter
protected TypeFilter<T> getFilter()
Return instance of a filter to validate the data.- Returns:
TypeFilter
to validate the data
-
getData
protected abstract T getData(com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketPullRequest pullRequest)
Extracts data from pull requests to validate.- Parameters:
pullRequest
- theBitbucketPullRequest
- Returns:
- extracted data to validation
-
getMessage
protected abstract String getMessage(com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketPullRequest pullRequest)
Prepare a message for user to logs.- Parameters:
pullRequest
- theBitbucketPullRequest
- Returns:
- a message for user
-
-