diff options
author | Jacek <jacek.poreda@sonarsource.com> | 2022-10-07 14:38:14 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-10-10 20:03:09 +0000 |
commit | 00dda5a5d8089e9ff7f8c4d011a16f425cd6bf7b (patch) | |
tree | 7a4e680e6e38aa56e316281dc1ef7b94b4bafbed /server/sonar-db-dao | |
parent | d17f1fa0ac2b38f1e94f2e7e5d72f9a747062c8b (diff) | |
download | sonarqube-00dda5a5d8089e9ff7f8c4d011a16f425cd6bf7b.tar.gz sonarqube-00dda5a5d8089e9ff7f8c4d011a16f425cd6bf7b.zip |
SONAR-17440 Unset built-in flag and rename Quality Profile in case plugin which introduced it has been removed
Diffstat (limited to 'server/sonar-db-dao')
3 files changed, 8 insertions, 25 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/QualityProfileDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/QualityProfileDao.java index f6133648150..7d2d4c1838b 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/QualityProfileDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/QualityProfileDao.java @@ -81,10 +81,6 @@ public class QualityProfileDao implements Dao { return mapper(dbSession).selectBuiltInRuleProfilesWithActiveRules(); } - public List<QProfileDto> selectBuiltInRuleProfilesWithoutActiveRules(DbSession dbSession) { - return mapper(dbSession).selectBuiltInProfilesWithoutActiveRules(); - } - @CheckForNull public RulesProfileDto selectRuleProfile(DbSession dbSession, String ruleProfileUuid) { return mapper(dbSession).selectRuleProfile(ruleProfileUuid); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/QualityProfileMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/QualityProfileMapper.java index 1c2fb6417d3..27fc6f28def 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/QualityProfileMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/QualityProfileMapper.java @@ -44,8 +44,6 @@ public interface QualityProfileMapper { List<RulesProfileDto> selectBuiltInRuleProfilesWithActiveRules(); - List<QProfileDto> selectBuiltInProfilesWithoutActiveRules(); - @CheckForNull RulesProfileDto selectRuleProfile(@Param("uuid") String ruleProfileUuid); diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QualityProfileMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QualityProfileMapper.xml index 8f4ae191e5e..fdcd8dc0b56 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QualityProfileMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QualityProfileMapper.xml @@ -147,7 +147,8 @@ INNER JOIN default_qprofiles dp ON dp.qprofile_uuid = oqp.uuid WHERE rp.is_built_in = ${_true} - AND rp.language IN <foreach collection="languages" open="(" close=")" item="language" separator=",">#{language, jdbcType=VARCHAR}</foreach> + AND rp.language IN <foreach collection="languages" open="(" close=")" item="language" + separator=",">#{language, jdbcType=VARCHAR}</foreach> AND NOT EXISTS ( SELECT 1 FROM active_rules ar INNER JOIN rules r ON r.uuid = ar.rule_uuid AND r.status <> 'REMOVED' @@ -155,21 +156,6 @@ ) </select> - <select id="selectBuiltInProfilesWithoutActiveRules" parameterType="map" - resultType="org.sonar.db.qualityprofile.QProfileDto"> - SELECT - <include refid="qProfileColumns"/> - FROM org_qprofiles oqp - INNER JOIN rules_profiles rp ON oqp.rules_profile_uuid = rp.uuid - WHERE - rp.is_built_in = ${_true} - AND NOT EXISTS ( - SELECT 1 FROM active_rules ar - INNER JOIN rules r ON r.uuid = ar.rule_uuid AND r.status <> 'REMOVED' - WHERE profile_uuid = rp.uuid - ) - </select> - <select id="selectDefaultProfiles" parameterType="map" resultType="org.sonar.db.qualityprofile.QProfileDto"> select <include refid="qProfileColumns"/> @@ -177,7 +163,8 @@ inner join rules_profiles rp on oqp.rules_profile_uuid = rp.uuid inner join default_qprofiles dp on dp.qprofile_uuid = oqp.uuid where - dp.language in <foreach collection="languages" open="(" close=")" item="language" separator=",">#{language, jdbcType=VARCHAR}</foreach> + dp.language in <foreach collection="languages" open="(" close=")" item="language" + separator=",">#{language, jdbcType=VARCHAR}</foreach> and rp.language = dp.language </select> @@ -218,7 +205,8 @@ inner join rules_profiles rp on oqp.rules_profile_uuid = rp.uuid where rp.name = #{name, jdbcType=VARCHAR} - and rp.language in <foreach collection="languages" open="(" close=")" item="language" separator=",">#{language, jdbcType=VARCHAR}</foreach> + and rp.language in <foreach collection="languages" open="(" close=")" item="language" + separator=",">#{language, jdbcType=VARCHAR}</foreach> </select> <select id="selectByUuid" parameterType="string" resultType="org.sonar.db.qualityprofile.QProfileDto"> @@ -290,7 +278,8 @@ inner join rules_profiles rp on oqp.rules_profile_uuid = rp.uuid inner join project_qprofiles pqp ON pqp.profile_key = oqp.uuid where - rp.language in <foreach collection="languages" open="(" close=")" item="language" separator=",">#{language, jdbcType=VARCHAR}</foreach> + rp.language in <foreach collection="languages" open="(" close=")" item="language" + separator=",">#{language, jdbcType=VARCHAR}</foreach> and pqp.project_uuid = #{projectUuid, jdbcType=VARCHAR} </select> |