segunda-feira, 28 de outubro de 2013

More simple examples and source code

For more details abou the API, you can take a look in the original code:

A full example to retrieve reviews from ReviewBoard in Java

This is a simple example to retrieve reviews from the ReviewBoard demo. Basically we will do some read operation, with the period.

package com.reviewboard;
import java.util.Date;
import java.util.List;
import org.apache.log4j.Logger;
import com.reviewboard.api.ReviewBoardApi;
import com.reviewboard.api.model.DiffComment;
import com.reviewboard.api.model.ReviewRequest;
import com.reviewboard.api.model.ReviewResource;
import com.reviewboard.api.model.ReviewStatus;
import com.reviewboard.util.DateUtil;
public class Main {
        private static Logger logger = Logger.getLogger(Main.class);

        public static void main(String arg[]) throws Exception{

                String host = "";
                ReviewBoardApi reviewBoardApi = new ReviewBoardApi(host);
                /*List<ReviewRequest> listReviewRequest = reviewBoardApi.listAllPedingReviewRequestFull();
                for (ReviewRequest reviewItem : listReviewRequest) {
                /*ReviewRequest reviewRequest = reviewBoardApi.getReviewRequest(new Long(46));
                Date dateStart = DateUtil.toSimple("2012-05-15");
                Date dateEnd = DateUtil.toSimple("2012-05-31");

                String user=null;
                List<ReviewRequest> listAllReviewRequest = reviewBoardApi.listAllReviewRequestFull(
                                dateStart, dateEnd,
                for (ReviewRequest reviewRequest : listAllReviewRequest) {
              " > "+reviewRequest.getSummary());
              "Sub :"+reviewRequest.getSubmitter());
                        List<String> bugsClosed = reviewRequest.getBugsClosed();
                        for (String string : bugsClosed) {
                      "Bug :"+string);
                        List<String> groups = reviewRequest.getTargetGroups();
                        for (String string : groups) {
                      "Groups :"+string);
                        List<String> peoples = reviewRequest.getTargetPeople();
                        for (String string : peoples) {
                      "People :"+string);
                        List<ReviewResource> reviewResouces = reviewRequest.getReviewResouces();
              "Review Resource Size :"+reviewResouces.size());
                        for (ReviewResource reviewResource : reviewResouces) {
                      "Content :"+reviewResource.getContent());
                                List<DiffComment> diffComments = reviewResource.getDiffComments();
                      "diffComments Size :"+diffComments.size());
                                for (DiffComment diffComment : diffComments) {
                              "diffComment :"+diffComment.getContent());


How to Use the JReviewBoardAPI

How to Use:

It was published only apis to read from Review Board. Just pass the review board(the project host).
ReviewBoardApi reviewBoardApi = new ReviewBoardApi("");
APIs Available so far:
public List<ReviewRequest> listAllReviewRequest(Date dateStart,Date dateEnd,String 
reviewStatus,String user,Integer maxResult) throws Exception
public List<ReviewRequest> listAllReviewRequestFull(Date dateStart,Date dateEnd,String reviewStatus,String user, Integer maxResult) throws Exception
public ReviewRequest getReviewRequest(ReviewRequest reviewRequest) throws Exception
public ReviewRequest getReviewRequest(Long reviewRequestId) throws Exception
public String executeApi(String api) throws Exception
public String executeApi(String api,Map<String,String> map) throws Exception
1.In the method(executeApi), you can pass the request parameters(fields) as described by Review Board Web API, see the example in the link. 2. You can accurate the results using these fields.


In case of development, you just need to checkout the code as a Java Project in Eclipse.

How download the JReviewBoardAPI Java Code

1. Download the Eclipse to work with the code:
  • Eclipse IDE for Java EE Developers - See the download link
    • Just extract the zip downloaded.
  • Install the SVN plugin in Eclipse to checkout the code.(This operation may takes some time, just follow the screens below).
    • Follow the screens below to install:

    • You will need to restart the eclipse to apply the changes.

    • You will need to restart the eclipse to apply the changes(Simple next to next is enough and restart again).
    • Now you need to add the repository to eclipse - add this link:
  • The code will be checkout as a java project inside eclipse. After that go the Java Perspective and you will see the project downloaded as displayed in the image below:
  • So easy, now you will be able to see the whole project. 

**For more information about the checkout, see the link below. 
Just checkout the code in source tab

JReviewBoardAPI - library binary + source code


This is a Java API to have access to Review Board( data. This API will allow the developer to read all reviews and comments. This APIS are not prepared to write in the review board.
The initial proposal is to getting all review information and then it makes available to collect metrics on that.

SUPPORT Review board 1.6.6


To checkout the source code:


Libraries needed: