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 |
addCommentToPatch(Patch patch,
String comment)
Add a
Comment to the specified Patch object, and propagate the changes
to the remote repository. |
void |
addLabelToPatch(Patch patch,
String labelName)
Attach a label to the specified patch.
|
void |
close() |
List<Patch> |
findPatchesRelatedTo(Patch patch)
Retrieve all
Patch objects related to the supplied patch. |
List<Stream> |
getAllStreams()
Returns the streams discovered by all of the active StreamServices
|
CommitStatus |
getCommitStatusFromPatch(Patch patch)
Retrieve the current CI status of the latest commit associated with a given patch.
|
StreamComponent |
getComponentBy(Repository repository,
Codebase codebase)
Get the StreamComponent which specifies the given repository and codebase.
|
List<Repository> |
getDistinctURLRepositoriesByStream(String streamName)
Retrieve all Repositories associated with a given Stream, or an empty lists if no Repositories are associated
with the given streamName.
|
List<Repository> |
getDistinctURLRepositoriesFromStreams()
Retrieve all unique Repositories that exists across all Streams.
|
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(Patch patch)
Retrieve all Issues associated with the provided patch object.
|
List<Label> |
getLabelsFromPatch(Patch patch)
Retrieve all labels associated with the provided
Patch object. |
List<Label> |
getLabelsFromRepository(Repository repository)
Retrieve all labels associated with the provided
Patch in Repository object. |
Patch |
getPatch(URL url)
Get the
Patch located at the provided URL. |
List<Patch> |
getPatchesAssociatedWith(Issue issue)
Retrieve all Patches associated with the provided
Issue object |
List<Patch> |
getPatchesByState(Repository repository,
PatchState state)
Retrieve all Patches associated with the provided
Repository object, which have a
state that matches the provided PatchState object. |
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(Repository repository,
Codebase codebase)
Find all streams associated with a given repository and codebase.
|
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 patches in the provided Repository |
void |
removeLabelFromPatch(Patch patch,
String name)
Delete a label from the provided
Patch 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 |
setLabelsToPatch(Patch patch,
List<Label> labels)
Set the labels for the provided
Patch 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(Patch patch)
patch - the Patch 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<Patch> getPatchesAssociatedWith(Issue issue) throws NotFoundException
Issue objectissue - the Issue object whose associated Patches should be returned.Patch objects, or an empty list if no patches can be found.a - NotFoundException, if an exception is encountered when trying to retrieve patches from a RepositoryServiceNotFoundExceptionpublic List<Patch> getPatchesByState(Repository repository, PatchState state) throws NotFoundException
Repository object, which have a
state that matches the provided PatchState object.repository - the Repository object whose associated Patches should be returned.state - the PatchState which the returned Patch objects must have.Patch objects, or an empty list if no patches can be found.a - NotFoundException, if an exception is encountered when trying to retrieve patches from a RepositoryServiceNotFoundExceptionpublic Patch getPatch(URL url) throws NotFoundException
Patch located at the provided URL.url - the URL of the patch to be retrieved.Patch object.NotFoundException - if a Patch cannot be found at the provided base url.public List<Label> getLabelsFromRepository(Repository repository) throws NotFoundException
Patch 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> getLabelsFromPatch(Patch patch) throws NotFoundException
Patch object.patch - the Patch object whose associated labels should be returned.Label objects, or an empty list if no patches 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 patches in the provided Repositoryrepository - the Repository whose permissions are to be checkedNotFoundException - if the specified Repository cannot be found.public void setLabelsToPatch(Patch patch, List<Label> labels) throws NotFoundException, AphroditeException
Patch object.patch - the Patch object whose will be set.labels - the Label apply to the PatchNotFoundException - if the Label can not be found in the provided PatchAphroditeException - if add the Label is not consistent with get labelspublic void removeLabelFromPatch(Patch patch, String name) throws NotFoundException
Patch object.patch - the Patch whose label will be removed.name - the Label name will be removed.NotFoundException - if the Label name can not be found in the provided Patch, or an
exception occurs when contacting the RepositoryServicepublic void addCommentToPatch(Patch patch, String comment) throws NotFoundException
Comment to the specified Patch object, and propagate the changes
to the remote repository.patch - the Patch on which the comment will be made.comment - the new Comment.NotFoundException - if the Patch cannot be found at the remote repository.public void addLabelToPatch(Patch patch, String labelName) throws NotFoundException
patch - the Patch to which the label will be applied.labelName - the name of the label to be applied.a - NotFoundException if the Patch cannot be found, or the labelName does not exist.NotFoundExceptionpublic List<Patch> findPatchesRelatedTo(Patch patch)
Patch objects related to the supplied patch. A patch is related if its URL is referenced in the
provided patch object. Note, this method fails silently if a patch cannot be retrieved from a URL, with the error message
simply logged.patch - the Patch object to be queried againstpublic CommitStatus getCommitStatusFromPatch(Patch patch) throws NotFoundException
patch - the Patch object whose status is to be queriedNotFoundException - if no commit status can be found for the provided patchpublic 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.public List<Repository> getDistinctURLRepositoriesFromStreams()
public List<Repository> getDistinctURLRepositoriesByStream(String streamName)
streamName - the name of the Stream containing the returned repositories.public List<Stream> getStreamsBy(Repository repository, Codebase codebase)
repository - the Repository to be searched againstcodebase - the codebase to be searched againstpublic StreamComponent getComponentBy(Repository 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 © 2016 JBoss by Red Hat. All rights reserved.