Interface PullRequest
-
- All Superinterfaces:
Serializable
public interface PullRequest extends Serializable
Pull request information
-
-
Field Summary
Fields Modifier and Type Field Description static String
BRANCH_REF_PREFIX
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
equalsByContent(PullRequest another)
Compares pull request information with another one, ignoring ids.Set<String>
getBranchMetaInfoIds()
String
getBranchName()
String
getBranchSpec()
String
getContributorRole()
String
getContributorUrl()
String
getContributorUsername()
ZonedDateTime
getCreatedTime()
Date
getCreatedTimeAsDate()
String
getId()
ZonedDateTime
getLastRetrievedTime()
String
getMergeBranchName()
The method returns a branch name that contains pre-fly merge of the pull request with the current state of its target branch if such a pre-fly merging is supported by a corresponding VCS hosting serviceString
getMergeBranchSpec()
String
getRequestBranchBranchName()
PR Specific Source branch: Branches which are created by VCS hostings over source branch with PR number.String
getRequestBranchBranchSpec()
PR Specific Source branch: Branches which are created by VCS hostings over source branch with PR number.Duration
getRetrievedAge()
Utility method returning the amount of tine passed from the moment when the pull request information was retrievedString
getRevision()
String
getSourceBranchRef()
String
getSourceRepository()
String
getStatus()
String
getTargetBranchRef()
String
getTitle()
ZonedDateTime
getUpdatedTime()
Date
getUpdatedTimeAsDate()
String
getUrl()
String
getVcsHostingType()
String
getVcsRootUrl()
boolean
isDraft()
boolean
isFromFork()
boolean
isFromVcsRoot(VcsRoot vcsRoot)
Allows checking if a pull request belongs to a given VCS rootboolean
isOpen()
boolean
isRetrievalFailure()
boolean
isRetrieved()
boolean
isRetrievedWithin(long timeMs)
Checks if the pull request info has been retreived within the given time period from nowboolean
isTargetRepositoryPrivate()
void
overrideBranchTimestamp(ZonedDateTime time)
Set a fixed value for branch create time stamp returned by getBranchTimestampMsString
serialize()
Serialises pull request information into its native format (i.e.void
setBranchTimestampInState(String branchName, RepositoryState state)
Sets branch create timestamp in a repository state.void
setLastRetrievedTime(ZonedDateTime timeMs)
void
setRetrievalFailure()
void
setUpdatedTime(ZonedDateTime time)
Sets pull request last updated timestamp
-
-
-
Field Detail
-
BRANCH_REF_PREFIX
static final String BRANCH_REF_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
@NotNull String getId()
- Returns:
- pull request id, unique within a VCS root scope, usually pull request number
-
getBranchMetaInfoIds
@NotNull Set<String> getBranchMetaInfoIds()
- Returns:
- globally unique pull request ids
-
getBranchName
@NotNull String getBranchName()
- Returns:
- pull request branch name
-
getMergeBranchName
@Nullable String getMergeBranchName()
The method returns a branch name that contains pre-fly merge of the pull request with the current state of its target branch if such a pre-fly merging is supported by a corresponding VCS hosting service- Returns:
- a branch name, if applicable, null otherwise
-
isRetrieved
boolean isRetrieved()
- Returns:
- true if pull request information is complete, false if it is still to be retrieved from a third party system
-
isRetrievedWithin
boolean isRetrievedWithin(long timeMs)
Checks if the pull request info has been retreived within the given time period from now- Parameters:
timeMs
- time period- Returns:
- true if it was retrieved within timeMs milliseconds or if last retrieval attempt failed, false otherwise
-
isOpen
boolean isOpen()
- Returns:
- true if pull request is open
-
getTitle
@Nullable String getTitle()
- Returns:
- pull request title if known, null otherwise
-
getUrl
@Nullable String getUrl()
- Returns:
- URL of a human readable pull request information page on a third party system if known, null otherwise
-
getStatus
@Nullable String getStatus()
- Returns:
- pull request status string if known, null otherwise. Possible values are specific to the third party systems.
-
getBranchSpec
@NotNull String getBranchSpec()
- Returns:
- branch spec that matches the pull request branch
-
getMergeBranchSpec
@Nullable String getMergeBranchSpec()
- Returns:
- branch spec that matches the branch name containing the result of pre-fly merging with a target branch
-
getTargetBranchRef
@Nullable String getTargetBranchRef()
- Returns:
- reference to a target branch for the pull request if known, null otherwise
-
isTargetRepositoryPrivate
boolean isTargetRepositoryPrivate()
- Returns:
- true if target repository is private, false otherwise
-
getSourceRepository
@Nullable String getSourceRepository()
- Returns:
- source repository owner and name if known, null otherwise
-
getSourceBranchRef
@Nullable String getSourceBranchRef()
- Returns:
- reference to a source branch for the pull request if known, null otherwise
-
getRevision
@Nullable String getRevision()
- Returns:
- Last revision relevant to a pull request
-
getContributorUsername
@Nullable String getContributorUsername()
- Returns:
- Contributor's username on a third party system
-
getContributorUrl
@Nullable String getContributorUrl()
- Returns:
- Contributor's profile URL on a third party system
-
getContributorRole
@Nullable String getContributorRole()
- Returns:
- the role of the PR contributor in respect to the target PR repository
-
getLastRetrievedTime
ZonedDateTime getLastRetrievedTime()
- Returns:
- time when the pull request info was retrieved from a third party system
-
setLastRetrievedTime
void setLastRetrievedTime(ZonedDateTime timeMs)
- Parameters:
timeMs
- last time when the pull request info was retrieved
-
isRetrievalFailure
boolean isRetrievalFailure()
- Returns:
- if the last attempt to retrieve this pull request information has in fact failed
-
setRetrievalFailure
void setRetrievalFailure()
-
getUpdatedTime
ZonedDateTime getUpdatedTime()
- Returns:
- time when the pull request was changed
-
getUpdatedTimeAsDate
Date getUpdatedTimeAsDate()
- Returns:
- time when the pull request changes as Date object
-
setUpdatedTime
void setUpdatedTime(ZonedDateTime time)
Sets pull request last updated timestamp- Parameters:
time
-
-
getCreatedTime
ZonedDateTime getCreatedTime()
- Returns:
- time when the pull request was created
-
getCreatedTimeAsDate
Date getCreatedTimeAsDate()
- Returns:
- time when the pull request was created as Date object
-
setBranchTimestampInState
void setBranchTimestampInState(@NotNull String branchName, @NotNull RepositoryState state)
Sets branch create timestamp in a repository state. By default branch created time is used, but overrideBranchTimestamp method can be used to override this- Parameters:
branchName
- branch name (as it could be eithre head or merge branch name)state
- repository state
-
overrideBranchTimestamp
void overrideBranchTimestamp(@NotNull ZonedDateTime time)
Set a fixed value for branch create time stamp returned by getBranchTimestampMs- Parameters:
time
-
-
getRetrievedAge
@Nullable Duration getRetrievedAge()
Utility method returning the amount of tine passed from the moment when the pull request information was retrieved- Returns:
- time in seconds
-
serialize
String serialize()
Serialises pull request information into its native format (i.e. as provided by relevant third party system)- Returns:
- serialised pull request information, e.g. in some JSON-based format
-
equalsByContent
boolean equalsByContent(@Nullable PullRequest another)
Compares pull request information with another one, ignoring ids.- Parameters:
another
-- Returns:
- true if equal, false otherwise
-
getVcsRootUrl
String getVcsRootUrl()
- Returns:
- VCS root fetch URL
-
isFromVcsRoot
boolean isFromVcsRoot(VcsRoot vcsRoot)
Allows checking if a pull request belongs to a given VCS root- Parameters:
vcsRoot
-- Returns:
- see above
-
getVcsHostingType
@NotNull String getVcsHostingType()
- Returns:
- type of VCS Hosting: azureDevOps, bitbucketServer, bitbucketCloud, github, gitlab, jetbrainsSpace
-
getRequestBranchBranchSpec
@Nullable String getRequestBranchBranchSpec()
PR Specific Source branch: Branches which are created by VCS hostings over source branch with PR number. E.g: refs/pull/requests/1/from- Returns:
- branch spec of PR specific source branch. E.g: +:refs/(pull-requests/1)/from
-
getRequestBranchBranchName
@Nullable String getRequestBranchBranchName()
PR Specific Source branch: Branches which are created by VCS hostings over source branch with PR number. E.g: refs/pull/requests/1/from- Returns:
- branch name of PR specific source branch. E.g: refs/pull/requests/1/from
-
isDraft
boolean isDraft()
-
isFromFork
boolean isFromFork()
-
-