xml.severity(severity)
xml.resource(resource.kee) if resource
xml.line(resource_line) if resource_line && resource_line>0
+ xml.violationId(rule_failure_permanent_id) if rule_failure_permanent_id
xml.comments do
review_comments.each do |comment|
xml.comment do
json['severity'] = severity
json['resource'] = resource.kee if resource
json['line'] = resource_line if resource_line && resource_line>0
+ json['violationId'] = rule_failure_permanent_id if rule_failure_permanent_id
comments = []
review_comments.each do |comment|
comments << {
private String resourceKee = null;
private Integer line = null;
private Boolean falsePositive = null;
+ private Long violationId;
private List<Review.Comment> comments = new ArrayList<Review.Comment>();
/**
this.falsePositive = falsePositive;
return this;
}
+
+ /**
+ * @since 2.9
+ * @return the violation id
+ */
+ public Long getViolationId() {
+ return violationId;
+ }
+
+ /**
+ * @param id
+ * the violation id to set
+ */
+ public Review setViolationId(Long violationId) {
+ this.violationId = violationId;
+ return this;
+ }
/**
* @return the comments
/**
* @since 2.9
*/
-public class ReviewCreateQuery extends UpdateQuery<Review> {
+public class ReviewCreateQuery extends CreateQuery<Review> {
private Long violationId;
private String text;
/**
* @since 2.9
*/
-public class ReviewDeleteQuery extends CreateQuery<Review> {
+public class ReviewDeleteQuery extends DeleteQuery<Review> {
private Long reviewId;
private Long commentId;
appendUrlParameter(url, "comment_id", getCommentId());
return url.toString();
}
-
- @Override
- public Class<Review> getModelClass() {
- return Review.class;
- }
}
return Review.class;
}
+ public static ReviewQuery createForReview(Long id) {
+ return new ReviewQuery().setId(id);
+ }
+
public static ReviewQuery createForResource(Resource resource) {
return new ReviewQuery().setResourceKeysOrIds(resource.getId().toString());
}
/**
* @since 2.9
*/
-public class ReviewUpdateQuery extends CreateQuery<Review> {
+public class ReviewUpdateQuery extends UpdateQuery<Review> {
private Long reviewId;
private String text;
review.setResourceKee(utils.getString(json, "resource"));
review.setLine(utils.getInteger(json, "line"));
review.setFalsePositive(utils.getBoolean(json, "falsePositive"));
+ review.setViolationId(utils.getLong(json, "violationId"));
review.setType(utils.getString(json, "type"));
Object comments = utils.getField(json, "comments");
public void testAddComment() {
ReviewDeleteQuery query = ReviewDeleteQuery.deleteCommentQuery(13L, 2L);
assertThat(query.getUrl(), is("/api/reviews/?id=13&comment_id=2&"));
- assertThat(query.getModelClass().getName(), is(Review.class.getName()));
}
}
\ No newline at end of file
assertThat(review.getSeverity(), is("MINOR"));
assertThat(review.getResourceKee(), is("org.codehaus.sonar:sonar-channel:org.sonar.channel.CodeReaderConfiguration"));
assertThat(review.getLine(), is(33));
+ assertThat(review.getViolationId(), is(1L));
List<Comment> comments = review.getComments();
assertThat(comments.size(), is(4));
Comment comment = comments.get(0);
-[{"id":3,"createdAt":"2011-04-26T15:44:42+0200","updatedAt":"2011-04-26T15:44:42+0200","author":"admin","assignee":"admin","title":"'static' modifier out of order with the JLS suggestions.","falsePositive":false,"status":"OPEN","severity":"MINOR","resource":"org.codehaus.sonar:sonar-channel:org.sonar.channel.CodeReaderConfiguration","line":33,"comments":[{"id":1,"author":"admin","updatedAt":"2011-04-26T15:44:42+0200","text":"This is a review.<br/>And this is on multiple lines...<br/><br/><code>Wouhou!!!!!</code>"},{"id":2,"author":"admin","updatedAt":"2011-04-26T17:10:19+0200","text":"<em>Bold on multiple line?</em>"},{"id":3,"author":"admin","updatedAt":"2011-04-26T17:11:02+0200","text":"And the bullets:<br/><ul><li>1 bullet</li>\n<li>2 bullets</li></ul>"},{"id":4,"author":"admin","updatedAt":"2011-04-26T17:27:37+0200","text":"Wazzaa"}]},{"id":9,"createdAt":"2011-04-27T14:37:20+0200","updatedAt":"2011-04-27T14:37:20+0200","author":"admin","title":"New exception is thrown in catch block, original stack trace may be lost","falsePositive":true,"status":"OPEN","severity":"MAJOR","resource":"org.codehaus.sonar:sonar-channel:org.sonar.channel.CodeReader","line":84,"comments":[{"id":5,"author":"admin","updatedAt":"2011-04-27T14:37:20+0200","text":"Wazzaaaa"}]}]
\ No newline at end of file
+[{"id":3,"createdAt":"2011-04-26T15:44:42+0200","updatedAt":"2011-04-26T15:44:42+0200","author":"admin","assignee":"admin","title":"'static' modifier out of order with the JLS suggestions.","falsePositive":false,"status":"OPEN","severity":"MINOR","resource":"org.codehaus.sonar:sonar-channel:org.sonar.channel.CodeReaderConfiguration","line":33,"violationId":1,"comments":[{"id":1,"author":"admin","updatedAt":"2011-04-26T15:44:42+0200","text":"This is a review.<br/>And this is on multiple lines...<br/><br/><code>Wouhou!!!!!</code>"},{"id":2,"author":"admin","updatedAt":"2011-04-26T17:10:19+0200","text":"<em>Bold on multiple line?</em>"},{"id":3,"author":"admin","updatedAt":"2011-04-26T17:11:02+0200","text":"And the bullets:<br/><ul><li>1 bullet</li>\n<li>2 bullets</li></ul>"},{"id":4,"author":"admin","updatedAt":"2011-04-26T17:27:37+0200","text":"Wazzaa"}]},{"id":9,"createdAt":"2011-04-27T14:37:20+0200","updatedAt":"2011-04-27T14:37:20+0200","author":"admin","title":"New exception is thrown in catch block, original stack trace may be lost","falsePositive":true,"status":"OPEN","severity":"MAJOR","resource":"org.codehaus.sonar:sonar-channel:org.sonar.channel.CodeReader","line":84,"violationId":2,"comments":[{"id":5,"author":"admin","updatedAt":"2011-04-27T14:37:20+0200","text":"Wazzaaaa"}]}]
\ No newline at end of file