diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-06-25 18:58:09 +0200 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-06-26 09:40:24 +0200 |
commit | 87fac1a5010e2a01b4efee27eec7f5da2125c212 (patch) | |
tree | 9d6444d623e36aaf27e6d3281215abb2213ae879 /sonar-core | |
parent | 163630e0c9de6278cee233e2d79dfd21fbd9c2c0 (diff) | |
download | sonarqube-87fac1a5010e2a01b4efee27eec7f5da2125c212.tar.gz sonarqube-87fac1a5010e2a01b4efee27eec7f5da2125c212.zip |
SONAR-6615 ws custom_measures/search search for custom measures
Diffstat (limited to 'sonar-core')
4 files changed, 29 insertions, 4 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/measure/custom/db/CustomMeasureMapper.java b/sonar-core/src/main/java/org/sonar/core/measure/custom/db/CustomMeasureMapper.java index 444753996da..58bbb04b966 100644 --- a/sonar-core/src/main/java/org/sonar/core/measure/custom/db/CustomMeasureMapper.java +++ b/sonar-core/src/main/java/org/sonar/core/measure/custom/db/CustomMeasureMapper.java @@ -22,6 +22,7 @@ package org.sonar.core.measure.custom.db; import java.util.List; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.session.RowBounds; public interface CustomMeasureMapper { void insert(CustomMeasureDto customMeasure); @@ -38,5 +39,9 @@ public interface CustomMeasureMapper { List<CustomMeasureDto> selectByComponentUuid(String s); + List<CustomMeasureDto> selectByComponentUuid(String s, RowBounds rowBounds); + + int countByComponentUuid(String componentUuid); + int countByComponentIdAndMetricId(@Param("componentUuid") String componentUuid, @Param("metricId") int metricId); } diff --git a/sonar-core/src/main/java/org/sonar/core/metric/db/MetricMapper.java b/sonar-core/src/main/java/org/sonar/core/metric/db/MetricMapper.java index 7644057f92e..aea1761b828 100644 --- a/sonar-core/src/main/java/org/sonar/core/metric/db/MetricMapper.java +++ b/sonar-core/src/main/java/org/sonar/core/metric/db/MetricMapper.java @@ -28,8 +28,14 @@ import org.apache.ibatis.session.RowBounds; public interface MetricMapper { + MetricDto selectById(long id); + + List<MetricDto> selectByIds(@Param("ids") List<Integer> ids); + MetricDto selectByKey(@Param("key") String key); + List<MetricDto> selectByKeys(@Param("keys") List<String> keys); + List<MetricDto> selectAllEnabled(); List<MetricDto> selectAllEnabled(Map<String, Object> properties, RowBounds rowBounds); @@ -38,8 +44,6 @@ public interface MetricMapper { List<String> selectDomains(); - List<MetricDto> selectByKeys(@Param("keys") List<String> keys); - void disableByIds(@Param("ids") List<Integer> ids); void disableByKey(@Param("key") String key); @@ -48,8 +52,6 @@ public interface MetricMapper { void update(MetricDto metric); - MetricDto selectById(long id); - List<MetricDto> selectAvailableCustomMetricsByComponentUuid(String projectUuid); List<MetricDto> selectAvailableCustomMetricsByComponentKey(String projectKey); diff --git a/sonar-core/src/main/resources/org/sonar/core/measure/custom/db/CustomMeasureMapper.xml b/sonar-core/src/main/resources/org/sonar/core/measure/custom/db/CustomMeasureMapper.xml index e19060dbc1a..8d39aac0143 100644 --- a/sonar-core/src/main/resources/org/sonar/core/measure/custom/db/CustomMeasureMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/measure/custom/db/CustomMeasureMapper.xml @@ -69,6 +69,12 @@ where id=#{id} </delete> + <select id="countByComponentUuid" resultType="Integer"> + select count(*) + from manual_measures m + where m.component_uuid=#{componentUuid} + </select> + <select id="countByComponentIdAndMetricId" resultType="Integer"> select count(*) from manual_measures m diff --git a/sonar-core/src/main/resources/org/sonar/core/metric/db/MetricMapper.xml b/sonar-core/src/main/resources/org/sonar/core/metric/db/MetricMapper.xml index 3812362721b..f11d214d376 100644 --- a/sonar-core/src/main/resources/org/sonar/core/metric/db/MetricMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/metric/db/MetricMapper.xml @@ -140,6 +140,18 @@ </where> </select> + <select id="selectByIds" resultType="org.sonar.core.metric.db.MetricDto"> + SELECT + <include refid="metricColumns"/> + FROM metrics m + <where> + AND m.id in + <foreach item="id" collection="ids" open="(" separator="," close=")"> + #{id} + </foreach> + </where> + </select> + <select id="selectById" resultType="org.sonar.core.metric.db.MetricDto"> SELECT <include refid="metricColumns"/> |