From: Evgeny Mandrikov Date: Fri, 3 Feb 2012 07:56:29 +0000 (+0400) Subject: SONAR-3231 Allow to associate measure with committer X-Git-Tag: 2.14~187 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ddbe2f2a71212a98843ca9655f594ba34bf45ea6;p=sonarqube.git SONAR-3231 Allow to associate measure with committer * Fix hashCode and equals for RuleMeasure * Add RuleMeasure.getSeverity() --- diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/RuleMeasure.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/RuleMeasure.java index 923aea5f006..0da76ee17f2 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/RuleMeasure.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/RuleMeasure.java @@ -51,10 +51,21 @@ public class RuleMeasure extends Measure { return this; } + /** + * @deprecated since 2.14 use {@link #getSeverity()} instead. See SONAR-1829. + */ + @Deprecated public RulePriority getRulePriority() { return rulePriority; } + /** + * @since 2.14 + */ + public RulePriority getSeverity() { + return rulePriority; + } + /** * @deprecated since 2.14 use {@link #setSeverity()} instead. See SONAR-1829. */ @@ -101,6 +112,7 @@ public class RuleMeasure extends Measure { RuleMeasure other = (RuleMeasure) obj; return new EqualsBuilder() .append(getMetric(), other.getMetric()) + .append(committer, other.committer) .append(rule, other.rule) .isEquals(); } @@ -112,26 +124,28 @@ public class RuleMeasure extends Measure { @Override public int hashCode() { - return new HashCodeBuilder(17, 37). - append(getMetric()). - append(rule). - toHashCode(); + return new HashCodeBuilder(17, 37) + .append(getMetric()) + .append(committer) + .append(rule) + .toHashCode(); } @Override public String toString() { - return new ToStringBuilder(this). - append("id", getId()). - append("metric", metric). - append("rule", rule). - append("value", value). - append("data", data). - append("description", description). - append("alertStatus", alertStatus). - append("alertText", alertText). - append("tendency", tendency). - append("severity", rulePriority). - toString(); + return new ToStringBuilder(this) + .append("id", getId()) + .append("metric", metric) + .append("committer", committer) + .append("rule", rule) + .append("value", value) + .append("data", data) + .append("description", description) + .append("alertStatus", alertStatus) + .append("alertText", alertText) + .append("tendency", tendency) + .append("severity", rulePriority) + .toString(); } public static RuleMeasure createForRule(Metric metric, Rule rule, Double value) {