diff options
author | Javier García Orduña <javier.garcia@sonarsource.com> | 2025-02-06 09:27:32 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2025-02-19 20:03:12 +0000 |
commit | 01f820ffb2911d754d1b45ce3dcfdf997db53ce0 (patch) | |
tree | 68c1a2048efb27e9330af86512bfaea34c1b4991 /server/sonar-db-dao/src/main/java/org/sonar/db | |
parent | ca06b89d80a886866b84250408c5214f0a775efc (diff) | |
download | sonarqube-01f820ffb2911d754d1b45ce3dcfdf997db53ce0.tar.gz sonarqube-01f820ffb2911d754d1b45ce3dcfdf997db53ce0.zip |
SQRP-140 Expose dependency details with new REST APIs
Diffstat (limited to 'server/sonar-db-dao/src/main/java/org/sonar/db')
8 files changed, 2 insertions, 229 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 dcff6ee1d0d..5fdc29673fa 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 @@ -38,7 +38,6 @@ import org.sonar.db.component.ComponentDao; import org.sonar.db.component.ComponentKeyUpdaterDao; import org.sonar.db.component.ProjectLinkDao; import org.sonar.db.component.SnapshotDao; -import org.sonar.db.dependency.ProjectDependenciesDao; import org.sonar.db.duplication.DuplicationDao; import org.sonar.db.entity.EntityDao; import org.sonar.db.es.EsQueueDao; @@ -162,7 +161,6 @@ public class DaoModule extends Module { PluginDao.class, ProjectDao.class, ProjectBadgeTokenDao.class, - ProjectDependenciesDao.class, ProjectExportDao.class, PortfolioDao.class, ProjectLinkDao.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 279a9fdf83b..4babe31e343 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 @@ -38,7 +38,6 @@ import org.sonar.db.component.ComponentDao; import org.sonar.db.component.ComponentKeyUpdaterDao; import org.sonar.db.component.ProjectLinkDao; import org.sonar.db.component.SnapshotDao; -import org.sonar.db.dependency.ProjectDependenciesDao; import org.sonar.db.duplication.DuplicationDao; import org.sonar.db.entity.EntityDao; import org.sonar.db.es.EsQueueDao; @@ -202,7 +201,6 @@ public class DbClient { private final ProjectExportDao projectExportDao; private final IssueFixedDao issueFixedDao; private final TelemetryMetricsSentDao telemetryMetricsSentDao; - private final ProjectDependenciesDao projectDependenciesDao; private final ScaDependenciesDao scaDependenciesDao; public DbClient(Database database, MyBatis myBatis, DBSessions dbSessions, Dao... daos) { @@ -300,7 +298,6 @@ public class DbClient { projectExportDao = getDao(map, ProjectExportDao.class); issueFixedDao = getDao(map, IssueFixedDao.class); telemetryMetricsSentDao = getDao(map, TelemetryMetricsSentDao.class); - projectDependenciesDao = getDao(map, ProjectDependenciesDao.class); scaDependenciesDao = getDao(map, ScaDependenciesDao.class); } @@ -666,10 +663,6 @@ public class DbClient { return projectExportDao; } - public ProjectDependenciesDao projectDependenciesDao() { - return projectDependenciesDao; - } - public ScaDependenciesDao scaDependenciesDao() { return scaDependenciesDao; } 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 7f9fac3f962..73e0097b162 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 @@ -63,8 +63,6 @@ import org.sonar.db.component.SnapshotDto; import org.sonar.db.component.SnapshotMapper; import org.sonar.db.component.UuidWithBranchUuidDto; import org.sonar.db.component.ViewsSnapshotDto; -import org.sonar.db.dependency.ProjectDependenciesMapper; -import org.sonar.db.dependency.ProjectDependencyDto; import org.sonar.db.duplication.DuplicationMapper; import org.sonar.db.duplication.DuplicationUnitDto; import org.sonar.db.entity.EntityDto; @@ -154,6 +152,7 @@ import org.sonar.db.rule.RuleMapper; import org.sonar.db.rule.RuleParamDto; import org.sonar.db.rule.RuleRepositoryMapper; import org.sonar.db.sca.ScaDependenciesMapper; +import org.sonar.db.sca.ScaDependencyDto; import org.sonar.db.scannercache.ScannerAnalysisCacheMapper; import org.sonar.db.schemamigration.SchemaMigrationDto; import org.sonar.db.schemamigration.SchemaMigrationMapper; @@ -245,7 +244,6 @@ public class MyBatis { confBuilder.loadAlias("ProjectQgateAssociation", ProjectQgateAssociationDto.class); confBuilder.loadAlias("Project", ProjectDto.class); confBuilder.loadAlias("ProjectBadgeToken", ProjectBadgeTokenDto.class); - confBuilder.loadAlias("ProjectDependency", ProjectDependencyDto.class); confBuilder.loadAlias("AnalysisPropertyValuePerProject", AnalysisPropertyValuePerProject.class); confBuilder.loadAlias("ProjectAlmKeyAndProject", ProjectAlmKeyAndProject.class); confBuilder.loadAlias("PrAndBranchCountByProjectDto", PrBranchAnalyzedLanguageCountByProjectDto.class); @@ -255,6 +253,7 @@ public class MyBatis { confBuilder.loadAlias("QualityGate", QualityGateDto.class); confBuilder.loadAlias("Resource", ResourceDto.class); confBuilder.loadAlias("RuleParam", RuleParamDto.class); + confBuilder.loadAlias("ScaDependency", ScaDependencyDto.class); confBuilder.loadAlias("SchemaMigration", SchemaMigrationDto.class); confBuilder.loadAlias("ScrapProperty", ScrapPropertyDto.class); confBuilder.loadAlias("ScrapAnalysisProperty", ScrapAnalysisPropertyDto.class); @@ -318,7 +317,6 @@ public class MyBatis { PluginMapper.class, PortfolioMapper.class, ProjectAlmSettingMapper.class, - ProjectDependenciesMapper.class, ProjectLinkMapper.class, ProjectMapper.class, ProjectBadgeTokenMapper.class, diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesDao.java deleted file mode 100644 index dd2429d7ba2..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesDao.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2025 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.dependency; - -import java.util.List; -import java.util.Optional; -import org.sonar.db.Dao; -import org.sonar.db.DbSession; -import org.sonar.db.Pagination; - -public class ProjectDependenciesDao implements Dao { - - private static ProjectDependenciesMapper mapper(DbSession session) { - return session.getMapper(ProjectDependenciesMapper.class); - } - - public void insert(DbSession session, ProjectDependencyDto projectDependencyDto) { - mapper(session).insert(projectDependencyDto); - } - - public void deleteByUuid(DbSession session, String uuid) { - mapper(session).deleteByUuid(uuid); - } - - public Optional<ProjectDependencyDto> selectByUuid(DbSession dbSession, String uuid) { - return Optional.ofNullable(mapper(dbSession).selectByUuid(uuid)); - } - - /** - * Retrieves all dependencies with a specific branch UUID, no other filtering is done by this method. - */ - public List<ProjectDependencyDto> selectByBranchUuid(DbSession dbSession, String branchUuid) { - return mapper(dbSession).selectByBranchUuid(branchUuid); - } - - public List<ProjectDependencyDto> selectByQuery(DbSession session, ProjectDependenciesQuery projectDependenciesQuery, Pagination pagination) { - return mapper(session).selectByQuery(projectDependenciesQuery, pagination); - } - - public int countByQuery(DbSession session, ProjectDependenciesQuery projectDependenciesQuery) { - return mapper(session).countByQuery(projectDependenciesQuery); - } - - public void update(DbSession session, ProjectDependencyDto projectDependencyDto) { - mapper(session).update(projectDependencyDto); - } -} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesMapper.java deleted file mode 100644 index b0047776c1a..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesMapper.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2025 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.dependency; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.sonar.db.Pagination; - -public interface ProjectDependenciesMapper { - void insert(ProjectDependencyDto dto); - - void deleteByUuid(String uuid); - - ProjectDependencyDto selectByUuid(String uuid); - - List<ProjectDependencyDto> selectByBranchUuid(String branchUuid); - - List<ProjectDependencyDto> selectByQuery(@Param("query") ProjectDependenciesQuery query, @Param("pagination") Pagination pagination); - - void update(ProjectDependencyDto dto); - - int countByQuery(@Param("query") ProjectDependenciesQuery query); -} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesQuery.java b/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesQuery.java deleted file mode 100644 index b4b2805e1da..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesQuery.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2025 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.dependency; - -import java.util.Locale; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static org.sonar.db.DaoUtils.buildLikeValue; -import static org.sonar.db.WildcardPosition.BEFORE_AND_AFTER; - -public final class ProjectDependenciesQuery { - private final String branchUuid; - @Nullable - private final String query; - - public ProjectDependenciesQuery(String branchUuid, @Nullable String query) { - this.branchUuid = branchUuid; - this.query = query; - } - - /** - * Used by MyBatis mapper - */ - @CheckForNull - public String getLikeQuery() { - return query == null ? null : buildLikeValue(query, BEFORE_AND_AFTER).toLowerCase(Locale.ENGLISH); - } - - public String branchUuid() { - return branchUuid; - } - - @Nullable - public String query() { - return query; - } - - -} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependencyDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependencyDto.java deleted file mode 100644 index 11eb2f297db..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependencyDto.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2025 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.dependency; - -import javax.annotation.Nullable; - -public record ProjectDependencyDto( - String uuid, - @Nullable String version, - @Nullable String includePaths, - @Nullable String packageManager, - Long createdAt, - Long updatedAt - ) { -} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/package-info.java b/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/package-info.java deleted file mode 100644 index 82e1f1e756b..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2025 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.dependency; - -import javax.annotation.ParametersAreNonnullByDefault; |