aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao/src/main
diff options
context:
space:
mode:
authorVojtech Suchy <vojtech.suchy@sonarsource.com>2024-11-12 14:06:36 +0100
committersonartech <sonartech@sonarsource.com>2024-11-19 20:02:53 +0000
commit966250379cd22b0c1ff462194bdea6fb4fa85e49 (patch)
tree40ed723bb2e915786c7bc763cdd99c48735ffad3 /server/sonar-db-dao/src/main
parent0adcf3598f8c70bb3f085272295557f306f444fc (diff)
downloadsonarqube-966250379cd22b0c1ff462194bdea6fb4fa85e49.tar.gz
sonarqube-966250379cd22b0c1ff462194bdea6fb4fa85e49.zip
CODEFIX-181 Introduce a new endpoint for AI CodeFix project level enablement
Diffstat (limited to 'server/sonar-db-dao/src/main')
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectDao.java4
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectMapper.java2
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml7
3 files changed, 13 insertions, 0 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectDao.java
index 74849bf4f04..876c8a0ff28 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectDao.java
@@ -123,6 +123,10 @@ public class ProjectDao implements Dao {
mapper(session).updateAiCodeAssurance(uuid, aiCodeAssurance, system2.now());
}
+ public void updateAiCodeFixEnablementForAllProjects(DbSession dbSession, boolean featureEnablement) {
+ mapper(dbSession).updateAiCodeFixEnablementForAllProjects(featureEnablement, system2.now());
+ }
+
public void updateTags(DbSession session, ProjectDto project) {
mapper(session).updateTags(project);
}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectMapper.java
index 4717d3e55b1..4b899aab902 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectMapper.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectMapper.java
@@ -60,6 +60,8 @@ public interface ProjectMapper {
void updateAiCodeAssurance(@Param("uuid") String uuid, @Param("aiCodeAssurance") boolean aiCodeAssurance, @Param("updatedAt") long updatedAt);
+ void updateAiCodeFixEnablementForAllProjects(@Param("aiCodeFixEnabled") boolean aiCodeFixEnabled, @Param("updatedAt") long updatedAt);
+
List<ProjectDto> selectAllApplications();
List<ProjectDto> selectApplicationsByKeys(@Param("kees") Collection<String> kees);
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml
index 9f332354d87..aa87a5f8900 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml
@@ -171,6 +171,7 @@
update projects set
name = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
+ ai_code_fix_enabled = #{aiCodeFixEnabled, jdbcType=BOOLEAN},
updated_at = #{updatedAt,jdbcType=BIGINT}
where
uuid = #{uuid,jdbcType=VARCHAR}
@@ -192,6 +193,12 @@
uuid = #{uuid,jdbcType=VARCHAR}
</update>
+ <update id="updateAiCodeFixEnablementForAllProjects">
+ update projects set
+ ai_code_fix_enabled = #{aiCodeFixEnabled,jdbcType=BOOLEAN},
+ updated_at = #{updatedAt,jdbcType=BIGINT}
+ </update>
+
<update id="updateNcloc">
update projects set
ncloc = #{ncloc,jdbcType=BIGINT}