aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-12-06 14:12:57 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-12-06 14:12:57 +0000
commitc5749a967563442994ab3183c7ecc13fa4e6b1f1 (patch)
tree643a4701c039569cd7fc823f3e697d8a388c5175 /sonar-plugin-api/src
parentca79bd72bc11d542a33a3f92e3d9dda54a0c8477 (diff)
downloadsonarqube-c5749a967563442994ab3183c7ecc13fa4e6b1f1.tar.gz
sonarqube-c5749a967563442994ab3183c7ecc13fa4e6b1f1.zip
SONAR-249 add 2 periods for variation values + rename SNAPSHOT.VAR_xxx columns + fix saving of dependencies
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorBarriers.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java91
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java252
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java52
4 files changed, 292 insertions, 105 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorBarriers.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorBarriers.java
index 8fc96512794..3a2a02c1373 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorBarriers.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorBarriers.java
@@ -40,7 +40,7 @@ public interface DecoratorBarriers {
/**
* Any kinds of time machine data are calculated before this barrier. Decorators executed after this barrier can use
- * Measure#getDiffValueX() and Measure#getTendency() methods.
+ * Measure#getVariationValue() and Measure#getTendency() methods.
*
* @since 2.5
*/
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java
index e9833d626e9..276f6b919e8 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java
@@ -19,7 +19,9 @@
*/
package org.sonar.api.database.model;
+import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.measures.Metric;
import org.sonar.api.qualitymodel.Characteristic;
@@ -89,14 +91,20 @@ public class MeasureModel implements Cloneable {
@Column(name = "alert_text", updatable = true, nullable = true, length = 4000)
private String alertText;
- @Column(name = "diff_value_1", updatable = true, nullable = true)
- private Double diffValue1;
+ @Column(name = "variation_value_1", updatable = true, nullable = true)
+ private Double variationValue1;
- @Column(name = "diff_value_2", updatable = true, nullable = true)
- private Double diffValue2;
+ @Column(name = "variation_value_2", updatable = true, nullable = true)
+ private Double variationValue2;
- @Column(name = "diff_value_3", updatable = true, nullable = true)
- private Double diffValue3;
+ @Column(name = "variation_value_3", updatable = true, nullable = true)
+ private Double variationValue3;
+
+ @Column(name = "variation_value_4", updatable = true, nullable = true)
+ private Double variationValue4;
+
+ @Column(name = "variation_value_5", updatable = true, nullable = true)
+ private Double variationValue5;
@Column(name = "url", updatable = true, nullable = true, length = 2000)
private String url;
@@ -440,52 +448,47 @@ public class MeasureModel implements Cloneable {
@Override
public String toString() {
- return new ToStringBuilder(this).
- append("value", value).
- append("metricId", metricId).
- toString();
+ return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
}
- /**
- * @return diffValue1
- */
- public Double getDiffValue1() {
- return diffValue1;
+ public Double getVariationValue1() {
+ return variationValue1;
}
- /**
- * Sets the diffValue1
- */
- public void setDiffValue1(Double diffValue1) {
- this.diffValue1 = diffValue1;
+ public void setVariationValue1(Double d) {
+ this.variationValue1 = d;
}
- /**
- * @return diffValue2
- */
- public Double getDiffValue2() {
- return diffValue2;
+ public Double getVariationValue2() {
+ return variationValue2;
}
- /**
- * Sets the diffValue2
- */
- public void setDiffValue2(Double diffValue2) {
- this.diffValue2 = diffValue2;
+ public void setVariationValue2(Double d) {
+ this.variationValue2 = d;
}
- /**
- * @return diffValue3
- */
- public Double getDiffValue3() {
- return diffValue3;
+ public Double getVariationValue3() {
+ return variationValue3;
}
- /**
- * Sets the diffValue3
- */
- public void setDiffValue3(Double diffValue3) {
- this.diffValue3 = diffValue3;
+ public void setVariationValue3(Double d) {
+ this.variationValue3 = d;
+ }
+
+ public Double getVariationValue4() {
+ return variationValue4;
+ }
+
+ public void setVariationValue4(Double d) {
+ this.variationValue4 = d;
+ }
+
+ public Double getVariationValue5() {
+ return variationValue5;
+ }
+
+ public void setVariationValue5(Double d) {
+ this.variationValue5 = d;
}
/**
@@ -525,9 +528,11 @@ public class MeasureModel implements Cloneable {
clone.setAlertStatus(getAlertStatus());
clone.setAlertText(getAlertText());
clone.setTendency(getTendency());
- clone.setDiffValue1(getDiffValue1());
- clone.setDiffValue2(getDiffValue2());
- clone.setDiffValue3(getDiffValue3());
+ clone.setVariationValue1(getVariationValue1());
+ clone.setVariationValue2(getVariationValue2());
+ clone.setVariationValue3(getVariationValue3());
+ clone.setVariationValue4(getVariationValue4());
+ clone.setVariationValue5(getVariationValue5());
clone.setValue(getValue());
clone.setRulePriority(getRulePriority());
clone.setRuleId(getRuleId());
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java
index 9700f23d424..ab672911448 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java
@@ -21,7 +21,8 @@ package org.sonar.api.database.model;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
import org.sonar.api.database.BaseIdentifiable;
import org.sonar.api.database.DatabaseSession;
@@ -82,23 +83,35 @@ public class Snapshot extends BaseIdentifiable {
@Column(name = "root_project_id", updatable = true, nullable = true)
private Integer rootProjectId;
- @Column(name = "var_mode_1", updatable = true, nullable = true, length = 100)
- private String varMode1;
+ @Column(name = "variation_mode_1", updatable = true, nullable = true, length = 100)
+ private String variationMode1;
- @Column(name = "var_mode_2", updatable = true, nullable = true, length = 100)
- private String varMode2;
+ @Column(name = "variation_mode_2", updatable = true, nullable = true, length = 100)
+ private String variationMode2;
- @Column(name = "var_mode_3", updatable = true, nullable = true, length = 100)
- private String varMode3;
+ @Column(name = "variation_mode_3", updatable = true, nullable = true, length = 100)
+ private String variationMode3;
- @Column(name = "var_label_1", updatable = true, nullable = true, length = 100)
- private String varLabel1;
+ @Column(name = "variation_mode_4", updatable = true, nullable = true, length = 100)
+ private String variationMode4;
- @Column(name = "var_label_2", updatable = true, nullable = true, length = 100)
- private String varLabel2;
+ @Column(name = "variation_mode_5", updatable = true, nullable = true, length = 100)
+ private String variationMode5;
- @Column(name = "var_label_3", updatable = true, nullable = true, length = 100)
- private String varLabel3;
+ @Column(name = "variation_param_1", updatable = true, nullable = true, length = 100)
+ private String variationModeParam1;
+
+ @Column(name = "variation_param_2", updatable = true, nullable = true, length = 100)
+ private String variationModeParam2;
+
+ @Column(name = "variation_param_3", updatable = true, nullable = true, length = 100)
+ private String variationModeParam3;
+
+ @Column(name = "variation_param_4", updatable = true, nullable = true, length = 100)
+ private String variationModeParam4;
+
+ @Column(name = "variation_param_5", updatable = true, nullable = true, length = 100)
+ private String variationModeParam5;
public Snapshot() {
@@ -108,7 +121,7 @@ public class Snapshot extends BaseIdentifiable {
this.resourceId = resource.getId();
this.qualifier = resource.getQualifier();
this.scope = resource.getScope();
-
+
if (parent == null) {
path = "";
depth = 0;
@@ -278,60 +291,202 @@ public class Snapshot extends BaseIdentifiable {
this.depth = depth;
}
- public String getVarMode1() {
- return varMode1;
+ public String getVariationMode1() {
+ return variationMode1;
}
- public Snapshot setVarMode1(String varMode1) {
- this.varMode1 = varMode1;
+ /**
+ * For internal use.
+ *
+ * @since 2.5
+ */
+ public Snapshot setVariationMode1(String s) {
+ this.variationMode1 = s;
return this;
}
- public String getVarMode2() {
- return varMode2;
+ public String getVariationMode2() {
+ return variationMode2;
}
- public Snapshot setVarMode2(String varMode2) {
- this.varMode2 = varMode2;
+ /**
+ * For internal use.
+ *
+ * @since 2.5
+ */
+ public Snapshot setVariationMode2(String s) {
+ this.variationMode2 = s;
+ return this;
+ }
+
+ public String getVariationMode3() {
+ return variationMode3;
+ }
+
+ /**
+ * For internal use.
+ *
+ * @since 2.5
+ */
+ public Snapshot setVariationMode3(String s) {
+ this.variationMode3 = s;
return this;
}
- public String getVarMode3() {
- return varMode3;
+ public String getVariationMode4() {
+ return variationMode4;
}
- public Snapshot setVarMode3(String varMode3) {
- this.varMode3 = varMode3;
+ /**
+ * For internal use.
+ *
+ * @since 2.5
+ */
+ public Snapshot setVariationMode4(String s) {
+ this.variationMode4 = s;
return this;
}
- public String getVarLabel1() {
- return varLabel1;
+ public String getVariationMode5() {
+ return variationMode5;
}
- public Snapshot setVarLabel1(String varLabel1) {
- this.varLabel1 = varLabel1;
+ /**
+ * For internal use.
+ *
+ * @since 2.5
+ */
+ public Snapshot setVariationMode5(String s) {
+ this.variationMode5 = s;
return this;
}
- public String getVarLabel2() {
- return varLabel2;
+ public String getVariationModeParam1() {
+ return variationModeParam1;
}
- public Snapshot setVarLabel2(String varLabel2) {
- this.varLabel2 = varLabel2;
+ /**
+ * For internal use.
+ *
+ * @since 2.5
+ */
+ public Snapshot setVariationModeParam1(String s) {
+ this.variationModeParam1 = s;
return this;
}
- public String getVarLabel3() {
- return varLabel3;
+ public String getVariationModeParam2() {
+ return variationModeParam2;
}
- public Snapshot setVarLabel3(String varLabel3) {
- this.varLabel3 = varLabel3;
+ /**
+ * For internal use.
+ *
+ * @since 2.5
+ */
+ public Snapshot setVariationModeParam2(String s) {
+ this.variationModeParam2 = s;
return this;
}
+ public String getVariationModeParam3() {
+ return variationModeParam3;
+ }
+
+ /**
+ * For internal use.
+ *
+ * @since 2.5
+ */
+ public Snapshot setVariationModeParam3(String s) {
+ this.variationModeParam3 = s;
+ return this;
+ }
+
+ public String getVariationModeParam4() {
+ return variationModeParam4;
+ }
+
+ /**
+ * For internal use.
+ *
+ * @since 2.5
+ */
+ public Snapshot setVariationModeParam4(String s) {
+ this.variationModeParam4 = s;
+ return this;
+ }
+
+ public String getVariationModeParam5() {
+ return variationModeParam5;
+ }
+
+ /**
+ * For internal use.
+ *
+ * @since 2.5
+ */
+ public Snapshot setVariationModeParam5(String s) {
+ this.variationModeParam5 = s;
+ return this;
+ }
+
+ /**
+ * For internal use.
+ *
+ * @since 2.5
+ */
+ public Snapshot setVariationMode(int index, String s) {
+ switch(index) {
+ case 1: variationMode1 = s; break;
+ case 2: variationMode2 = s; break;
+ case 3: variationMode3 = s; break;
+ case 4: variationMode4 = s; break;
+ case 5: variationMode5 = s; break;
+ default: throw new IndexOutOfBoundsException("Index of Snapshot.variationMode is between 1 and 5");
+ }
+ return this;
+ }
+
+ public String getVariationMode(int index) {
+ switch(index) {
+ case 1: return variationMode1;
+ case 2: return variationMode2;
+ case 3: return variationMode3;
+ case 4: return variationMode4;
+ case 5: return variationMode5;
+ default: throw new IndexOutOfBoundsException("Index of Snapshot.variationMode is between 1 and 5");
+ }
+ }
+
+ /**
+ * For internal use.
+ *
+ * @since 2.5
+ */
+ public Snapshot setVariationModeParam(int index, String s) {
+ switch(index) {
+ case 1: variationModeParam1 = s; break;
+ case 2: variationModeParam2 = s; break;
+ case 3: variationModeParam3 = s; break;
+ case 4: variationModeParam4 = s; break;
+ case 5: variationModeParam5 = s; break;
+ default: throw new IndexOutOfBoundsException("Index of Snapshot.variationModeParam is between 1 and 5");
+ }
+ return this;
+ }
+
+ public String getVariationModeParam(int index) {
+ switch(index) {
+ case 1: return variationModeParam1;
+ case 2: return variationModeParam2;
+ case 3: return variationModeParam3;
+ case 4: return variationModeParam4;
+ case 5: return variationModeParam5;
+ default: throw new IndexOutOfBoundsException("Index of Snapshot.variationModeParam is between 1 and 5");
+ }
+ }
+
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Snapshot)) {
@@ -357,25 +512,6 @@ public class Snapshot extends BaseIdentifiable {
@Override
public String toString() {
- return new ToStringBuilder(this)
- .append("id", getId())
- .append("resourceId", resourceId)
- .append("scope", scope)
- .append("qualifier", qualifier)
- .append("version", version)
- .append("last", last)
- .append("createdAt", createdAt)
- .append("status", status)
- .append("path", path)
- .append("rootId", rootId)
- .append("rootProjectId", rootProjectId)
- .append("parentId", parentId)
- .append("varMode1", varMode1)
- .append("varLabel1", varLabel1)
- .append("varMode2", varMode2)
- .append("varLabel2", varLabel2)
- .append("varMode3", varMode3)
- .append("varLabel3", varLabel3)
- .toString();
+ return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
}
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
index bbfe922268d..949cc8aa2e1 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
@@ -49,7 +49,7 @@ public class Measure {
protected String alertText;
protected Integer tendency;
protected Date date;
- protected Double variation1, variation2, variation3;
+ protected Double variation1, variation2, variation3, variation4, variation5;
protected String url;
protected Characteristic characteristic;
protected PersistenceMode persistenceMode = PersistenceMode.FULL;
@@ -465,6 +465,42 @@ public class Measure {
}
/**
+ * @return the third variation value
+ * @since 2.5
+ */
+ public Double getVariation4() {
+ return variation4;
+ }
+
+ /**
+ * Internal use only
+ *
+ * @since 2.5
+ */
+ public Measure setVariation4(Double d) {
+ this.variation4 = d;
+ return this;
+ }
+
+ /**
+ * @return the third variation value
+ * @since 2.5
+ */
+ public Double getVariation5() {
+ return variation5;
+ }
+
+ /**
+ * Internal use only
+ *
+ * @since 2.5
+ */
+ public Measure setVariation5(Double d) {
+ this.variation5 = d;
+ return this;
+ }
+
+ /**
* @since 2.5
*/
public Double getVariation(int index) {
@@ -475,8 +511,12 @@ public class Measure {
return variation2;
case 3:
return variation3;
+ case 4:
+ return variation4;
+ case 5:
+ return variation5;
default:
- throw new IllegalArgumentException("Index should be in range from 1 to 3");
+ throw new IndexOutOfBoundsException("Index should be in range from 1 to 5");
}
}
@@ -496,8 +536,14 @@ public class Measure {
case 3:
variation3 = d;
break;
+ case 4:
+ variation4 = d;
+ break;
+ case 5:
+ variation5 = d;
+ break;
default:
- throw new IllegalArgumentException("Index should be in range from 1 to 3");
+ throw new IndexOutOfBoundsException("Index should be in range from 1 to 5");
}
return this;
}