aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao/src/main/java
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2020-08-10 16:03:27 -0500
committersonartech <sonartech@sonarsource.com>2020-08-14 20:16:19 +0000
commite7c1b404c31bef278240fab976784ab391d952a9 (patch)
tree17008675f581a52fe9be98c7768675a7fa45f5b6 /server/sonar-db-dao/src/main/java
parentcc10a68715444305f7a8d8e1181b39b5a79a2343 (diff)
downloadsonarqube-e7c1b404c31bef278240fab976784ab391d952a9.tar.gz
sonarqube-e7c1b404c31bef278240fab976784ab391d952a9.zip
SONAR-13696 drop PROJECT_ALM_BINDINGS 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.java7
-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/alm/ProjectAlmBindingDao.java97
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingDto.java62
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingMapper.java45
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java4
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java3
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java7
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java1
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java2
11 files changed, 0 insertions, 234 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 aa3ffa7667d..9a89ca6b267 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
@@ -25,7 +25,6 @@ import java.util.List;
import org.sonar.core.platform.Module;
import org.sonar.db.alm.AlmAppInstallDao;
import org.sonar.db.alm.OrganizationAlmBindingDao;
-import org.sonar.db.alm.ProjectAlmBindingDao;
import org.sonar.db.alm.pat.AlmPatDao;
import org.sonar.db.alm.setting.AlmSettingDao;
import org.sonar.db.alm.setting.ProjectAlmSettingDao;
@@ -124,7 +123,6 @@ public class DaoModule extends Module {
AlmSettingDao.class,
AlmPatDao.class,
ProjectAlmSettingDao.class,
- ProjectAlmBindingDao.class,
InternalComponentPropertiesDao.class,
InternalPropertiesDao.class,
IssueChangeDao.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 24718f69174..022e0c4dc39 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
@@ -23,7 +23,6 @@ import java.util.IdentityHashMap;
import java.util.Map;
import org.sonar.db.alm.AlmAppInstallDao;
import org.sonar.db.alm.OrganizationAlmBindingDao;
-import org.sonar.db.alm.ProjectAlmBindingDao;
import org.sonar.db.alm.pat.AlmPatDao;
import org.sonar.db.alm.setting.AlmSettingDao;
import org.sonar.db.alm.setting.ProjectAlmSettingDao;
@@ -108,7 +107,6 @@ public class DbClient {
private final AlmSettingDao almSettingDao;
private final AlmPatDao almPatDao;
private final ProjectAlmSettingDao projectAlmSettingDao;
- private final ProjectAlmBindingDao projectAlmBindingDao;
private final InternalComponentPropertiesDao internalComponentPropertiesDao;
private final InternalPropertiesDao internalPropertiesDao;
private final SnapshotDao snapshotDao;
@@ -180,7 +178,6 @@ public class DbClient {
almSettingDao = getDao(map, AlmSettingDao.class);
almPatDao = getDao(map, AlmPatDao.class);
projectAlmSettingDao = getDao(map, ProjectAlmSettingDao.class);
- projectAlmBindingDao = getDao(map, ProjectAlmBindingDao.class);
schemaMigrationDao = getDao(map, SchemaMigrationDao.class);
authorizationDao = getDao(map, AuthorizationDao.class);
organizationDao = getDao(map, OrganizationDao.class);
@@ -271,10 +268,6 @@ public class DbClient {
return projectAlmSettingDao;
}
- public ProjectAlmBindingDao projectAlmBindingsDao() {
- return projectAlmBindingDao;
- }
-
public SchemaMigrationDao schemaMigrationDao() {
return schemaMigrationDao;
}
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 8d31e0f9735..bc390ff1fb1 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
@@ -36,8 +36,6 @@ import org.apache.ibatis.session.TransactionIsolationLevel;
import org.sonar.api.Startable;
import org.sonar.db.alm.AlmAppInstallMapper;
import org.sonar.db.alm.OrganizationAlmBindingMapper;
-import org.sonar.db.alm.ProjectAlmBindingDto;
-import org.sonar.db.alm.ProjectAlmBindingMapper;
import org.sonar.db.alm.pat.AlmPatMapper;
import org.sonar.db.alm.setting.AlmSettingMapper;
import org.sonar.db.alm.setting.ProjectAlmSettingMapper;
@@ -203,7 +201,6 @@ public class MyBatis implements Startable {
confBuilder.loadAlias("PermissionTemplateUser", PermissionTemplateUserDto.class);
confBuilder.loadAlias("Plugin", PluginDto.class);
confBuilder.loadAlias("PrIssue", PrIssueDto.class);
- confBuilder.loadAlias("ProjectAlmBinding", ProjectAlmBindingDto.class);
confBuilder.loadAlias("ProjectQgateAssociation", ProjectQgateAssociationDto.class);
confBuilder.loadAlias("Project", ProjectDto.class);
confBuilder.loadAlias("ProjectMapping", ProjectMappingDto.class);
@@ -269,7 +266,6 @@ public class MyBatis implements Startable {
PermissionTemplateCharacteristicMapper.class,
PermissionTemplateMapper.class,
PluginMapper.class,
- ProjectAlmBindingMapper.class,
ProjectAlmSettingMapper.class,
ProjectLinkMapper.class,
ProjectMapper.class,
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingDao.java
deleted file mode 100644
index c0d20447c3d..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingDao.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.alm;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import javax.annotation.Nullable;
-import org.sonar.api.utils.System2;
-import org.sonar.core.util.UuidFactory;
-import org.sonar.db.Dao;
-import org.sonar.db.DbSession;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static org.apache.commons.lang.StringUtils.isNotEmpty;
-import static org.sonar.db.DatabaseUtils.executeLargeInputs;
-
-public class ProjectAlmBindingDao implements Dao {
-
- private final System2 system2;
- private final UuidFactory uuidFactory;
-
- public ProjectAlmBindingDao(System2 system2, UuidFactory uuidFactory) {
- this.system2 = system2;
- this.uuidFactory = uuidFactory;
- }
-
- public void insertOrUpdate(DbSession dbSession, ALM alm, String repoId, String projectUuid, @Nullable String githubSlug, String url) {
- checkAlm(alm);
- checkRepoId(repoId);
- checkArgument(isNotEmpty(projectUuid), "projectUuid can't be null nor empty");
- checkArgument(isNotEmpty(url), "url can't be null nor empty");
-
- ProjectAlmBindingMapper mapper = getMapper(dbSession);
- long now = system2.now();
-
- if (mapper.update(alm.getId(), repoId, projectUuid, githubSlug, url, now) == 0) {
- mapper.insert(uuidFactory.create(), alm.getId(), repoId, projectUuid, githubSlug, url, now);
- }
- }
-
- public Optional<ProjectAlmBindingDto> selectByProjectUuid(DbSession session, String projectUuid) {
- return Optional.ofNullable(getMapper(session).selectByProjectUuid(projectUuid));
- }
-
- /**
- * Gets a list of bindings by their repo_id. The result does NOT contain {@code null} values for bindings not found, so
- * the size of result may be less than the number of ids.
- * <p>Results may be in a different order as input ids.</p>
- */
- public List<ProjectAlmBindingDto> selectByRepoIds(final DbSession session, ALM alm, Collection<String> repoIds) {
- return executeLargeInputs(repoIds, partitionedIds -> getMapper(session).selectByRepoIds(alm.getId(), partitionedIds));
- }
-
- public Optional<ProjectAlmBindingDto> selectByRepoId(final DbSession session, ALM alm, String repoId) {
- return Optional.ofNullable(getMapper(session).selectByRepoId(alm.getId(), repoId));
- }
-
- public Optional<String> findProjectKey(DbSession dbSession, ALM alm, String repoId) {
- checkAlm(alm);
- checkRepoId(repoId);
-
- ProjectAlmBindingMapper mapper = getMapper(dbSession);
- return Optional.ofNullable(mapper.selectProjectKey(alm.getId(), repoId));
- }
-
- private static void checkAlm(@Nullable ALM alm) {
- Objects.requireNonNull(alm, "alm can't be null");
- }
-
- private static void checkRepoId(@Nullable String repoId) {
- checkArgument(isNotEmpty(repoId), "repoId can't be null nor empty");
- }
-
- private static ProjectAlmBindingMapper getMapper(DbSession dbSession) {
- return dbSession.getMapper(ProjectAlmBindingMapper.class);
- }
-
-}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingDto.java
deleted file mode 100644
index ce9f2e1ee24..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingDto.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.alm;
-
-import java.util.Arrays;
-
-/**
- * DTO is used only for select, hence no setters (MyBatis populates field by reflection).
- */
-public class ProjectAlmBindingDto {
- private String uuid;
- private String rawAlmId;
- private String repoId;
- private String projectUuid;
- private String githubSlug;
- private String url;
-
- public ALM getAlm() {
- return Arrays.stream(ALM.values())
- .filter(a -> a.getId().equals(rawAlmId))
- .findAny()
- .orElseThrow(() -> new IllegalStateException("ALM id " + rawAlmId + " is invalid"));
- }
-
- public String getRepoId() {
- return repoId;
- }
-
- public String getProjectUuid() {
- return projectUuid;
- }
-
- public String getGithubSlug() {
- return githubSlug;
- }
-
- public String getUrl() {
- return url;
- }
-
- public String getUuid() {
- return uuid;
- }
-
-}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingMapper.java
deleted file mode 100644
index ddf722a0bfa..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingMapper.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.alm;
-
-import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.apache.ibatis.annotations.Param;
-
-public interface ProjectAlmBindingMapper {
-
- int bindingCount(@Param("almId") String almId, @Param("repoId") String repoId);
-
- void insert(@Param("uuid") String uuid, @Param("almId") String almId, @Param("repoId") String repoId, @Param("projectUuid") String projectUuid,
- @Nullable @Param("githubSlug") String githubSlug, @Param("url") String url, @Param("now") long now);
-
- int update(@Param("almId") String almId, @Param("repoId") String repoId, @Param("projectUuid") String projectUuid,
- @Nullable @Param("githubSlug") String githubSlug, @Param("url") String url, @Param("now") long now);
-
- List<ProjectAlmBindingDto> selectByRepoIds(@Param("almId") String almId, @Param("repoIds") List<String> repoIds);
-
- ProjectAlmBindingDto selectByRepoId(@Param("almId") String almId, @Param("repoId") String repoId);
-
- ProjectAlmBindingDto selectByProjectUuid(@Param("projectUuid") String projectUuid);
-
- @CheckForNull
- String selectProjectKey(@Param("almId") String almId, @Param("repoId") String repoId);
-}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java
index e4426e519b7..03e1b31e89d 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java
@@ -392,10 +392,6 @@ public class ComponentDao implements Dao {
return mapper(dbSession).selectPrivateProjectsWithNcloc(organizationUuid);
}
- public Optional<ComponentDto> selectByAlmIdAndAlmRepositoryId(DbSession dbSession, String almId, String almRepositoryId) {
- return Optional.ofNullable(mapper(dbSession).selectByAlmIdAndAlmRepositoryId(almId, almRepositoryId));
- }
-
public boolean existAnyOfComponentsWithQualifiers(DbSession session, Collection<String> componentKeys, Set<String> qualifiers) {
if (!componentKeys.isEmpty()) {
List<Boolean> result = new LinkedList<>();
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java
index 3081461ed4c..3604655853d 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java
@@ -42,9 +42,6 @@ public interface ComponentMapper {
@CheckForNull
ComponentDto selectByUuid(String uuid);
- @CheckForNull
- ComponentDto selectByAlmIdAndAlmRepositoryId(@Param("almId") String almId, @Param("almRepositoryId") String almRepositoryId);
-
/**
* Return sub project of component keys
*/
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java
index cba1d524e1d..3d28191d9b1 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java
@@ -399,13 +399,6 @@ class PurgeCommands {
profiler.stop();
}
- void deleteProjectAlmBindings(String rootUuid) {
- profiler.start("deleteProjectAlmBindings (project_alm_bindings)");
- purgeMapper.deleteProjectAlmBindingsByProjectUuid(rootUuid);
- session.commit();
- profiler.stop();
- }
-
public void deleteProjectAlmSettings(String rootUuid) {
profiler.start("deleteProjectAlmSettings (project_alm_settings)");
purgeMapper.deleteProjectAlmSettingsByProjectUuid(rootUuid);
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java
index 3b51bd337f1..16d0df3ffc6 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java
@@ -202,7 +202,6 @@ public class PurgeDao implements Dao {
commands.deleteWebhookDeliveries(rootUuid);
commands.deleteLiveMeasures(rootUuid);
commands.deleteProjectMappings(rootUuid);
- commands.deleteProjectAlmBindings(rootUuid);
commands.deleteProjectAlmSettings(rootUuid);
commands.deletePermissions(rootUuid);
commands.deleteNewCodePeriods(rootUuid);
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java
index 1ce7f336a0b..5e068e4cac9 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java
@@ -139,8 +139,6 @@ public interface PurgeMapper {
void deleteProjectMappingsByProjectUuid(@Param("projectUuid") String projectUuid);
- void deleteProjectAlmBindingsByProjectUuid(@Param("projectUuid") String projectUuid);
-
void deleteBranchByUuid(@Param("uuid") String uuid);
void deleteLiveMeasuresByProjectUuid(@Param("projectUuid") String projectUuid);