aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java17
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java25
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java3
3 files changed, 42 insertions, 3 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 739c6dfc423..f63e730af76 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
@@ -27,6 +27,7 @@ import org.sonar.api.qualitymodel.Characteristic;
import org.sonar.api.rules.RulePriority;
import javax.persistence.*;
+
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -115,6 +116,9 @@ public class MeasureModel implements Cloneable {
@JoinColumn(name = "characteristic_id")
private Characteristic characteristic;
+ @Column(name = "committer", updatable = true, nullable = true, length = 100)
+ private String committer;
+
public Long getId() {
return id;
}
@@ -122,7 +126,7 @@ public class MeasureModel implements Cloneable {
public void setId(Long id) {
this.id = id;
}
-
+
/**
* Creates a measure based on a metric and a double value
*/
@@ -518,6 +522,15 @@ public class MeasureModel implements Cloneable {
return this;
}
+ public String getCommitter() {
+ return committer;
+ }
+
+ public MeasureModel setCommitter(String committer) {
+ this.committer = committer;
+ return this;
+ }
+
@Override
public Object clone() {
MeasureModel clone = new MeasureModel();
@@ -539,6 +552,8 @@ public class MeasureModel implements Cloneable {
clone.setMeasureDate(getMeasureDate());
clone.setUrl(getUrl());
clone.setCharacteristic(getCharacteristic());
+ clone.setCommitter(getCommitter());
return clone;
}
+
}
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 1b1c4134ecd..61497f07af3 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
@@ -19,6 +19,7 @@
*/
package org.sonar.api.measures;
+import com.google.common.annotations.Beta;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.sonar.api.qualitymodel.Characteristic;
@@ -52,6 +53,7 @@ public class Measure {
protected Double variation1, variation2, variation3, variation4, variation5;
protected String url;
protected Characteristic characteristic;
+ protected String committer;
protected PersistenceMode persistenceMode = PersistenceMode.FULL;
public Measure(String metricKey) {
@@ -329,7 +331,7 @@ public class Measure {
this.data=null;
return this;
}
-
+
/**
* @return the description of the measure
*/
@@ -593,6 +595,23 @@ public class Measure {
return this;
}
+ /**
+ * @since 2.14
+ */
+ @Beta
+ public String getCommitter() {
+ return committer;
+ }
+
+ /**
+ * @since 2.14
+ */
+ @Beta
+ public Measure setCommitter(String committer) {
+ this.committer = committer;
+ return this;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -609,6 +628,9 @@ public class Measure {
if (characteristic != null ? !characteristic.equals(measure.characteristic) : measure.characteristic != null) {
return false;
}
+ if (committer != null ? !committer.equals(measure.committer) : measure.committer != null) {
+ return false;
+ }
return true;
}
@@ -616,6 +638,7 @@ public class Measure {
public int hashCode() {
int result = metricKey != null ? metricKey.hashCode() : 0;
result = 31 * result + (characteristic != null ? characteristic.hashCode() : 0);
+ result = 31 * result + (committer != null ? committer.hashCode() : 0);
return result;
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java
index 9a975e48cbe..bf4e1964f15 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java
@@ -57,7 +57,8 @@ public final class MeasuresFilters {
for (Measure measure : measures) {
if (measure.getClass().equals(Measure.class) &&
measure.getMetricKey().equals(metricKey) &&
- measure.getCharacteristic() == null) {
+ measure.getCharacteristic() == null &&
+ measure.getCommitter() == null) {
return measure;
}
}