From 72a252ae0f8e6b6f9d54aade3188f4d6c9c2fcb7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Tue, 24 Nov 2015 14:16:57 +0100 Subject: [PATCH] SONAR-7027 add MeasureDao#selectBySnapshotAndMetrics --- .../java/org/sonar/db/measure/MeasureDao.java | 13 ++++++++ .../org/sonar/db/measure/MeasureMapper.java | 2 ++ .../org/sonar/db/measure/MeasureMapper.xml | 16 +++++++++ .../org/sonar/db/measure/MeasureDaoTest.java | 33 +++++++++++++++++++ 4 files changed, 64 insertions(+) diff --git a/sonar-db/src/main/java/org/sonar/db/measure/MeasureDao.java b/sonar-db/src/main/java/org/sonar/db/measure/MeasureDao.java index 13b27d68768..23458f0b882 100644 --- a/sonar-db/src/main/java/org/sonar/db/measure/MeasureDao.java +++ b/sonar-db/src/main/java/org/sonar/db/measure/MeasureDao.java @@ -93,6 +93,19 @@ public class MeasureDao implements Dao { }); } + /** + * Used by plugin Developer Cockpit + */ + public List selectBySnapshotAndMetrics(final DbSession dbSession, final long snapshotId, Collection metricIds) { + return DatabaseUtils.executeLargeInputs(metricIds, new Function, List>() { + @Override + @Nonnull + public List apply(@Nonnull List input) { + return mapper(dbSession).selectBySnapshotAndMetrics(snapshotId, input); + } + }); + } + public void insert(DbSession session, MeasureDto measureDto) { mapper(session).insert(measureDto); } diff --git a/sonar-db/src/main/java/org/sonar/db/measure/MeasureMapper.java b/sonar-db/src/main/java/org/sonar/db/measure/MeasureMapper.java index fc6debc0a62..a5b096001f8 100644 --- a/sonar-db/src/main/java/org/sonar/db/measure/MeasureMapper.java +++ b/sonar-db/src/main/java/org/sonar/db/measure/MeasureMapper.java @@ -34,6 +34,8 @@ public interface MeasureMapper { List selectByDeveloperForSnapshotAndMetrics(@Param("developerId") long developerId, @Param("snapshotId") long snapshotId, @Param("metricIds") List metricIds); + List selectBySnapshotAndMetrics(@Param("snapshotId") long snapshotId, @Param("metricIds") List input); + @CheckForNull MeasureDto selectByComponentAndMetric(@Param("componentKey") String componentKey, @Param("metricKey") String metricKey); diff --git a/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml b/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml index 7874e1e2d20..f2d22396374 100644 --- a/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml @@ -92,6 +92,22 @@ + +