aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/main
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-03-18 09:17:50 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2015-03-18 09:18:46 +0100
commit8f376a0a64dac99cfddfafcded66445997a65670 (patch)
treec85216945eef38babfc84a77daec32c0077b27c5 /sonar-plugin-api/src/main
parentdd574e51443d8c9dc64aa7d889f7f6f1281d9ec5 (diff)
parentd8bc34c28c0b81ad685ac66e63e362a7ed29e8a1 (diff)
downloadsonarqube-8f376a0a64dac99cfddfafcded66445997a65670.tar.gz
sonarqube-8f376a0a64dac99cfddfafcded66445997a65670.zip
Merge branch-5.1
Diffstat (limited to 'sonar-plugin-api/src/main')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java42
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java6
-rw-r--r--sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureMapper.xml4
3 files changed, 8 insertions, 44 deletions
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 dc5847f7564..fdf32504847 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
@@ -30,10 +30,6 @@ import org.sonar.api.rules.RulePriority;
import javax.persistence.*;
import java.io.UnsupportedEncodingException;
-import java.util.Date;
-
-import static org.sonar.api.utils.DateUtils.dateToLong;
-import static org.sonar.api.utils.DateUtils.longToDate;
/**
* This class is the Hibernate model to store a measure in the DB
@@ -70,9 +66,6 @@ public class MeasureModel implements Cloneable {
@Column(name = "description", updatable = true, nullable = true, length = 4000)
private String description;
- @Column(name = "measure_date", updatable = true, nullable = true)
- private Long measureDate;
-
@Column(name = "rule_id", updatable = true, nullable = true)
private Integer ruleId;
@@ -306,40 +299,6 @@ public class MeasureModel implements Cloneable {
}
/**
- * @return the date of the measure
- */
- public Date getMeasureDate() {
- return longToDate(measureDate);
- }
-
- /**
- * Sets the date for the measure
- *
- * @return the current object
- */
- public MeasureModel setMeasureDate(Date measureDate) {
- this.measureDate = dateToLong(measureDate);
- return this;
- }
-
- /**
- * @return the date of the measure
- */
- public Long getMeasureDateMs() {
- return measureDate;
- }
-
- /**
- * Sets the date for the measure
- *
- * @return the current object
- */
- public MeasureModel setMeasureDateMs(Long measureDate) {
- this.measureDate = measureDate;
- return this;
- }
-
- /**
* @return the alert status if there is one, null otherwise
*/
public Metric.Level getAlertStatus() {
@@ -519,7 +478,6 @@ public class MeasureModel implements Cloneable {
clone.setRulePriority(getRulePriority());
clone.setRuleId(getRuleId());
clone.setSnapshotId(getSnapshotId());
- clone.setMeasureDate(getMeasureDate());
clone.setUrl(getUrl());
clone.setCharacteristicId(getCharacteristicId());
clone.setPersonId(getPersonId());
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java
index f8645826374..8d231bcc1a5 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java
@@ -22,6 +22,7 @@ package org.sonar.api.utils.text;
import org.sonar.api.utils.DateUtils;
import javax.annotation.Nullable;
+
import java.io.Writer;
import java.util.Date;
import java.util.Map;
@@ -69,6 +70,11 @@ public class JsonWriter {
return new JsonWriter(writer);
}
+ public JsonWriter setSerializeNulls(boolean b) {
+ this.stream.setSerializeNulls(b);
+ return this;
+ }
+
/**
* Begins encoding a new array. Each call to this method must be paired with
* a call to {@link #endArray}. Output is <code>[</code>.
diff --git a/sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureMapper.xml b/sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureMapper.xml
index 66b00baacae..1bf6e453f64 100644
--- a/sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureMapper.xml
+++ b/sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureMapper.xml
@@ -5,12 +5,12 @@
<insert id="insert" parameterType="MeasureModel" useGeneratedKeys="false">
INSERT INTO project_measures (
- value, metric_id, snapshot_id, rule_id, text_value, tendency, measure_date,
+ value, metric_id, snapshot_id, rule_id, text_value, tendency,
project_id, alert_status, alert_text, url, description, rule_priority, characteristic_id, variation_value_1,
variation_value_2, variation_value_3, variation_value_4, variation_value_5, person_id, measure_data)
VALUES (
#{value, jdbcType=DOUBLE}, #{metricId, jdbcType=INTEGER}, #{snapshotId, jdbcType=INTEGER}, #{ruleId, jdbcType=INTEGER}, #{textValue, jdbcType=VARCHAR}, #{tendency, jdbcType=INTEGER},
- #{measureDateMs, jdbcType=BIGINT}, #{projectId, jdbcType=INTEGER}, #{alertStatus, jdbcType=VARCHAR}, #{alertText, jdbcType=VARCHAR},
+ #{projectId, jdbcType=INTEGER}, #{alertStatus, jdbcType=VARCHAR}, #{alertText, jdbcType=VARCHAR},
#{url, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR}, #{rulePriority.ordinal, jdbcType=INTEGER}, #{characteristicId, jdbcType=INTEGER}, #{variationValue1, jdbcType=DOUBLE},
#{variationValue2, jdbcType=DOUBLE}, #{variationValue3, jdbcType=DOUBLE}, #{variationValue4, jdbcType=DOUBLE}, #{variationValue5, jdbcType=DOUBLE}, #{personId, jdbcType=INTEGER}, #{data}
)