From 58cd42e65eb6c0d510f868b0d7fa8761de4651dc Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lievremont Date: Wed, 12 Mar 2014 15:49:28 +0100 Subject: SONAR-5094 Add ability to fetch quality gate failure text on measures --- .../java/org/sonar/wsclient/services/Measure.java | 22 ++++++++++++++++++++++ .../org/sonar/wsclient/services/ResourceQuery.java | 11 +++++++++++ .../unmarshallers/ResourceUnmarshaller.java | 2 ++ 3 files changed, 35 insertions(+) (limited to 'sonar-ws-client/src/main/java') diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Measure.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Measure.java index 6d887eea50e..3d40a55e9a5 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Measure.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Measure.java @@ -30,6 +30,8 @@ public class Measure extends Model { private String metricName; private Double value; private String formattedValue; + private String alertStatus; + private String alertText; private String data; private String characteristicKey; private String characteristicName; @@ -113,6 +115,26 @@ public class Measure extends Model { return this; } + @CheckForNull + public String getAlertStatus() { + return alertStatus; + } + + public Measure setAlertStatus(@Nullable String alertStatus) { + this.alertStatus = alertStatus; + return this; + } + + @CheckForNull + public String getAlertText() { + return alertText; + } + + public Measure setAlertText(@Nullable String alertText) { + this.alertText = alertText; + return this; + } + @CheckForNull public String getData() { return data; diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java index a7449960d81..a6ea0cbbf33 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java @@ -38,6 +38,7 @@ public class ResourceQuery extends Query { private boolean excludeRules = true; private boolean excludeRuleSeverities = true; private Boolean includeTrends = null; + private Boolean includeAlerts = null; private Boolean verbose = Boolean.FALSE; public ResourceQuery() { @@ -260,6 +261,15 @@ public class ResourceQuery extends Query { return this; } + public Boolean isIncludeAlerts() { + return includeAlerts; + } + + public ResourceQuery setIncludeAlerts(Boolean includeAlerts) { + this.includeAlerts = includeAlerts; + return this; + } + @Override public String getUrl() { StringBuilder url = new StringBuilder(BASE_URL); @@ -275,6 +285,7 @@ public class ResourceQuery extends Query { appendUrlParameter(url, "includetrends", includeTrends); appendUrlParameter(url, "characteristics", characteristicKeys); appendUrlParameter(url, "languages", languages); + appendUrlParameter(url, "includealerts", includeAlerts); appendUrlParameter(url, "verbose", verbose); return url.toString(); } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ResourceUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ResourceUnmarshaller.java index ca91f9995c3..e216ced6137 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ResourceUnmarshaller.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ResourceUnmarshaller.java @@ -98,6 +98,8 @@ public class ResourceUnmarshaller extends AbstractUnmarshaller { .setMetricName(utils.getString(json, "name")) .setValue(utils.getDouble(json, "val")) .setFormattedValue(utils.getString(json, "frmt_val")) + .setAlertStatus(utils.getString(json, "alert")) + .setAlertText(utils.getString(json, "alert_text")) .setTrend(utils.getInteger(json, "trend")) .setVar(utils.getInteger(json, "var")) .setData(utils.getString(json, "data")) -- cgit v1.2.3