aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao/src/main/java/org/sonar
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-db-dao/src/main/java/org/sonar')
-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.java7
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java2
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/MigrationLogDao.java49
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/MigrationLogDto.java94
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/MigrationLogMapper.java31
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/package-info.java24
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/portfolio/PortfolioDao.java8
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/portfolio/PortfolioMapper.java4
9 files changed, 212 insertions, 9 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 f2e51452023..24a27e606c7 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
@@ -54,6 +54,7 @@ import org.sonar.db.issue.IssueFixedDao;
import org.sonar.db.measure.MeasureDao;
import org.sonar.db.measure.ProjectMeasureDao;
import org.sonar.db.metric.MetricDao;
+import org.sonar.db.migrationlog.MigrationLogDao;
import org.sonar.db.newcodeperiod.NewCodePeriodDao;
import org.sonar.db.notification.NotificationQueueDao;
import org.sonar.db.permission.AuthorizationDao;
@@ -158,6 +159,7 @@ public class DaoModule extends Module {
MeasureDao.class,
ProjectMeasureDao.class,
MetricDao.class,
+ MigrationLogDao.class,
NewCodePeriodDao.class,
NotificationQueueDao.class,
PermissionTemplateCharacteristicDao.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 027055a5075..462723a722d 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
@@ -54,6 +54,7 @@ import org.sonar.db.issue.IssueFixedDao;
import org.sonar.db.measure.MeasureDao;
import org.sonar.db.measure.ProjectMeasureDao;
import org.sonar.db.metric.MetricDao;
+import org.sonar.db.migrationlog.MigrationLogDao;
import org.sonar.db.newcodeperiod.NewCodePeriodDao;
import org.sonar.db.notification.NotificationQueueDao;
import org.sonar.db.permission.AuthorizationDao;
@@ -165,6 +166,7 @@ public class DbClient {
private final DuplicationDao duplicationDao;
private final NotificationQueueDao notificationQueueDao;
private final MetricDao metricDao;
+ private final MigrationLogDao migrationLogDao;
private final GroupDao groupDao;
private final ExternalGroupDao externalGroupDao;
private final RuleDao ruleDao;
@@ -263,6 +265,7 @@ public class DbClient {
regulatoryReportDao = getDao(map, RegulatoryReportDao.class);
notificationQueueDao = getDao(map, NotificationQueueDao.class);
metricDao = getDao(map, MetricDao.class);
+ migrationLogDao = getDao(map, MigrationLogDao.class);
groupDao = getDao(map, GroupDao.class);
githubOrganizationGroupDao = getDao(map, GithubOrganizationGroupDao.class);
devopsPermissionsMappingDao = getDao(map, DevOpsPermissionsMappingDao.class);
@@ -527,6 +530,10 @@ public class DbClient {
return metricDao;
}
+ public MigrationLogDao migrationLogDao() {
+ return migrationLogDao;
+ }
+
public GroupDao groupDao() {
return groupDao;
}
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 7dfa94e518a..deacfe47053 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
@@ -94,6 +94,7 @@ import org.sonar.db.measure.MeasureMapper;
import org.sonar.db.measure.ProjectMeasureDto;
import org.sonar.db.measure.ProjectMeasureMapper;
import org.sonar.db.metric.MetricMapper;
+import org.sonar.db.migrationlog.MigrationLogMapper;
import org.sonar.db.newcodeperiod.NewCodePeriodMapper;
import org.sonar.db.notification.NotificationQueueDto;
import org.sonar.db.notification.NotificationQueueMapper;
@@ -320,6 +321,7 @@ public class MyBatis {
MeasureMapper.class,
ProjectMeasureMapper.class,
MetricMapper.class,
+ MigrationLogMapper.class,
NewCodePeriodMapper.class,
NotificationQueueMapper.class,
PermissionTemplateCharacteristicMapper.class,
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/MigrationLogDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/MigrationLogDao.java
new file mode 100644
index 00000000000..2108ae03ad9
--- /dev/null
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/MigrationLogDao.java
@@ -0,0 +1,49 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2024 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.migrationlog;
+
+import java.util.Collection;
+import java.util.List;
+import org.sonar.db.Dao;
+import org.sonar.db.DbSession;
+
+public class MigrationLogDao implements Dao {
+
+ public MigrationLogDto insert(DbSession session, MigrationLogDto dto) {
+ mapper(session).insert(dto);
+
+ return dto;
+ }
+
+ public void insert(DbSession session, Collection<MigrationLogDto> items) {
+ for (MigrationLogDto item : items) {
+ insert(session, item);
+ }
+ }
+
+ public List<MigrationLogDto> selectAll(DbSession session) {
+ return mapper(session).selectAll();
+ }
+
+ private static MigrationLogMapper mapper(DbSession session) {
+ return session.getMapper(MigrationLogMapper.class);
+ }
+
+}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/MigrationLogDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/MigrationLogDto.java
new file mode 100644
index 00000000000..274d6cf34b3
--- /dev/null
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/MigrationLogDto.java
@@ -0,0 +1,94 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2024 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.migrationlog;
+
+public class MigrationLogDto {
+
+ private String uuid;
+
+ private String step;
+
+ private Long durationInMs;
+
+ private boolean success;
+
+ private Long startedAt;
+
+ private String targetVersion;
+
+ public MigrationLogDto() {
+ // default constructor
+ }
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public MigrationLogDto setUuid(String uuid) {
+ this.uuid = uuid;
+ return this;
+ }
+
+ public String getStep() {
+ return step;
+ }
+
+ public MigrationLogDto setStep(String step) {
+ this.step = step;
+ return this;
+ }
+
+ public Long getDurationInMs() {
+ return durationInMs;
+ }
+
+ public MigrationLogDto setDurationInMs(Long durationInMs) {
+ this.durationInMs = durationInMs;
+ return this;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public MigrationLogDto setSuccess(boolean success) {
+ this.success = success;
+ return this;
+ }
+
+ public Long getStartedAt() {
+ return startedAt;
+ }
+
+ public MigrationLogDto setStartedAt(Long startedAt) {
+ this.startedAt = startedAt;
+ return this;
+ }
+
+ public String getTargetVersion() {
+ return targetVersion;
+ }
+
+ public MigrationLogDto setTargetVersion(String targetVersion) {
+ this.targetVersion = targetVersion;
+ return this;
+ }
+
+}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/MigrationLogMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/MigrationLogMapper.java
new file mode 100644
index 00000000000..70d267656b7
--- /dev/null
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/MigrationLogMapper.java
@@ -0,0 +1,31 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2024 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.migrationlog;
+
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface MigrationLogMapper {
+
+ void insert(@Param("dto") MigrationLogDto dto);
+
+ List<MigrationLogDto> selectAll();
+
+}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/package-info.java b/server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/package-info.java
new file mode 100644
index 00000000000..a38880db3a2
--- /dev/null
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/migrationlog/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2024 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.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.db.migrationlog;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/portfolio/PortfolioDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/portfolio/PortfolioDao.java
index 071f55344f7..78ef8e56b04 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/portfolio/PortfolioDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/portfolio/PortfolioDao.java
@@ -195,12 +195,8 @@ public class PortfolioDao implements Dao {
return mapper(dbSession).selectRootOfReferencers(referenceUuid);
}
- public List<PortfolioDto> selectRootOfReferencersToMainBranch(DbSession dbSession, String referenceUuid) {
- return mapper(dbSession).selectRootOfReferencersToMainBranch(referenceUuid);
- }
-
- public List<PortfolioDto> selectRootOfReferencersToAppBranch(DbSession dbSession, String appUuid, String appBranchKey) {
- return mapper(dbSession).selectRootOfReferencersToAppBranch(appUuid, appBranchKey);
+ public List<PortfolioDto> selectRootOfReferencersToAppBranch(DbSession dbSession, String appBranchUuid) {
+ return mapper(dbSession).selectRootOfReferencersToAppBranch(appBranchUuid);
}
public void deleteReferencesTo(DbSession dbSession, String referenceUuid) {
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/portfolio/PortfolioMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/portfolio/PortfolioMapper.java
index 325ad3c2038..10e16942681 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/portfolio/PortfolioMapper.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/portfolio/PortfolioMapper.java
@@ -78,8 +78,6 @@ public interface PortfolioMapper {
List<PortfolioDto> selectRootOfReferencers(String referenceUuid);
- List<PortfolioDto> selectRootOfReferencersToMainBranch(String referenceUuid);
-
void deleteReferencesTo(String referenceUuid);
void deleteProjects(String portfolioUuid);
@@ -113,7 +111,7 @@ public interface PortfolioMapper {
List<ReferenceDto> selectAllReferencesToApplicationsInHierarchy(String rootUuid);
- List<PortfolioDto> selectRootOfReferencersToAppBranch(@Param("appUuid") String appUuid, @Param("appBranchKey") String appBranchKey);
+ List<PortfolioDto> selectRootOfReferencersToAppBranch(@Param("appBranchUuid") String appBranchUuid);
List<KeyWithUuidDto> selectUuidsByKey(@Param("rootKey") String rootKey);