aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2011-06-29 12:54:22 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2011-06-29 12:54:22 +0200
commit4415d64999d90301ad128afa5949c73a65bfd43d (patch)
tree05498dfcea07ae2589378af9c59d616060328a2d /sonar-batch
parent18b21f2ce809939ebfe25a31a4663526a1ad8b61 (diff)
downloadsonarqube-4415d64999d90301ad128afa5949c73a65bfd43d.tar.gz
sonarqube-4415d64999d90301ad128afa5949c73a65bfd43d.zip
SONAR-2553 API: compute the variations on all measures
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/components/PastMeasuresLoader.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/components/PastMeasuresLoader.java b/sonar-batch/src/main/java/org/sonar/batch/components/PastMeasuresLoader.java
index c4dd2a56dc0..994625b1281 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/components/PastMeasuresLoader.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/components/PastMeasuresLoader.java
@@ -66,8 +66,8 @@ public class PastMeasuresLoader implements BatchExtension {
}
public List<Object[]> getPastMeasures(String resourceKey, Snapshot projectPastSnapshot) {
- String sql = "select m.metric_id, m.characteristic_id, m.value from project_measures m, snapshots s" +
- " where m.snapshot_id=s.id and m.metric_id in (:metricIds) and m.rule_id is null and m.rule_priority is null " +
+ String sql = "select m.metric_id, m.characteristic_id, m.rule_id, m.rule_priority, m.value from project_measures m, snapshots s" +
+ " where m.snapshot_id=s.id and m.metric_id in (:metricIds) " +
" and (s.root_snapshot_id=:rootSnapshotId or s.id=:rootSnapshotId) and s.status=:status and s.project_id=(select p.id from projects p where p.kee=:resourceKey and p.qualifier<>:lib)";
return session.createNativeQuery(sql)
.setParameter("metricIds", metricByIds.keySet())
@@ -89,11 +89,23 @@ public class PastMeasuresLoader implements BatchExtension {
return number!=null ? number.intValue() : null;
}
+ public static Integer getRuleId(Object[] row) {
+ // can be BigDecimal on Oracle
+ Number number = (Number) row[2];
+ return number!=null ? number.intValue() : null;
+ }
+
+ public static Integer getSeverityId(Object[] row) {
+ // can be BigDecimal on Oracle
+ Number number = (Number) row[3];
+ return number!=null ? number.intValue() : null;
+ }
+
public static boolean hasValue(Object[] row) {
- return row[2] != null;
+ return row[4] != null;
}
public static double getValue(Object[] row) {
- return ((Number) row[2]).doubleValue();
+ return ((Number) row[4]).doubleValue();
}
}