aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao/src/main/java
diff options
context:
space:
mode:
authorSteve Marion <unknown>2023-07-20 15:17:54 +0200
committersonartech <sonartech@sonarsource.com>2023-08-02 20:03:03 +0000
commited50d0636f78948fdc36cdc086cabe5eafe54c2d (patch)
tree84b4c97622895d10cca7b1dc02d2bbe762486046 /server/sonar-db-dao/src/main/java
parent4f214cb37958b2cceddfe33c3bd10d7de260e219 (diff)
downloadsonarqube-ed50d0636f78948fdc36cdc086cabe5eafe54c2d.tar.gz
sonarqube-ed50d0636f78948fdc36cdc086cabe5eafe54c2d.zip
SONAR-19372 add anticipated_transitions table
Diffstat (limited to 'server/sonar-db-dao/src/main/java')
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java2
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java9
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java4
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/issue/AnticipatedTransitionDao.java24
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/issue/AnticipatedTransitionDto.java141
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/issue/AnticipatedTransitionMapper.java31
6 files changed, 210 insertions, 1 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java b/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java
index d350c97108f..3ba6682347b 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java
@@ -43,6 +43,7 @@ import org.sonar.db.entity.EntityDao;
import org.sonar.db.es.EsQueueDao;
import org.sonar.db.event.EventComponentChangeDao;
import org.sonar.db.event.EventDao;
+import org.sonar.db.issue.AnticipatedTransitionDao;
import org.sonar.db.issue.IssueChangeDao;
import org.sonar.db.issue.IssueDao;
import org.sonar.db.measure.LiveMeasureDao;
@@ -106,6 +107,7 @@ public class DaoModule extends Module {
// =====================================================================
ActiveRuleDao.class,
AnalysisPropertiesDao.class,
+ AnticipatedTransitionDao.class,
AuthorizationDao.class,
ApplicationProjectsDao.class,
AuditDao.class,
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java b/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java
index f1b9fa30b15..47d6813b549 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java
@@ -43,6 +43,7 @@ import org.sonar.db.entity.EntityDao;
import org.sonar.db.es.EsQueueDao;
import org.sonar.db.event.EventComponentChangeDao;
import org.sonar.db.event.EventDao;
+import org.sonar.db.issue.AnticipatedTransitionDao;
import org.sonar.db.issue.IssueChangeDao;
import org.sonar.db.issue.IssueDao;
import org.sonar.db.measure.LiveMeasureDao;
@@ -180,6 +181,7 @@ public class DbClient {
private final ScimUserDao scimUserDao;
private final ScimGroupDao scimGroupDao;
private final EntityDao entityDao;
+ private final AnticipatedTransitionDao anticipatedTransitionDao;
private final ReportScheduleDao reportScheduleDao;
private final ReportSubscriptionDao reportSubscriptionDao;
@@ -270,6 +272,7 @@ public class DbClient {
entityDao = getDao(map, EntityDao.class);
reportScheduleDao = getDao(map, ReportScheduleDao.class);
reportSubscriptionDao = getDao(map, ReportSubscriptionDao.class);
+ anticipatedTransitionDao = getDao(map, AnticipatedTransitionDao.class);
}
public DbSession openSession(boolean batch) {
@@ -590,12 +593,16 @@ public class DbClient {
return entityDao;
}
- public ReportScheduleDao reportScheduleDao(){
+ public ReportScheduleDao reportScheduleDao() {
return reportScheduleDao;
}
public ReportSubscriptionDao reportSubscriptionDao() {
return reportSubscriptionDao;
}
+
+ public AnticipatedTransitionDao anticipatedTransitionDao() {
+ return anticipatedTransitionDao;
+ }
}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java
index 16752dbcb0a..4d670509d67 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java
@@ -70,6 +70,8 @@ import org.sonar.db.es.EsQueueMapper;
import org.sonar.db.event.EventComponentChangeMapper;
import org.sonar.db.event.EventDto;
import org.sonar.db.event.EventMapper;
+import org.sonar.db.issue.AnticipatedTransitionDto;
+import org.sonar.db.issue.AnticipatedTransitionMapper;
import org.sonar.db.issue.IssueChangeDto;
import org.sonar.db.issue.IssueChangeMapper;
import org.sonar.db.issue.IssueDto;
@@ -194,6 +196,7 @@ public class MyBatis {
confBuilder.loadAlias("ActiveRule", ActiveRuleDto.class);
confBuilder.loadAlias("ActiveRuleParam", ActiveRuleParamDto.class);
confBuilder.loadAlias("ApplicationProject", ApplicationProjectDto.class);
+ confBuilder.loadAlias("AnticipatedTransition", AnticipatedTransitionDto.class);
confBuilder.loadAlias("CeTaskCharacteristic", CeTaskCharacteristicDto.class);
confBuilder.loadAlias("Component", ComponentDto.class);
confBuilder.loadAlias("DuplicationUnit", DuplicationUnitDto.class);
@@ -256,6 +259,7 @@ public class MyBatis {
AlmPatMapper.class,
AlmSettingMapper.class,
AnalysisPropertiesMapper.class,
+ AnticipatedTransitionMapper.class,
ApplicationProjectsMapper.class,
AuditMapper.class,
AuthorizationMapper.class,
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/AnticipatedTransitionDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/AnticipatedTransitionDao.java
new file mode 100644
index 00000000000..6deb8bea985
--- /dev/null
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/AnticipatedTransitionDao.java
@@ -0,0 +1,24 @@
+package org.sonar.db.issue;
+
+import java.util.List;
+import org.sonar.db.Dao;
+import org.sonar.db.DbSession;
+
+public class AnticipatedTransitionDao implements Dao {
+
+ public void insert(DbSession session, AnticipatedTransitionDto transition) {
+ mapper(session).insert(transition);
+ }
+
+ public void delete(DbSession session, String uuid) {
+ mapper(session).delete(uuid);
+ }
+
+ public List<AnticipatedTransitionDto> selectByProjectUuid(DbSession session, String projectUuid) {
+ return mapper(session).selectByProjectUuid(projectUuid);
+ }
+
+ private static AnticipatedTransitionMapper mapper(DbSession session) {
+ return session.getMapper(AnticipatedTransitionMapper.class);
+ }
+}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/AnticipatedTransitionDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/AnticipatedTransitionDto.java
new file mode 100644
index 00000000000..7611d8dd8bd
--- /dev/null
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/AnticipatedTransitionDto.java
@@ -0,0 +1,141 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.db.issue;
+
+import javax.annotation.Nullable;
+
+public class AnticipatedTransitionDto {
+ private String uuid;
+ private String projectUuid;
+ private String userUuid;
+ private String transition;
+ private String status;
+ private String comment;
+ private Integer line;
+ private String message;
+ private String lineHash;
+ private String ruleKey;
+ // TODO: private String filePath
+ // TODO: private Instant createdAt
+
+
+ public AnticipatedTransitionDto(
+ String uuid,
+ String projectUuid,
+ String userUuid,
+ String transition,
+ String status,
+ @Nullable String comment,
+ @Nullable Integer line,
+ @Nullable String message,
+ @Nullable String lineHash,
+ String ruleKey) {
+ this.uuid = uuid;
+ this.projectUuid = projectUuid;
+ this.userUuid = userUuid;
+ this.transition = transition;
+ this.status = status;
+ this.comment = comment;
+ this.line = line;
+ this.message = message;
+ this.lineHash = lineHash;
+ this.ruleKey = ruleKey;
+ }
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ public String getProjectUuid() {
+ return projectUuid;
+ }
+
+ public void setProjectUuid(String projectUuid) {
+ this.projectUuid = projectUuid;
+ }
+
+ public String getUserUuid() {
+ return userUuid;
+ }
+
+ public void setUserUuid(String userUuid) {
+ this.userUuid = userUuid;
+ }
+
+ public String getTransition() {
+ return transition;
+ }
+
+ public void setTransition(String transition) {
+ this.transition = transition;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ public Integer getLine() {
+ return line;
+ }
+
+ public void setLine(Integer line) {
+ this.line = line;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public String getLineHash() {
+ return lineHash;
+ }
+
+ public void setLineHash(String lineHash) {
+ this.lineHash = lineHash;
+ }
+
+ public String getRuleKey() {
+ return ruleKey;
+ }
+
+ public void setRuleKey(String ruleKey) {
+ this.ruleKey = ruleKey;
+ }
+}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/AnticipatedTransitionMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/AnticipatedTransitionMapper.java
new file mode 100644
index 00000000000..dc8383557ee
--- /dev/null
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/AnticipatedTransitionMapper.java
@@ -0,0 +1,31 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.db.issue;
+
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface AnticipatedTransitionMapper {
+ void insert(AnticipatedTransitionDto anticipatedTransitionDto);
+
+ void delete(@Param("uuid") String uuid);
+
+ List<AnticipatedTransitionDto> selectByProjectUuid(@Param("projectUuid") String projectUuid);
+}