From 2b1e236fa390e079bb4277b93b2dc9be25a77c5b Mon Sep 17 00:00:00 2001 From: Belen Pruvost Date: Tue, 29 Jun 2021 15:18:15 +0200 Subject: [PATCH] SONAR-14605 - Make rule name consistent --- .../main/java/org/sonar/db/rule/RuleDao.java | 7 ++++ .../java/org/sonar/db/rule/RuleMapper.java | 2 ++ .../org/sonar/db/rule/RuleMapper.xml | 26 ++++++++++++++ .../java/org/sonar/db/rule/RuleDaoTest.java | 14 ++++++++ .../sonar/server/issue/index/IssueIndex.java | 1 - .../server/issue/index/IssueQueryFactory.java | 22 +++++++++++- .../issue/index/IssueQueryFactoryTest.java | 19 +++++++++- .../server/issue/ws/SearchResponseFormat.java | 8 ++++- .../server/issue/ws/SearchResponseLoader.java | 26 +++++++++++++- .../server/issue/ws/SearchActionTest.java | 36 +++++++++++++++++++ 10 files changed, 156 insertions(+), 5 deletions(-) diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDao.java index 10a40db90cb..59fab5899b4 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDao.java @@ -60,6 +60,13 @@ public class RuleDao implements Dao { return ofNullable(mapper(session).selectMetadataByKey(key)); } + public List selectMetadataByKeys(DbSession session, Collection keys) { + if (keys.isEmpty()) { + return emptyList(); + } + return executeLargeInputs(keys, mapper(session)::selectMetadataByKeys); + } + public RuleDto selectOrFailByKey(DbSession session, RuleKey key) { RuleDto rule = mapper(session).selectByKey(key); if (rule == null) { diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleMapper.java index d4d61573244..a49cf2e22a5 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleMapper.java @@ -49,6 +49,8 @@ public interface RuleMapper { RuleMetadataDto selectMetadataByKey(@Param("ruleKey") RuleKey ruleKey); + List selectMetadataByKeys(@Param("ruleKeys") List keys); + List selectByKeys(@Param("ruleKeys") List keys); List selectDefinitionByKeys(@Param("ruleKeys") List keys); diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleMapper.xml index fb4c67409a8..ca8ee02db2e 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleMapper.xml @@ -205,6 +205,32 @@ and r.plugin_rule_key=#{ruleKey.rule,jdbcType=VARCHAR} + +