aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-07-21 17:28:27 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2014-07-21 17:42:08 +0200
commit2b2c1f3bcfae1af11de717d395b0cdf702782a39 (patch)
tree343f51ecdbeb49841bd1db5db17728cefb6075b6 /sonar-batch
parent718952272eb780ecb2b3f613a0f0337bacff75f6 (diff)
downloadsonarqube-2b2c1f3bcfae1af11de717d395b0cdf702782a39.tar.gz
sonarqube-2b2c1f3bcfae1af11de717d395b0cdf702782a39.zip
SONAR-5417 Add additional metric attributes
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java13
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/measure/DeprecatedMetricFinder.java6
2 files changed, 18 insertions, 1 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java b/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java
index d0ada6e8b3c..558308bb8cb 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java
@@ -72,8 +72,19 @@ public class DefaultProjectReferentialsLoader implements ProjectReferentialsLoad
ProjectReferentials ref = new ProjectReferentials();
for (Metric m : sessionFactory.getSession().getResults(Metric.class, ENABLED, true)) {
Boolean optimizedBestValue = m.isOptimizedBestValue();
+ Boolean qualitative = m.getQualitative();
+ Boolean userManaged = m.getUserManaged();
ref.metrics().add(
- new org.sonar.batch.protocol.input.Metric(m.getId(), m.getKey(), m.getType().name(), m.getBestValue(), optimizedBestValue != null ? optimizedBestValue : false));
+ new org.sonar.batch.protocol.input.Metric(m.getId(), m.getKey(),
+ m.getType().name(),
+ m.getDescription(),
+ m.getDirection(),
+ m.getName(),
+ qualitative != null ? m.getQualitative() : false,
+ userManaged != null ? m.getUserManaged() : false,
+ m.getWorstValue(),
+ m.getBestValue(),
+ optimizedBestValue != null ? optimizedBestValue : false));
}
String defaultName = settings.getString(ModuleQProfiles.SONAR_PROFILE_PROP);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DeprecatedMetricFinder.java b/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DeprecatedMetricFinder.java
index b3e3f9cac18..3f1ab39668d 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DeprecatedMetricFinder.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DeprecatedMetricFinder.java
@@ -39,8 +39,14 @@ public final class DeprecatedMetricFinder implements MetricFinder {
for (org.sonar.batch.protocol.input.Metric metric : projectReferentials.metrics()) {
Metric hibernateMetric = new org.sonar.api.measures.Metric.Builder(metric.key(), metric.key(), ValueType.valueOf(metric.valueType()))
.create()
+ .setDirection(metric.direction())
+ .setQualitative(metric.isQualitative())
+ .setUserManaged(metric.isUserManaged())
+ .setDescription(metric.description())
+ .setName(metric.name())
.setOptimizedBestValue(metric.isOptimizedBestValue())
.setBestValue(metric.bestValue())
+ .setWorstValue(metric.worstValue())
.setId(metric.id());
metricsByKey.put(metric.key(), hibernateMetric);
metricsById.put(metric.id(), new org.sonar.api.measures.Metric.Builder(metric.key(), metric.key(), ValueType.valueOf(metric.valueType())).create().setId(metric.id()));