aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao/src/main/resources
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2019-10-08 17:51:53 +0200
committersonartech <sonartech@sonarsource.com>2019-11-06 10:04:19 +0100
commit58d04f69bb33f17cfe6db3d9885fe4c9adabd2d1 (patch)
treebc48a5c0b0e2884ffa6ec2b61c99326844f030ba /server/sonar-db-dao/src/main/resources
parentf8c9b9c8b3e7040907e0ded89511f86b827449ad (diff)
downloadsonarqube-58d04f69bb33f17cfe6db3d9885fe4c9adabd2d1.tar.gz
sonarqube-58d04f69bb33f17cfe6db3d9885fe4c9adabd2d1.zip
SONAR-12512 Allow configuration of multiple GitHub instances
Diffstat (limited to 'server/sonar-db-dao/src/main/resources')
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/alm/setting/AlmSettingMapper.xml86
1 files changed, 86 insertions, 0 deletions
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/alm/setting/AlmSettingMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/alm/setting/AlmSettingMapper.xml
new file mode 100644
index 00000000000..bf66e2983fe
--- /dev/null
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/alm/setting/AlmSettingMapper.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd">
+
+<mapper namespace="org.sonar.db.alm.setting.AlmSettingMapper">
+
+ <sql id="sqlColumns">
+ a.kee as key,
+ a.uuid as uuid,
+ a.alm_id as rawAlm,
+ a.url as url,
+ a.app_id as appId,
+ a.private_key as privateKey,
+ a.pat as personalAccessToken,
+ a.created_at as createdAt,
+ a.updated_at as updatedAt
+ </sql>
+
+ <select id="selectByUuid" parameterType="string" resultType="org.sonar.db.alm.setting.AlmSettingDto">
+ select <include refid="sqlColumns"/>
+ from
+ alm_settings a
+ where
+ a.uuid = #{uuid, jdbcType=VARCHAR}
+ </select>
+
+ <select id="selectByKey" parameterType="string" resultType="org.sonar.db.alm.setting.AlmSettingDto">
+ select <include refid="sqlColumns"/>
+ from
+ alm_settings a
+ where
+ a.kee = #{key, jdbcType=VARCHAR}
+ </select>
+
+ <select id="selectAll" resultType="org.sonar.db.alm.setting.AlmSettingDto">
+ select <include refid="sqlColumns"/>
+ from alm_settings a
+ </select>
+
+
+ <insert id="insert" parameterType="Map" useGeneratedKeys="false">
+ INSERT INTO alm_settings
+ (
+ uuid,
+ kee,
+ alm_id,
+ url,
+ app_id,
+ private_key,
+ pat,
+ created_at,
+ updated_at
+ )
+ VALUES (
+ #{uuid, jdbcType=VARCHAR},
+ #{dto.key, jdbcType=VARCHAR},
+ #{dto.rawAlm, jdbcType=VARCHAR},
+ #{dto.url, jdbcType=VARCHAR},
+ #{dto.appId, jdbcType=VARCHAR},
+ #{dto.privateKey, jdbcType=VARCHAR},
+ #{dto.personalAccessToken, jdbcType=VARCHAR},
+ #{now, jdbcType=BIGINT},
+ #{now, jdbcType=BIGINT}
+ )
+ </insert>
+
+ <update id="update" parameterType="Map">
+ UPDATE alm_settings
+ <set>
+ kee = #{dto.key, jdbcType=VARCHAR},
+ url = #{dto.url, jdbcType=VARCHAR},
+ app_id = #{dto.appId, jdbcType=VARCHAR},
+ private_key = #{dto.privateKey, jdbcType=VARCHAR},
+ pat = #{dto.personalAccessToken, jdbcType=VARCHAR},
+ updated_at = #{now, jdbcType=BIGINT}
+ </set>
+ <where>
+ uuid = #{dto.uuid, jdbcType=VARCHAR}
+ </where>
+ </update>
+
+ <delete id="deleteByKey" parameterType="String">
+ DELETE FROM alm_settings WHERE kee = #{key, jdbcType=VARCHAR}
+ </delete>
+
+
+</mapper>