aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client/src/main
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2011-05-26 12:10:38 +0200
committerFabrice Bellingard <bellingard@gmail.com>2011-05-26 13:49:26 +0200
commitf769fb5f2e558c027c92b87c5ad989913793d224 (patch)
tree397947cb9b20057e44afe6cba4d1d20a0198ba4f /sonar-ws-client/src/main
parent235d3e745d68bf549ce0c5353d76f936572f7c93 (diff)
downloadsonarqube-f769fb5f2e558c027c92b87c5ad989913793d224.tar.gz
sonarqube-f769fb5f2e558c027c92b87c5ad989913793d224.zip
SONAR-2453 Update the way "FALSE-POSITIVE" reviews are managed
1- Update the DB, migration scripts & co. 2- Update the model, controller & co. 3- Update the WS Client
Diffstat (limited to 'sonar-ws-client/src/main')
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/Review.java27
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java65
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshaller.java3
3 files changed, 79 insertions, 16 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Review.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Review.java
index eef8c5a475b..91c84411c83 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Review.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Review.java
@@ -39,6 +39,7 @@ public class Review extends Model {
private String severity = null;
private String resourceKee = null;
private Integer line = null;
+ private Boolean falsePositive = null;
private List<Review.Comment> comments = new ArrayList<Review.Comment>();
/**
@@ -138,6 +139,7 @@ public class Review extends Model {
}
/**
+ * @deprecated since 2.9. Use {@link #getFalsePositive()} instead.
* @return the type
*/
public String getType() {
@@ -145,11 +147,18 @@ public class Review extends Model {
}
/**
+ * @deprecated since 2.9. Use {@link #setFalsePositive(Boolean)} instead.
* @param s
* the type to set
*/
public Review setType(String s) {
this.type = s;
+ // the following code is only here to ensure backward compatibility with 2.8
+ if ("FALSE_POSITIVE".equals(type)) {
+ falsePositive = Boolean.TRUE;
+ } else if ("VIOLATION".equals(type)) {
+ falsePositive = Boolean.FALSE;
+ }
return this;
}
@@ -218,6 +227,24 @@ public class Review extends Model {
}
/**
+ * @since 2.9
+ * @return the falsePositive
+ */
+ public Boolean getFalsePositive() {
+ return falsePositive;
+ }
+
+ /**
+ * @since 2.9
+ * @param falsePositive
+ * true if false positive
+ */
+ public Review setFalsePositive(Boolean falsePositive) {
+ this.falsePositive = falsePositive;
+ return this;
+ }
+
+ /**
* @return the comments
*/
public List<Review.Comment> getComments() {
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java
index dda32f50a08..a6701d4a18e 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java
@@ -29,6 +29,7 @@ public class ReviewQuery extends Query<Review> {
public static final String OUTPUT_PLAIN = "PLAIN";
public static final String OUTPUT_HTML = "HTML";
+ @Deprecated
private String reviewType;
private Long id;
private Long[] ids;
@@ -39,18 +40,21 @@ public class ReviewQuery extends Query<Review> {
private String[] authorLoginsOrIds;
private String[] assigneeLoginsOrIds;
private String output;
+ private String falsePositives;
public ReviewQuery() {
}
/**
- * @return the reviewType
+ * @deprecated since 2.9
+ * @return NULL
*/
public String getReviewType() {
return reviewType;
}
/**
+ * @deprecated since 2.9
* @param reviewType
* the reviewType to set
*/
@@ -122,8 +126,7 @@ public class ReviewQuery extends Query<Review> {
this.severities = severities;
return this;
}
-
-
+
/**
* @return the projectKeysOrIds
*/
@@ -131,16 +134,15 @@ public class ReviewQuery extends Query<Review> {
return projectKeysOrIds;
}
-
/**
- * @param projectKeysOrIds the projectKeysOrIds to set
+ * @param projectKeysOrIds
+ * the projectKeysOrIds to set
*/
public ReviewQuery setProjectKeysOrIds(String... projectKeysOrIds) {
this.projectKeysOrIds = projectKeysOrIds;
return this;
}
-
/**
* @return the resourceKeysOrIds
*/
@@ -148,16 +150,15 @@ public class ReviewQuery extends Query<Review> {
return resourceKeysOrIds;
}
-
/**
- * @param resourceKeysOrIds the resourceKeysOrIds to set
+ * @param resourceKeysOrIds
+ * the resourceKeysOrIds to set
*/
public ReviewQuery setResourceKeysOrIds(String... resourceKeysOrIds) {
this.resourceKeysOrIds = resourceKeysOrIds;
return this;
}
-
/**
* @return the authorLoginsOrIds
*/
@@ -165,16 +166,15 @@ public class ReviewQuery extends Query<Review> {
return authorLoginsOrIds;
}
-
/**
- * @param authorLoginsOrIds the authorLoginsOrIds to set
+ * @param authorLoginsOrIds
+ * the authorLoginsOrIds to set
*/
public ReviewQuery setAuthorLoginsOrIds(String... authorLoginsOrIds) {
this.authorLoginsOrIds = authorLoginsOrIds;
return this;
}
-
/**
* @return the assigneeLoginsOrIds
*/
@@ -182,9 +182,9 @@ public class ReviewQuery extends Query<Review> {
return assigneeLoginsOrIds;
}
-
/**
- * @param assigneeLoginsOrIds the assigneeLoginsOrIds to set
+ * @param assigneeLoginsOrIds
+ * the assigneeLoginsOrIds to set
*/
public ReviewQuery setAssigneeLoginsOrIds(String... assigneeLoginsOrIds) {
this.assigneeLoginsOrIds = assigneeLoginsOrIds;
@@ -198,11 +198,42 @@ public class ReviewQuery extends Query<Review> {
return output;
}
+ /**
+ *
+ * @param output
+ * the output
+ */
public ReviewQuery setOutput(String output) {
this.output = output;
return this;
}
+ /**
+ * @since 2.9
+ * @return the false_positives
+ */
+ public String getFalsePositives() {
+ return falsePositives;
+ }
+
+ /**
+ * Sets the 'false_positives' parameter that can be:
+ * <ul>
+ * <li>only</li>
+ * <li>with</li>
+ * <li>without</li>
+ * </ul>
+ * , 'with' being the default one on the server side. <br>
+ * <br>
+ *
+ * @since 2.9
+ * @param falsePositives
+ * the false_positives
+ */
+ public void setFalsePositives(String falsePositives) {
+ this.falsePositives = falsePositives;
+ }
+
@Override
public String getUrl() {
StringBuilder url = new StringBuilder(BASE_URL);
@@ -212,7 +243,6 @@ public class ReviewQuery extends Query<Review> {
} else if (ids != null) {
appendUrlParameter(url, "ids", ids);
}
- appendUrlParameter(url, "review_type", reviewType);
appendUrlParameter(url, "statuses", statuses);
appendUrlParameter(url, "severities", severities);
appendUrlParameter(url, "projects", projectKeysOrIds);
@@ -220,6 +250,11 @@ public class ReviewQuery extends Query<Review> {
appendUrlParameter(url, "authors", authorLoginsOrIds);
appendUrlParameter(url, "assignees", assigneeLoginsOrIds);
appendUrlParameter(url, "output", output);
+ appendUrlParameter(url, "false_positives", falsePositives);
+ if (falsePositives == null && reviewType != null) {
+ // Use of the 2.8 deprecated API: handle backward compatibility
+ appendUrlParameter(url, "review_type", reviewType);
+ }
return url.toString();
}
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshaller.java
index cdaf3c2bb63..449d45b3f3b 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshaller.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshaller.java
@@ -38,11 +38,12 @@ public class ReviewUnmarshaller extends AbstractUnmarshaller<Review> {
review.setAuthorLogin(utils.getString(json, "author"));
review.setAssigneeLogin(utils.getString(json, "assignee"));
review.setTitle(utils.getString(json, "title"));
- review.setType(utils.getString(json, "type"));
review.setStatus(utils.getString(json, "status"));
review.setSeverity(utils.getString(json, "severity"));
review.setResourceKee(utils.getString(json, "resource"));
review.setLine(utils.getInteger(json, "line"));
+ review.setFalsePositive(utils.getBoolean(json, "falsePositive"));
+ review.setType(utils.getString(json, "type"));
Object comments = utils.getField(json, "comments");
if (comments != null) {