aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client/src/main/java/org/sonar
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-12-15 14:35:33 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-12-15 14:35:33 +0000
commit9e75d602fcaf9975d945224ec1548a143c77c5b3 (patch)
treec105fa4d23614bfdfd7ec9594ea88d8764b212e2 /sonar-ws-client/src/main/java/org/sonar
parentdfbfcb1f08d1c8ab26e786f508f98958f178aee3 (diff)
downloadsonarqube-9e75d602fcaf9975d945224ec1548a143c77c5b3.tar.gz
sonarqube-9e75d602fcaf9975d945224ec1548a143c77c5b3.zip
SONAR-249 rename FILTERS.VARIATION_INDEX to FILTERS.PERIOD_INDEX + support variations in the resources web service + add IT
Diffstat (limited to 'sonar-ws-client/src/main/java/org/sonar')
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/Measure.java82
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/Resource.java232
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ResourceUnmarshaller.java24
3 files changed, 335 insertions, 3 deletions
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 ca9d1879206..7679100cd56 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
@@ -44,6 +44,8 @@ public class Measure extends Model {
*/
private String ruleCategory;
+ private Double variation1, variation2, variation3, variation4, variation5;
+
public String getMetricKey() {
return metricKey;
}
@@ -223,6 +225,86 @@ public class Measure extends Model {
return this;
}
+ /**
+ * Variation value on period 1. The value is loaded if ResourceQuery#setIncludeTrends() is set to true.
+ * @since 2.5
+ */
+ public Double getVariation1() {
+ return variation1;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Measure setVariation1(Double variation1) {
+ this.variation1 = variation1;
+ return this;
+ }
+
+ /**
+ * Variation value on period 2. The value is loaded if ResourceQuery#setIncludeTrends() is set to true.
+ * @since 2.5
+ */
+ public Double getVariation2() {
+ return variation2;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Measure setVariation2(Double variation2) {
+ this.variation2 = variation2;
+ return this;
+ }
+
+ /**
+ * Variation value on period 3. The value is loaded if ResourceQuery#setIncludeTrends() is set to true.
+ * @since 2.5
+ */
+ public Double getVariation3() {
+ return variation3;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Measure setVariation3(Double variation3) {
+ this.variation3 = variation3;
+ return this;
+ }
+
+ /**
+ * Variation value on period 4. The value is loaded if ResourceQuery#setIncludeTrends() is set to true.
+ * @since 2.5
+ */
+ public Double getVariation4() {
+ return variation4;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Measure setVariation4(Double variation4) {
+ this.variation4 = variation4;
+ return this;
+ }
+
+ /**
+ * Variation value on period 5. The value is loaded if ResourceQuery#setIncludeTrends() is set to true.
+ * @since 2.5
+ */
+ public Double getVariation5() {
+ return variation5;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Measure setVariation5(Double variation5) {
+ this.variation5 = variation5;
+ return this;
+ }
+
@Override
public String toString() {
return new StringBuilder().append("Measure{")
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Resource.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Resource.java
index 27f6ba6b209..6df1d4d744b 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Resource.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Resource.java
@@ -29,7 +29,7 @@ public class Resource extends Model {
public static final String SCOPE_SET = "PRJ";
public static final String SCOPE_SPACE = "DIR";
public static final String SCOPE_ENTITY = "FIL";
-
+
/* QUALIFIERS */
public static final String QUALIFIER_VIEW = "VW";
public static final String QUALIFIER_SUBVIEW = "SVW";
@@ -58,6 +58,11 @@ public class Resource extends Model {
private Date date;
private List<Measure> measures;
+ // periods used for variations and tracking of violations
+ private String period1Mode, period2Mode, period3Mode, period4Mode, period5Mode;
+ private String period1Param, period2Param, period3Param, period4Param, period5Param;
+ private Date period1Date, period2Date, period3Date, period4Date, period5Date;
+
public Integer getId() {
return id;
}
@@ -208,6 +213,231 @@ public class Resource extends Model {
this.measures = measures;
}
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public String getPeriod1Mode() {
+ return period1Mode;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod1Mode(String period1Mode) {
+ this.period1Mode = period1Mode;
+ return this;
+ }
+
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public String getPeriod2Mode() {
+ return period2Mode;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod2Mode(String period2Mode) {
+ this.period2Mode = period2Mode;
+ return this;
+ }
+
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public String getPeriod3Mode() {
+ return period3Mode;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod3Mode(String period3Mode) {
+ this.period3Mode = period3Mode;
+ return this;
+ }
+
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public String getPeriod4Mode() {
+ return period4Mode;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod4Mode(String period4Mode) {
+ this.period4Mode = period4Mode;
+ return this;
+ }
+
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public String getPeriod5Mode() {
+ return period5Mode;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod5Mode(String period5Mode) {
+ this.period5Mode = period5Mode;
+ return this;
+ }
+
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public String getPeriod1Param() {
+ return period1Param;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod1Param(String period1Param) {
+ this.period1Param = period1Param;
+ return this;
+ }
+
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public String getPeriod2Param() {
+ return period2Param;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod2Param(String period2Param) {
+ this.period2Param = period2Param;
+ return this;
+ }
+
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public String getPeriod3Param() {
+ return period3Param;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod3Param(String period3Param) {
+ this.period3Param = period3Param;
+ return this;
+ }
+
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public String getPeriod4Param() {
+ return period4Param;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod4Param(String period4Param) {
+ this.period4Param = period4Param;
+ return this;
+ }
+
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public String getPeriod5Param() {
+ return period5Param;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod5Param(String period5Param) {
+ this.period5Param = period5Param;
+ return this;
+ }
+
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public Date getPeriod1Date() {
+ return period1Date;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod1Date(Date period1Date) {
+ this.period1Date = period1Date;
+ return this;
+ }
+
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public Date getPeriod2Date() {
+ return period2Date;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod2Date(Date period2Date) {
+ this.period2Date = period2Date;
+ return this;
+ }
+
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public Date getPeriod3Date() {
+ return period3Date;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod3Date(Date period3Date) {
+ this.period3Date = period3Date;
+ return this;
+ }
+
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public Date getPeriod4Date() {
+ return period4Date;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod4Date(Date period4Date) {
+ this.period4Date = period4Date;
+ return this;
+ }
+
+ /**
+ * @since 2.5 only on projects, else null
+ */
+ public Date getPeriod5Date() {
+ return period5Date;
+ }
+
+ /**
+ * @since 2.5
+ */
+ public Resource setPeriod5Date(Date period5Date) {
+ this.period5Date = period5Date;
+ return this;
+ }
+
@Override
public String toString() {
return new StringBuilder()
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 81b86cd8b12..fba424d4bbe 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
@@ -47,7 +47,22 @@ public class ResourceUnmarshaller extends AbstractUnmarshaller<Resource> {
.setLanguage(JsonUtils.getString(json, "lang"))
.setDescription(JsonUtils.getString(json, "description"))
.setDate(JsonUtils.getDateTime(json, "date"))
- .setVersion(JsonUtils.getString(json, "version"));
+ .setVersion(JsonUtils.getString(json, "version"))
+ .setPeriod1Mode(JsonUtils.getString(json, "p1"))
+ .setPeriod1Param(JsonUtils.getString(json, "p1p"))
+ .setPeriod1Date(JsonUtils.getDateTime(json, "p1d"))
+ .setPeriod2Mode(JsonUtils.getString(json, "p2"))
+ .setPeriod2Param(JsonUtils.getString(json, "p2p"))
+ .setPeriod2Date(JsonUtils.getDateTime(json, "p2d"))
+ .setPeriod3Mode(JsonUtils.getString(json, "p3"))
+ .setPeriod3Param(JsonUtils.getString(json, "p3p"))
+ .setPeriod3Date(JsonUtils.getDateTime(json, "p3d"))
+ .setPeriod4Mode(JsonUtils.getString(json, "p4"))
+ .setPeriod4Param(JsonUtils.getString(json, "p4p"))
+ .setPeriod4Date(JsonUtils.getDateTime(json, "p4d"))
+ .setPeriod5Mode(JsonUtils.getString(json, "p5"))
+ .setPeriod5Param(JsonUtils.getString(json, "p5p"))
+ .setPeriod5Date(JsonUtils.getDateTime(json, "p5d"));
}
private void parseMeasures(JSONObject json, Resource resource) {
@@ -85,7 +100,12 @@ public class ResourceUnmarshaller extends AbstractUnmarshaller<Resource> {
.setRuleCategory(JsonUtils.getString(json, "rule_category"))
.setRuleSeverity(JsonUtils.getString(json, "rule_priority"))
.setCharacteristicKey(JsonUtils.getString(json, "ctic_key"))
- .setCharacteristicName(JsonUtils.getString(json, "ctic_name"));
+ .setCharacteristicName(JsonUtils.getString(json, "ctic_name"))
+ .setVariation1(JsonUtils.getDouble(json, "var1"))
+ .setVariation2(JsonUtils.getDouble(json, "var2"))
+ .setVariation3(JsonUtils.getDouble(json, "var3"))
+ .setVariation4(JsonUtils.getDouble(json, "var4"))
+ .setVariation5(JsonUtils.getDouble(json, "var5"));
return measure;
}
}