|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.twelvegm.hudson.plugin.reviewboard.ReviewboardHttpAPI
public class ReviewboardHttpAPI
Creates an instance of the Reviewboard API. Calls are currently executed against the RESTful HTTP endpoints exposed by Reviewboard. Authentication is done by Basic Authentication with supplied username and password during instantiation. Assumptions are that you have a configured version of Reviewboard associated with a SCM. Currently, this has only been tested with Perforce. Currently supports a limited selection of HTTP endpoints pre-1.5 beta 2. TODO: Add better/more error handling and logging What this DOES currently do: 1) Update an existing review with changes uploaded to the SCM (post-commit). 2) Add a change description to a new diff (see #1). 3) Set default reviewers on a review request. 4) Set bugs on a review request. 5) Set default review groups on a review request. 6) Publish a review that is in draft. 7) Get reviewboard users matching a query. 8) Get reviewboard groups matching a query. 9) Supports Perforce SCM What this DOESN'T currently do: 1) Create a new review request. This API currently assumes a review request already exists, having been created through the web interface or post-review (for pre/post-commits). 2) Set the branch field of a review request (haven't had a need for it yet). 3) Get a complete review request. 4) Password encryption/decryption. It's currently clear-text. 5) Add a review to a review request. 6) Add a test description to a review request. 7) Add a screenshot to a review request. 8) Star a review request. 9) Close a review request. 10) Become sentient and destroy all humans. 11) Support CVS, SVN, Git, or any SCMs other than Perforce Known issues / To Dos: 1) The API URLs are known to be changing in the release of 1.5, so these will need to be updated accordingly. For backward compatibility, the constants for these APIs should probably have versions included in their name so the 1.5 version of the URLs don't conflict when added. 2) Some strings need to be made into constants, such as the JSON keys for retrieval of groups and users. String literals embedded in source code are bad, mmmm-kay?
| Constructor Summary | |
|---|---|
ReviewboardHttpAPI(String username,
String password,
String baseUrl)
Creates a new ReviewboardHttpAPI object used to connect to Reviewboard and execute commands. |
|
| Method Summary | |
|---|---|
Set<String> |
getGroups(String query)
Retrieves a list of Reviewboard Groups that match the query argument. |
Set<String> |
getReviewers(String query)
Retrieves a list of Reviewboard users who match the query argument. |
boolean |
publishReview(ReviewRequest review)
Publishes a review request in draft. |
boolean |
setBugs(ReviewRequest review,
String bugs)
Sets the related bugs of a pending review request. |
boolean |
setChangeDescription(ReviewRequest review,
String description)
Sets the change description on a review that is being updated and in draft. |
boolean |
setGroups(ReviewRequest review,
String groups)
Sets one or more groups as default review groups on a review request. |
boolean |
setReviewers(ReviewRequest review,
String reviewers)
Sets one or more users as default reviewers on a review request. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReviewboardHttpAPI(String username,
String password,
String baseUrl)
throws org.apache.commons.httpclient.URIException,
NullPointerException
username - Username of account that has access rights to Reviewboardpassword - Password of UsernamebaseUrl - Base URL at which Reviewboard is running
NullPointerException
org.apache.commons.httpclient.URIException| Method Detail |
|---|
public Set<String> getGroups(String query)
query - part of string to search Reviewboard to match group names against.
public Set<String> getReviewers(String query)
query - part of usernames to match against Reviewboard users.
public boolean setGroups(ReviewRequest review,
String groups)
getGroups(String) to validate input before passing to this method. The
review request being modified should be in draft and not yet submit. This method
will overwrite any existing groups on the review request.
review - Review to modify set the review groups ongroups - String of comma-separated groups to set
public boolean setReviewers(ReviewRequest review,
String reviewers)
getReviewers(String) to validate input before passing to this method. The
review request being modified should be in draft and not yet submit. This method
will overwrite any existing reviewers on the review request.
review - Review to set the reviewers onreviewers - String of comma-separated Reviewboard users to set
public boolean setChangeDescription(ReviewRequest review,
String description)
review - Review to add the description todescription - Description to add to the pending diff
public boolean setBugs(ReviewRequest review,
String bugs)
review - Review to add the bug(s) tobugs - String of comma-separated bug IDs
public boolean publishReview(ReviewRequest review)
review - Review to publish
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||