summaryrefslogtreecommitdiffstats
path: root/sonar-core/src/main
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2013-12-16 11:40:20 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2013-12-16 11:40:20 +0100
commitaf4d2130fb1dc7312b52a8045039bb8a496c8e34 (patch)
treebf22ee9200b271213934820c34f923f96fb3e83c /sonar-core/src/main
parentf12a558ca4fa704a337560e5e28c53ccc93acd88 (diff)
downloadsonarqube-af4d2130fb1dc7312b52a8045039bb8a496c8e34.tar.gz
sonarqube-af4d2130fb1dc7312b52a8045039bb8a496c8e34.zip
SONAR-4535 Set default profile now use MyBatis
Diffstat (limited to 'sonar-core/src/main')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java9
-rw-r--r--sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileMapper.java3
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml8
3 files changed, 20 insertions, 0 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java
index a364ae1fcc7..5f8be747d25 100644
--- a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java
@@ -43,6 +43,15 @@ public class QualityProfileDao implements ServerComponent {
}
}
+ public QualityProfileDto selectById(Integer id) {
+ SqlSession session = mybatis.openSession();
+ try {
+ return session.getMapper(QualityProfileMapper.class).selectById(id);
+ } finally {
+ MyBatis.closeQuietly(session);
+ }
+ }
+
public QualityProfileDto selectByNameAndLanguage(String name, String language) {
SqlSession session = mybatis.openSession();
try {
diff --git a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileMapper.java b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileMapper.java
index dcfe0b93337..743841117b4 100644
--- a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileMapper.java
+++ b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileMapper.java
@@ -33,6 +33,9 @@ public interface QualityProfileMapper {
@CheckForNull
QualityProfileDto selectByNameAndLanguage(@Param("name") String name, @Param("language") String language);
+ @CheckForNull
+ QualityProfileDto selectById(@Param("id") Integer id);
+
void insert(QualityProfileDto dto);
void update(QualityProfileDto dto);
diff --git a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml
index cd44060bef0..7fce1aff56b 100644
--- a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml
@@ -26,6 +26,14 @@
</where>
</select>
+ <select id="selectById" parameterType="Integer" resultType="QualityProfile">
+ select <include refid="profilesColumns"/>
+ from rules_profiles p
+ <where>
+ and p.id=#{id}
+ </where>
+ </select>
+
<insert id="insert" parameterType="QualityProfile" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
INSERT INTO rules_profiles (name, language, parent_name, version, used_profile)
VALUES (#{name}, #{language}, #{parent}, #{version}, #{used})