public class Aphrodite extends Object implements AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
static String |
FILE_PROPERTY |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addCommentToIssue(Collection<Issue> issues,
Comment comment)
Adds the
Comment to all of the provided Issue objects. |
void |
addCommentToIssue(Issue issue,
Comment comment)
Adds a new comment to the specified issue.
|
boolean |
addCommentToIssue(Map<Issue,Comment> commentMap)
Adds the
Comment to the associated Issue object for all Issue/Comment
pairs in the Map. |
void |
addCommentToPullRequest(PullRequest pullRequest,
String comment)
Add a
Comment to the specified PullRequest object, and propagate the changes
to the remote repository. |
void |
addLabelToPullRequest(PullRequest pullRequest,
String labelName)
Attach a label to the specified pull request.
|
void |
close() |
List<PullRequest> |
findPullRequestsRelatedTo(PullRequest pullRequest)
Retrieve all
PullRequest objects related to the supplied pull request. |
List<Stream> |
getAllStreams()
Returns the streams discovered by all of the active StreamServices
|
CommitStatus |
getCommitStatusFromPullRequest(PullRequest pullRequest)
Retrieve the current CI status of the latest commit associated with a given pull request.
|
StreamComponent |
getComponentBy(URI repository,
Codebase codebase)
Deprecated.
|
List<URI> |
getDistinctURLRepositoriesByStream(String streamName)
Deprecated.
|
List<URI> |
getDistinctURLRepositoriesFromStreams()
Deprecated.
|
Issue |
getIssue(URL url)
Retrieve an issue object associated with the given
URL. |
List<Issue> |
getIssues(Collection<URL> urls)
Retrieve all issues associated with the provided URLs.
|
List<Issue> |
getIssuesAssociatedWith(PullRequest pullRequest)
Retrieve all Issues associated with the provided pull request object.
|
List<Label> |
getLabelsFromPullRequest(PullRequest pullRequest)
Retrieve all labels associated with the provided
PullRequest object. |
List<Label> |
getLabelsFromRepository(Repository repository)
Retrieve all labels associated with the provided
PullRequest in Repository object. |
PullRequest |
getPullRequest(URL url)
Get the
PullRequest located at the provided URL. |
List<PullRequest> |
getPullRequestsByState(Repository repository,
PullRequestState state)
Retrieve all PullRequests associated with the provided
Repository object, which have a
state that matches the provided PullRequestState object. |
Map<RepositoryType,RateLimit> |
getRateLimits() |
Repository |
getRepository(URL url)
Get the repository located at the provided
URL. |
Stream |
getStream(String streamName)
Get a specific
Stream object based upon its String name. |
List<Stream> |
getStreamsBy(URI repository,
Codebase codebase)
Deprecated.
|
static Aphrodite |
instance()
Get an instance of the Aphrodite service.
|
static Aphrodite |
instance(AphroditeConfig config)
Get an instance of the Aphrodite service.
|
boolean |
isRepositoryLabelsModifiable(Repository repository)
Discover if the user logged into a
RepositoryService has the correct permissions to apply/remove
labels to pull request in the provided Repository |
void |
removeLabelFromPullRequest(PullRequest pullRequest,
String name)
Delete a label from the provided
PullRequest object. |
List<Issue> |
searchIssues(SearchCriteria searchCriteria)
Return all issues, across all Issue Trackers, which match the passed
SearchCriteria. |
List<Issue> |
searchIssuesByFilter(URL filterUrl)
Return all issues which match the provided filter.
|
void |
setLabelsToPullRequest(PullRequest pullRequest,
List<Label> labels)
Set the labels for the provided
PullRequest object. |
boolean |
updateIssue(Issue issue)
Update a specific
Issue at the remote issue tracker service. |
public static final String FILE_PROPERTY
public static Aphrodite instance() throws AphroditeException
AphroditeException - if the specified configuration file cannot be opened.public static Aphrodite instance(AphroditeConfig config) throws AphroditeException
IllegalStateException is thrown if a different AphroditeConfig object is passed.config - an AphroditeConfig object containing all configuration data.AphroditeExceptionIllegalStateException - if an Aphrodite service has already been initialised.public void close()
throws Exception
close in interface AutoCloseableExceptionpublic Issue getIssue(URL url) throws NotFoundException
URL.url - the URL of the issue to be retrieved.Issue associated with the provided URK.NotFoundException - if the provided URL is not associated with an issue at any of the active issuetrackers.public List<Issue> getIssues(Collection<URL> urls)
IssueTrackerServer. If the provided URLs
collection is empty, or no issues are found, then an empty List is returned.urls - a collection of issue URLs.Issue objects associated with the provided urls.public List<Issue> searchIssues(SearchCriteria searchCriteria)
SearchCriteria.searchCriteria - all set fields will be search for.Issue objects which match the specified searchCriteria,
or an empty list if no issues match the searched criteria.public List<Issue> searchIssuesByFilter(URL filterUrl) throws NotFoundException
filterUrl - the url of the issue tracker filtered to be applied.Issue objects which are returned by the provided filter.NotFoundException - if the filterURL is not associated with any filters at any of the Issue Trackers.public boolean updateIssue(Issue issue) throws NotFoundException, AphroditeException
Issue at the remote issue tracker service.
Note, this does not update issue comments or an issues description.
To add a new comment, use addCommentToIssue(Issue, Comment)issue - the issue to be updated at the associated IssueTrackerServiceNotFoundException - if the provided Issue cannot be found at the IssueTracker.AphroditeException - if the user credentials supplied for this issue track do not have
permission to update this issue, or a field within this issue.public void addCommentToIssue(Issue issue, Comment comment) throws NotFoundException
issue - the issue to add a new comment to.comment - the comment to be added to the issue.NotFoundExceptionpublic boolean addCommentToIssue(Map<Issue,Comment> commentMap)
Comment to the associated Issue object for all Issue/Comment
pairs in the Map. Null comments are ignored.commentMap - the map containing all Issues that are to be updated and the associated comments.public boolean addCommentToIssue(Collection<Issue> issues, Comment comment)
Comment to all of the provided Issue objects.issues - a collection of all issues that the comment should be added to.comment - the comment to be added to all issues.public List<Issue> getIssuesAssociatedWith(PullRequest pullRequest)
pullRequest - the PullRequest object whoms associated Issues should be returned.Issue objects, or an empty list if no issues can be found.public Repository getRepository(URL url) throws NotFoundException
URL.url - the URL of the repository to be retrieved.Repository object.NotFoundException - if a Repository cannot be found at the provided base url,
or no service exists with the same host domain as the provided URL.public List<PullRequest> getPullRequestsByState(Repository repository, PullRequestState state) throws NotFoundException
Repository object, which have a
state that matches the provided PullRequestState object.repository - the Repository object whose associated PullRequests should be returned.state - the PullRequestState which the returned PullRequest objects must have.PullRequest objects, or an empty list if no pullRequests can be found.a - NotFoundException, if an exception is encountered when trying to retrieve pullRequests from a RepositoryServiceNotFoundExceptionpublic PullRequest getPullRequest(URL url) throws NotFoundException
PullRequest located at the provided URL.url - the URL of the pullRequest to be retrieved.PullRequest object.NotFoundException - if a PullRequest cannot be found at the provided base url.public Map<RepositoryType,RateLimit> getRateLimits() throws NotFoundException
NotFoundExceptionpublic List<Label> getLabelsFromRepository(Repository repository) throws NotFoundException
PullRequest in Repository object.repository - the Repository object whose associated labels should be returned.Label objects, or an empty list if no labels can be found.a - NotFoundException if an error is encountered when trying to retrieve labels from a RepositoryServiceNotFoundExceptionpublic List<Label> getLabelsFromPullRequest(PullRequest pullRequest) throws NotFoundException
PullRequest object.pull - request the PullRequest object whose associated labels should be returned.Label objects, or an empty list if no pull request can be found.a - NotFoundException if an error is encountered when trying to retrieve labels from a RepositoryServiceNotFoundExceptionpublic boolean isRepositoryLabelsModifiable(Repository repository) throws NotFoundException
RepositoryService has the correct permissions to apply/remove
labels to pull request in the provided Repositoryrepository - the Repository whose permissions are to be checkedNotFoundException - if the specified Repository cannot be found.public void setLabelsToPullRequest(PullRequest pullRequest, List<Label> labels) throws NotFoundException, AphroditeException
PullRequest object.pullRequest - the PullRequest object whose will be set.labels - the Label apply to the PullRequestNotFoundException - if the Label can not be found in the provided PullRequestAphroditeException - if add the Label is not consistent with get labelspublic void removeLabelFromPullRequest(PullRequest pullRequest, String name) throws NotFoundException
PullRequest object.pullRequest - the PullRequest whose label will be removed.name - the Label name will be removed.NotFoundException - if the Label name can not be found in the provided PullRequest, or an
exception occurs when contacting the RepositoryServicepublic void addCommentToPullRequest(PullRequest pullRequest, String comment) throws NotFoundException
Comment to the specified PullRequest object, and propagate the changes
to the remote repository.pullRequest - the PullRequest on which the comment will be made.comment - the new Comment.NotFoundException - if the PullRequest cannot be found at the remote repository.public void addLabelToPullRequest(PullRequest pullRequest, String labelName) throws NotFoundException
pullRequest - the PullRequest to which the label will be applied.labelName - the name of the label to be applied.a - NotFoundException if the PullRequest cannot be found, or the labelName does not exist.NotFoundExceptionpublic List<PullRequest> findPullRequestsRelatedTo(PullRequest pullRequest)
PullRequest objects related to the supplied pull request. A pull request is related if its URL is referenced in the
provided pull request object. Note, this method fails silently if a pull request cannot be retrieved from a URL, with the error message
simply logged.pull - request the PullRequest object to be queried againstpublic CommitStatus getCommitStatusFromPullRequest(PullRequest pullRequest) throws NotFoundException
pullRequest - the PullRequest object whose status is to be queriedNotFoundException - if no commit status can be found for the provided pull requestpublic List<Stream> getAllStreams()
StreamService instances.public Stream getStream(String streamName) throws NotFoundException
Stream object based upon its String name.streamName - the name of the Stream to be returned.Stream object which corresponds to the specified streamName
if it exists at a StreamService.NotFoundException - if the specified streamName does not exist at any of the loaded StreamServices.@Deprecated public List<URI> getDistinctURLRepositoriesFromStreams()
@Deprecated public List<URI> getDistinctURLRepositoriesByStream(String streamName)
streamName - the name of the Stream containing the returned repositories.@Deprecated public List<Stream> getStreamsBy(URI repository, Codebase codebase)
repository - the Repository to be searched againstcodebase - the codebase to be searched against@Deprecated public StreamComponent getComponentBy(URI repository, Codebase codebase) throws NotFoundException
repository - the Repository to be searched against.codebase - the codebase to be searched against.NotFoundException - if a StreamComponent with the specified repository and codebase does not exist at this
stream service.Copyright © 2017 JBoss by Red Hat. All rights reserved.