Package org.jboss.set.aphrodite.spi
Interface RepositoryService
-
public interface RepositoryService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidaddCommentToPullRequest(org.jboss.set.aphrodite.domain.PullRequest pullRequest, String comment)Deprecated.Useorg.jboss.set.aphrodite.domain.spi.PullRequestHome#addComment()instead.voidaddLabelToPullRequest(org.jboss.set.aphrodite.domain.PullRequest pullRequest, String labelName)Deprecated.Useorg.jboss.set.aphrodite.domain.spi.PullRequestHome#addLabel()instead.default voiddestroy()allows to destroy and deallocate resourcesList<org.jboss.set.aphrodite.domain.PullRequest>findPullRequestsRelatedTo(org.jboss.set.aphrodite.domain.PullRequest pullRequest)Deprecated.Useorg.jboss.set.aphrodite.domain.spi.PullRequestHome#findReferencedPullRequests()instead.List<org.jboss.set.aphrodite.domain.Commit>getCommitsSince(URL url, String branch, long since)returns list of commits committed after a given dateorg.jboss.set.aphrodite.domain.CommitStatusgetCommitStatusFromPullRequest(org.jboss.set.aphrodite.domain.PullRequest pullRequest)Deprecated.Useorg.jboss.set.aphrodite.domain.spi.PullRequestHome#getCommitStatus()instead.List<org.jboss.set.aphrodite.domain.Label>getLabelsFromPullRequest(org.jboss.set.aphrodite.domain.PullRequest pullRequest)Deprecated.Useorg.jboss.set.aphrodite.domain.spi.PullRequestHome#getLabels()instead.List<org.jboss.set.aphrodite.domain.Label>getLabelsFromRepository(org.jboss.set.aphrodite.domain.Repository repository)Retrieve all labels associated with the providedPullRequestinRepositoryobject.org.jboss.set.aphrodite.domain.PullRequestgetPullRequest(URL url)Get thePullRequestlocated at the providedURL.org.jboss.set.aphrodite.domain.spi.PullRequestHomegetPullRequestHome()Return the PullRequestHome service for this repository.List<org.jboss.set.aphrodite.domain.PullRequest>getPullRequestsAssociatedWith(org.jboss.set.aphrodite.domain.Issue issue)Deprecated.List<org.jboss.set.aphrodite.domain.PullRequest>getPullRequestsByState(org.jboss.set.aphrodite.domain.Repository repository, org.jboss.set.aphrodite.domain.PullRequestState state)Retrieve all pull requests associated with the providedRepositoryobject, which have a state that matches the providedPullRequestStateobject.org.jboss.set.aphrodite.domain.RateLimitgetRateLimit()org.jboss.set.aphrodite.domain.RepositorygetRepository(URL url)Get the repository located at the providedURL.RepositoryTypegetRepositoryType()Get Repository typebooleanhasModifiableLabels(org.jboss.set.aphrodite.domain.Repository repository)Discover if the user logged into thisRepositoryServicehas the correct permissions to apply/remove labels to pull request in the providedRepositorybooleaninit(AphroditeConfig config)Initiate thisRepositoryServiceusing the suppliedAphroditeConfig.booleaninit(RepositoryConfig config)Initiate thisRepositoryServiceusing the suppliedRepositoryConfig.voidremoveLabelFromPullRequest(org.jboss.set.aphrodite.domain.PullRequest pullRequest, String name)Deprecated.Useorg.jboss.set.aphrodite.domain.spi.PullRequestHome#removeLabel()instead.booleanrepositoryAccessable(URL url)Checks whether the providedURLis accessable.voidsetLabelsToPullRequest(org.jboss.set.aphrodite.domain.PullRequest pullRequest, List<org.jboss.set.aphrodite.domain.Label> labels)Deprecated.Useorg.jboss.set.aphrodite.domain.spi.PullRequestHome#setLabels()instead.booleanurlExists(URL url)Checks whether the providedURLis on the same host as this service.
-
-
-
Method Detail
-
init
boolean init(AphroditeConfig config)
Initiate thisRepositoryServiceusing the suppliedAphroditeConfig. The firstRepositoryConfigobject found inAphroditeConfigobject, is used to initiate the service and is subsequently removed from the config to prevent the same service being initiated twice.- Parameters:
config- aAphroditeConfigobject containing at least oneRepositoryConfigobject.- Returns:
trueif the service was initialised without errors,falseotherwise.- Throws:
IllegalArgumentException- if noRepositoryConfigobjects are present.
-
init
boolean init(RepositoryConfig config)
Initiate thisRepositoryServiceusing the suppliedRepositoryConfig.- Parameters:
config- aRepositoryConfigobject containing all configuration information.- Returns:
trueif the service was initialised without errors,falseotherwise.
-
urlExists
boolean urlExists(URL url)
Checks whether the providedURLis on the same host as this service.- Parameters:
url- theURLto check.- Returns:
- true if the provided
URLhas the same host as this service, otherwise false. - Throws:
NullPointerException- if the providedURLis null.
-
repositoryAccessable
boolean repositoryAccessable(URL url)
Checks whether the providedURLis accessable.- Parameters:
url- theURLto check.- Returns:
- true if the provided
URLis accessable, otherwise false.
-
getRepository
org.jboss.set.aphrodite.domain.Repository getRepository(URL url) throws NotFoundException
Get the repository located at the providedURL.- Parameters:
url- theURLof the repository to be retrieved.- Returns:
- the
Repositoryobject. - Throws:
NotFoundException- if aRepositorycannot be found at the provided base url.
-
getPullRequest
org.jboss.set.aphrodite.domain.PullRequest getPullRequest(URL url) throws NotFoundException
Get thePullRequestlocated at the providedURL.- Parameters:
url- theURLof the pull request to be retrieved.- Returns:
- the
PullRequestobject. - Throws:
NotFoundException- if aPullRequestcannot be found at the provided base url.
-
getPullRequestsAssociatedWith
@Deprecated List<org.jboss.set.aphrodite.domain.PullRequest> getPullRequestsAssociatedWith(org.jboss.set.aphrodite.domain.Issue issue) throws NotFoundException
Deprecated.Retrieve all pull requests associated with the providedIssueobject- Parameters:
issue- theIssueobject whose associated pull requests should be returned.- Returns:
- a list of all
PullRequestobjects, or an empty list if no pull request can be found. - Throws:
NotFoundException- if an exception is thrown when searching the RepositoryService.
-
getPullRequestsByState
List<org.jboss.set.aphrodite.domain.PullRequest> getPullRequestsByState(org.jboss.set.aphrodite.domain.Repository repository, org.jboss.set.aphrodite.domain.PullRequestState state) throws NotFoundException
Retrieve all pull requests associated with the providedRepositoryobject, which have a state that matches the providedPullRequestStateobject.- Parameters:
repository- theRepositoryobject whose associated pull requests should be returned.state- thePullRequestsStatewhich the returnedPullRequestobjects must have.- Returns:
- a list of all matching
PullRequestobjects, or an empty list if no pull request can be found. - Throws:
NotFoundException- if the providedRepositorycannot be found at the RepositoryService.
-
getLabelsFromRepository
List<org.jboss.set.aphrodite.domain.Label> getLabelsFromRepository(org.jboss.set.aphrodite.domain.Repository repository) throws NotFoundException
Retrieve all labels associated with the providedPullRequestinRepositoryobject.- Parameters:
repository- theRepositoryobject whose associated labels should be returned.- Returns:
- a list of all matching
Labelobjects, or an empty list if no label can be found. - Throws:
NotFoundException- if the providedRepositoryurl not consistent with the baseURL.
-
getLabelsFromPullRequest
@Deprecated List<org.jboss.set.aphrodite.domain.Label> getLabelsFromPullRequest(org.jboss.set.aphrodite.domain.PullRequest pullRequest) throws NotFoundException
Deprecated.Useorg.jboss.set.aphrodite.domain.spi.PullRequestHome#getLabels()instead.Retrieve all labels associated with the providedPullRequestobject.- Parameters:
pullRequest- thePullRequestobject whose associated labels should be returned.- Returns:
- a list of all matching
Labelobjects, or an empty list if no pull request can be found. - Throws:
NotFoundException- if the providedPullRequesturl not consistent with the baseURL.
-
hasModifiableLabels
boolean hasModifiableLabels(org.jboss.set.aphrodite.domain.Repository repository) throws NotFoundExceptionDiscover if the user logged into thisRepositoryServicehas the correct permissions to apply/remove labels to pull request in the providedRepository- Parameters:
repository- theRepositorywhose permissions are to be checked- Returns:
- true if the user has permission, otherwise false.
- Throws:
NotFoundException- if the specifiedRepositorycannot be found.
-
setLabelsToPullRequest
@Deprecated void setLabelsToPullRequest(org.jboss.set.aphrodite.domain.PullRequest pullRequest, List<org.jboss.set.aphrodite.domain.Label> labels) throws NotFoundException, AphroditeException
Deprecated.Useorg.jboss.set.aphrodite.domain.spi.PullRequestHome#setLabels()instead.Set the labels for the providedPullRequestobject.- Parameters:
pullRequest- thePullRequestobject whose will be set.labels- theLabelapply to thePullRequest- Throws:
NotFoundException- if theLabelcan not be found in the providedPullRequestAphroditeException- if add theLabelis not consistent with get labels
-
removeLabelFromPullRequest
@Deprecated void removeLabelFromPullRequest(org.jboss.set.aphrodite.domain.PullRequest pullRequest, String name) throws NotFoundException
Deprecated.Useorg.jboss.set.aphrodite.domain.spi.PullRequestHome#removeLabel()instead.Delete a label from the providedPullRequestobject.- Parameters:
pullRequest- thePullRequestwhose label will be removed.name- theLabelname will be removed.- Throws:
NotFoundException- if theLabelname can not be found in the providedPullRequest
-
addCommentToPullRequest
@Deprecated void addCommentToPullRequest(org.jboss.set.aphrodite.domain.PullRequest pullRequest, String comment) throws NotFoundException
Deprecated.Useorg.jboss.set.aphrodite.domain.spi.PullRequestHome#addComment()instead.Add aCommentto the specifiedPullRequestobject, and propagate the changes to the remote repository.- Parameters:
pullRequest- thePullRequeston which the comment will be made.comment- the newComment.- Throws:
NotFoundException- if thePullRequestcannot be found at the remote repository.
-
addLabelToPullRequest
@Deprecated void addLabelToPullRequest(org.jboss.set.aphrodite.domain.PullRequest pullRequest, String labelName) throws NotFoundException
Deprecated.Useorg.jboss.set.aphrodite.domain.spi.PullRequestHome#addLabel()instead.Attach a label to the specified pull request. Note the label must already exist at remote repository, otherwise aNotFoundExceptionwill be thrown. If the specified label is already associated with the provided pull request then no further action is taken.- Parameters:
pullRequest- thePullRequestto which the label will be applied.labelName- the name of the label to be applied.- Throws:
NotFoundException- if the specified labelName has not been defined at the remote repository.
-
findPullRequestsRelatedTo
@Deprecated List<org.jboss.set.aphrodite.domain.PullRequest> findPullRequestsRelatedTo(org.jboss.set.aphrodite.domain.PullRequest pullRequest)
Deprecated.Useorg.jboss.set.aphrodite.domain.spi.PullRequestHome#findReferencedPullRequests()instead.Find all the pull requests related to the given pull request.- Parameters:
pullRequest- thePullRequeston which pull requests related are being searched- Returns:
- list of pull requests related.
-
getCommitStatusFromPullRequest
@Deprecated org.jboss.set.aphrodite.domain.CommitStatus getCommitStatusFromPullRequest(org.jboss.set.aphrodite.domain.PullRequest pullRequest) throws NotFoundException
Deprecated.Useorg.jboss.set.aphrodite.domain.spi.PullRequestHome#getCommitStatus()instead.Retrieve the current CI status of the latest commit associated with a given pull request.- Parameters:
pullRequest- thePullRequestobject whose status is to be queried- Returns:
- the CI status of the latest commit associated with the given pull request
- Throws:
NotFoundException- if no commit status can be found for the provided pull request
-
destroy
default void destroy()
allows to destroy and deallocate resources
-
getRateLimit
org.jboss.set.aphrodite.domain.RateLimit getRateLimit() throws NotFoundException- Throws:
NotFoundException
-
getRepositoryType
RepositoryType getRepositoryType()
Get Repository type- Returns:
- RepositoryType
-
getPullRequestHome
org.jboss.set.aphrodite.domain.spi.PullRequestHome getPullRequestHome()
Return the PullRequestHome service for this repository.- Returns:
- Returns The PR home service for this repository.
-
getCommitsSince
List<org.jboss.set.aphrodite.domain.Commit> getCommitsSince(URL url, String branch, long since)
returns list of commits committed after a given date- Parameters:
url- - repository urlbranch- - repository branchsince- - date in Unix time- Returns:
- list of commits since a given date
-
-