From: Sébastien Lesaint Date: Tue, 19 Jan 2016 15:39:39 +0000 (+0100) Subject: add MeasureDao.selectProjectMeasuresByDeveloperForMetrics X-Git-Tag: 5.4-M9~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=59c1b3d49a6f4c43ebfadd1310e7bea52c911a99;p=sonarqube.git add MeasureDao.selectProjectMeasuresByDeveloperForMetrics --- 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 eb82353aaa2..61c95ebb10c 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 @@ -105,6 +105,9 @@ public class MeasureDao implements Dao { }); } + /** + * Used by plugin Developer Cockpit + */ public List selectBySnapshotIdsAndMetricIds(final DbSession dbSession, List snapshotIds, final List metricIds) { return DatabaseUtils.executeLargeInputs(snapshotIds, new Function, List>() { @Override @@ -115,6 +118,16 @@ public class MeasureDao implements Dao { }); } + /** + * Retrieves all measures associated to a specific developer and to the last snapshot of any project. + * property {@link MeasureDto#componentId} of the returned objects is populated + * + * Used by Developer Cockpit + */ + public List selectProjectMeasuresByDeveloperForMetrics(DbSession dbSession, long developerId, Collection metricIds) { + return mapper(dbSession).selectProjectMeasuresByDeveloperForMetrics(developerId, metricIds); + } + 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 996d765c5fd..82bf90bd0f1 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 @@ -19,6 +19,7 @@ */ package org.sonar.db.measure; +import java.util.Collection; import java.util.List; import javax.annotation.CheckForNull; import org.apache.ibatis.annotations.Param; @@ -38,6 +39,8 @@ public interface MeasureMapper { List selectBySnapshotIdsAndMetricIds(@Param("snapshotIds") List snapshotIds, @Param("metricIds") List metricIds); + List selectProjectMeasuresByDeveloperForMetrics(@Param("developerId") long developerId, @Param("metricIds") Collection metricIds); + @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 ed8a80b3f70..93a1fa7c7d8 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 @@ -112,6 +112,24 @@ + +