diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2022-11-17 14:33:31 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-12-14 20:03:52 +0000 |
commit | 22b8b6d4ad713c4abbca5c9b992e873499246b83 (patch) | |
tree | bd7f67fc3df1405ce4c78362bbf74d578f034f73 /server/sonar-db-dao | |
parent | 07219819ead9f5ee8a486334e60df575dc536811 (diff) | |
download | sonarqube-22b8b6d4ad713c4abbca5c9b992e873499246b83.tar.gz sonarqube-22b8b6d4ad713c4abbca5c9b992e873499246b83.zip |
[NO JIRA] Remove unused code
Diffstat (limited to 'server/sonar-db-dao')
32 files changed, 1 insertions, 439 deletions
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 72f8c31e770..07919816261 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 @@ -50,7 +50,6 @@ import org.sonar.db.component.AnalysisPropertyValuePerProject; import org.sonar.db.component.ApplicationProjectsMapper; import org.sonar.db.component.BranchMapper; import org.sonar.db.component.ComponentDto; -import org.sonar.db.component.ComponentDtoWithSnapshotId; import org.sonar.db.component.ComponentKeyUpdaterMapper; import org.sonar.db.component.ComponentMapper; import org.sonar.db.component.ComponentWithModuleUuidDto; @@ -194,7 +193,6 @@ public class MyBatis { confBuilder.loadAlias("CeTaskCharacteristic", CeTaskCharacteristicDto.class); confBuilder.loadAlias("Component", ComponentDto.class); confBuilder.loadAlias("ComponentWithModuleUuid", ComponentWithModuleUuidDto.class); - confBuilder.loadAlias("ComponentWithSnapshot", ComponentDtoWithSnapshotId.class); confBuilder.loadAlias("DuplicationUnit", DuplicationUnitDto.class); confBuilder.loadAlias("Event", EventDto.class); confBuilder.loadAlias("FilePathWithHash", FilePathWithHashDto.class); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/audit/AuditMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/audit/AuditMapper.java index 398d50b9e8e..2e2c85a9eca 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/audit/AuditMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/audit/AuditMapper.java @@ -27,8 +27,6 @@ public interface AuditMapper { void insert(@Param("dto") AuditDto auditDto); - void delete(@Param("uuids") List<String> uuids); - List<AuditDto> selectByPeriodPaginated(@Param("start")long start, @Param("end") long end, @Param("pagination") Pagination pagination); List<AuditDto> selectOlderThan(@Param("beforeTimestamp") long beforeTimestamp); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ApplicationProjectsDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ApplicationProjectsDao.java index 18b9e3272d2..ec0a3b1513b 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ApplicationProjectsDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ApplicationProjectsDao.java @@ -102,10 +102,6 @@ public class ApplicationProjectsDao implements Dao { return session.getMapper(ApplicationProjectsMapper.class); } - public void updateApplicationBranchName(DbSession dbSession, String applicationBranchUuid, String newName) { - getMapper(dbSession).updateApplicationBranchName(applicationBranchUuid, newName); - } - public void removeAllProjectBranchesOfAppBranch(DbSession dbSession, String applicationBranchUuid) { getMapper(dbSession).removeAllProjectBranchesOfAppBranch(applicationBranchUuid); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ApplicationProjectsMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ApplicationProjectsMapper.java index 4ef0376269f..8fcf9b64238 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ApplicationProjectsMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ApplicationProjectsMapper.java @@ -61,8 +61,6 @@ public interface ApplicationProjectsMapper { int countApplicationProjects(@Param("applicationUuid") String applicationUuid); - void updateApplicationBranchName(@Param("uuid") String uuid, @Param("newName") String newName); - Set<ProjectDto> selectApplicationsFromProjectBranch(@Param("projectUuid") String projectUuid, @Param("branchKey") String branchKey); Set<ProjectDto> selectApplicationsFromProjects(@Param("projectUuids") Collection<String> projectUuids); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDao.java index 39242c80ac6..1dff7ccc75b 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDao.java @@ -165,10 +165,6 @@ public class BranchDao implements Dao { return mapper(dbSession).updateNeedIssueSync(branchUuid, needIssueSync, now); } - public void deleteBranch(DbSession dbSession, String projectUuid, String branchKey) { - mapper(dbSession).deleteBranch(projectUuid, branchKey); - } - public boolean doAnyOfComponentsNeedIssueSync(DbSession session, List<String> components) { if (!components.isEmpty()) { List<Boolean> result = new LinkedList<>(); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchMapper.java index 691ef746cbd..eebd797906a 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchMapper.java @@ -34,8 +34,6 @@ public interface BranchMapper { int updateMainBranchName(@Param("projectUuid") String projectUuid, @Param("newBranchName") String newBranchName, @Param("now") long now); - int updateManualBaseline(@Param("uuid") String uuid, @Nullable @Param("analysisUuid") String analysisUuid, @Param("now") long now); - int updateExcludeFromPurge(@Param("uuid") String uuid, @Param("excludeFromPurge") boolean excludeFromPurge, @Param("now") long now); @@ -75,5 +73,4 @@ public interface BranchMapper { short doAnyOfComponentsNeedIssueSync(@Param("componentKeys") List<String> components); - void deleteBranch(@Param("projectUuid") String projectUuid, @Param("branchKey") String branchKey); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDtoWithSnapshotId.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDtoWithSnapshotId.java deleted file mode 100644 index c8c48686304..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDtoWithSnapshotId.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2022 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.component; - -public class ComponentDtoWithSnapshotId extends ComponentDto { - private Long snapshotId; - - public Long getSnapshotId() { - return snapshotId; - } - - public ComponentDtoWithSnapshotId setSnapshotId(Long snapshotId) { - this.snapshotId = snapshotId; - return this; - } -} 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 f669ff574df..52340ca7660 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 @@ -132,8 +132,6 @@ public interface ComponentMapper { void setPrivateForRootComponentUuid(@Param("branchUuid") String branchUuid, @Param("isPrivate") boolean isPrivate); - void delete(String componentUuid); - List<KeyWithUuidDto> selectComponentsFromPullRequestsTargetingCurrentBranchThatHaveOpenIssues(@Param("referenceBranchUuid") String referenceBranchUuid, @Param("currentBranchUuid") String currentBranchUuid); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDao.java index 80ccda2b0d7..f2fa7be583f 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDao.java @@ -71,11 +71,6 @@ public class IssueDao implements Dao { languages, Pagination.forPage(page).andSize(BIG_PAGE_SIZE)); } - public Set<String> selectIssueKeysByComponentUuidAndChangedSinceDate(DbSession session, String componentUuid, long changedSince, int page) { - return selectIssueKeysByComponentUuidAndChangedSinceDate(session, componentUuid, changedSince, emptyList(), emptyList(), - emptyList(), page); - } - public Set<String> selectIssueKeysByComponentUuidAndChangedSinceDate(DbSession session, String componentUuid, long changedSince, List<String> includingRepositories, List<String> excludingRepositories, List<String> languages, int page) { @@ -108,10 +103,6 @@ public class IssueDao implements Dao { return executeLargeInputs(componentUuids, mapper(dbSession)::selectOpenByComponentUuids); } - public Collection<HotspotGroupDto> selectBranchHotspotsCount(DbSession dbSession, String branchUuid, long leakPeriodBeginningDate) { - return mapper(dbSession).selectBranchHotspotsCount(branchUuid, leakPeriodBeginningDate); - } - public Collection<IssueGroupDto> selectIssueGroupsByComponent(DbSession dbSession, ComponentDto component, long leakPeriodBeginningDate) { return mapper(dbSession).selectIssueGroupsByComponent(component, leakPeriodBeginningDate); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java index f040fc89480..ff0d7a33731 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java @@ -76,8 +76,6 @@ public interface IssueMapper { List<IssueDto> selectNonClosedByModuleOrProject(@Param("projectUuid") String projectUuid, @Param("likeModuleUuidPath") String likeModuleUuidPath); - Collection<HotspotGroupDto> selectBranchHotspotsCount(@Param("rootUuid") String rootUuid, @Param("leakPeriodBeginningDate") long leakPeriodBeginningDate); - Collection<IssueGroupDto> selectIssueGroupsByComponent(@Param("component") ComponentDto component, @Param("leakPeriodBeginningDate") long leakPeriodBeginningDate); List<IssueDto> selectByBranch(@Param("keys") Set<String> keys, @Nullable @Param("changedSince") Long changedSince); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/measure/LiveMeasureDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/measure/LiveMeasureDao.java index 7bbdd0c44e6..b1cb9d7362f 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/measure/LiveMeasureDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/measure/LiveMeasureDao.java @@ -113,10 +113,6 @@ public class LiveMeasureDao implements Dao { mapper(dbSession).insert(dto, Uuids.create(), system2.now()); } - public void update(DbSession dbSession, LiveMeasureDto dto) { - mapper(dbSession).update(dto, system2.now()); - } - public void insertOrUpdate(DbSession dbSession, LiveMeasureDto dto) { LiveMeasureMapper mapper = mapper(dbSession); long now = system2.now(); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/newcodeperiod/NewCodePeriodDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/newcodeperiod/NewCodePeriodDao.java index 82b2d02702b..c59df0ef221 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/newcodeperiod/NewCodePeriodDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/newcodeperiod/NewCodePeriodDao.java @@ -90,13 +90,6 @@ public class NewCodePeriodDao implements Dao { return ofNullable(mapper(dbSession).selectByBranch(projectUuid, branchUuid)); } - public NewCodePeriodDto selectBestMatchForBranch(DbSession dbSession, String projectUuid, String branchUuid) { - return selectByBranch(dbSession, projectUuid, branchUuid) - .or(() -> selectByProject(dbSession, projectUuid) - .or(() -> selectGlobal(dbSession))) - .orElse(NewCodePeriodDto.defaultInstance()); - } - public Set<String> selectBranchesReferencing(DbSession dbSession, String projectUuid, String referenceBranchName) { return mapper(dbSession).selectBranchesReferencing(projectUuid, referenceBranchName); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/newcodeperiod/NewCodePeriodParser.java b/server/sonar-db-dao/src/main/java/org/sonar/db/newcodeperiod/NewCodePeriodParser.java index bd34248c777..fb0631c7d72 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/newcodeperiod/NewCodePeriodParser.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/newcodeperiod/NewCodePeriodParser.java @@ -26,10 +26,6 @@ public class NewCodePeriodParser { // static only } - public static LocalDate parseDate(String value) { - return LocalDate.parse(value); - } - public static int parseDays(String value) { return Integer.parseInt(value); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/template/PermissionTemplateMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/permission/template/PermissionTemplateMapper.java index e20f17a29f9..7fa547b06e2 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/template/PermissionTemplateMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/permission/template/PermissionTemplateMapper.java @@ -38,20 +38,14 @@ public interface PermissionTemplateMapper { int deleteByUuid(String templateUuid); - void deleteByUuids(@Param("templateUuids") List<String> templateUuids); - void deleteUserPermissionsByTemplateUuid(String templateUuid); - void deleteUserPermissionsByTemplateUuids(@Param("templateUuids") List<String> templateUuids); - int deleteUserPermissionsByUserUuid(@Param("userUuid") String userUuid); int deleteUserPermission(PermissionTemplateUserDto permissionTemplateUser); void deleteGroupPermissionsByTemplateUuid(String templateUuid); - void deleteGroupPermissionsByTemplateUuids(@Param("templateUuids") List<String> templateUuids); - int deleteGroupPermission(PermissionTemplateGroupDto permissionTemplateGroup); PermissionTemplateDto selectByUuid(String templateUuid); @@ -86,8 +80,6 @@ public interface PermissionTemplateMapper { int countGroupsWithPermission(@Param("templateUuid") String templateUuid, @Param("permission") String permission, @Nullable @Param("groupUuid") String groupUuid); - List<String> selectTemplateUuids(); - List<PermissionTemplateGroupDto> selectAllGroupPermissionTemplatesByGroupUuid(@Param("groupUuid") String groupUuid); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/plugin/PluginMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/plugin/PluginMapper.java index d71ce79afec..c14edc192e8 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/plugin/PluginMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/plugin/PluginMapper.java @@ -34,5 +34,4 @@ public interface PluginMapper { void update(PluginDto dto); - void delete(@Param("uuid") String uuid); } 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 3fc983b8eb4..3b2b3096964 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 @@ -47,8 +47,6 @@ public interface ProjectMapper { List<ProjectDto> selectAll(); - void updateKey(@Param("uuid") String uuid, @Param("newKey") String newKey, @Param("updatedAt") long updatedAt); - void updateTags(ProjectDto project); void update(ProjectDto project); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesMapper.java index 47006f65dbd..50faa522fa8 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesMapper.java @@ -34,8 +34,6 @@ public interface PropertiesMapper { List<PropertyDto> selectGlobalProperties(); - List<PropertyDto> selectProjectProperties(String resourceKey); - PropertyDto selectByKey(PropertyDto key); List<PropertyDto> selectByKeys(@Param("keys") List<String> keys); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/qualitygate/ProjectQgateAssociation.java b/server/sonar-db-dao/src/main/java/org/sonar/db/qualitygate/ProjectQgateAssociation.java deleted file mode 100644 index e910bb49987..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/qualitygate/ProjectQgateAssociation.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2022 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.qualitygate; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - -public class ProjectQgateAssociation { - - private Long id; - private String name; - private boolean isMember; - - public Long id() { - return id; - } - - public ProjectQgateAssociation setId(Long id) { - this.id = id; - return this; - } - - public String name() { - return name; - } - - public ProjectQgateAssociation setName(String name) { - this.name = name; - return this; - } - - public boolean isMember() { - return isMember; - } - - public ProjectQgateAssociation setMember(boolean isMember) { - this.isMember = isMember; - return this; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ProjectQgateAssociation that = (ProjectQgateAssociation) o; - return name.equals(that.name); - } - - @Override - public int hashCode() { - return name.hashCode(); - } -} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleMapper.java index 968adaa370f..060fdf65549 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleMapper.java @@ -43,8 +43,6 @@ public interface ActiveRuleMapper { @CheckForNull ActiveRuleDto selectByKey(@Param("ruleProfileUuid") String ruleProfileUuid, @Param("repository") String repository, @Param("rule") String rule); - List<ActiveRuleDto> selectByKeys(@Param("keys") List<ActiveRuleKey> keys); - List<OrgActiveRuleDto> selectOrgByRuleUuid(@Param("ruleUuid") String ruleUuid); List<ActiveRuleDto> selectByRuleUuid(String ruleUuid); @@ -86,5 +84,4 @@ public interface ActiveRuleMapper { void scrollByRuleProfileUuidForIndexing(@Param("ruleProfileUuid") String ruleProfileUuid, ResultHandler<IndexedActiveRuleDto> handler); - List<OrgActiveRuleDto> selectByQualityProfileUuid(@Param("qualityProfileUuid") String qualityProfileUuid); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleRepositoryMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleRepositoryMapper.java index 6a2c9d2c119..fbb70f7e5ba 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleRepositoryMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleRepositoryMapper.java @@ -34,9 +34,6 @@ public interface RuleRepositoryMapper { List<RuleRepositoryDto> selectByQueryAndLanguage(@Param("query") String query,@Param("language") @Nullable String language); - @CheckForNull - RuleRepositoryDto selectByKey(@Param("key") String key); - void insert(@Param("repository") RuleRepositoryDto repository, @Param("now") long now); void update(@Param("repository") RuleRepositoryDto repository); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipDao.java index 67e8fbc5467..40c1c872f20 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipDao.java @@ -70,15 +70,6 @@ public class GroupMembershipDao implements Dao { return result; } - public Map<String, Integer> countGroupsByUsers(DbSession dbSession, List<String> logins) { - List<LoginGroupCount> loginGroupCount = mapper(dbSession).countGroupsByUsers(logins); - Map<String, Integer> map = new HashMap<>(); - for (LoginGroupCount l : loginGroupCount) { - map.put(l.login(), l.groupCount()); - } - return map; - } - public List<String> selectGroupUuidsByUserUuid(DbSession dbSession, String userUuid) { return mapper(dbSession).selectGroupUuidsByUserUuid(userUuid); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipMapper.java index d3577a92cd9..d05947b4e09 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipMapper.java @@ -36,8 +36,6 @@ public interface GroupMembershipMapper { List<GroupUserCount> countUsersByGroup(@Param("groupUuids") List<String> groupUuids); - List<LoginGroupCount> countGroupsByUsers(@Param("logins") List<String> logins); - List<LoginGroup> selectGroupsByLogins(@Param("logins") List<String> logins); List<String> selectGroupUuidsByUserUuid(@Param("userUuid") String userUuid); diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/audit/AuditMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/audit/AuditMapper.xml index f0d9c9249b4..edf3aaa7329 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/audit/AuditMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/audit/AuditMapper.xml @@ -110,15 +110,4 @@ where uuid in (select a.uuid from audits a where a.created_at < #{threshold,jdbcType=BIGINT} order by a.created_at fetch first 100000 rows only) </delete> - - <delete id="deleteByUuids" parameterType="string"> - delete - from audits - where - uuid in - <foreach collection="uuids" open="(" close=")" item="uuid" separator=","> - #{uuid,jdbcType=VARCHAR} - </foreach> - </delete> - </mapper> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ApplicationProjectsMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ApplicationProjectsMapper.xml index 747ce122c2b..0217e510910 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ApplicationProjectsMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ApplicationProjectsMapper.xml @@ -158,15 +158,6 @@ ap.application_uuid = #{applicationUuid,jdbcType=VARCHAR} </select> - <update id="updateApplicationBranchName" parameterType="String"> - UPDATE - project_branches - SET - kee = #{newName,jdbcType=VARCHAR} - WHERE - uuid = #{uuid,jdbcType=VARCHAR} - </update> - <select id="selectApplicationsFromProjectBranch" parameterType="String" resultType="Project"> SELECT <include refid="projectColumns"/> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/BranchMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/BranchMapper.xml index fcfae3b120a..ab077238c9f 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/BranchMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/BranchMapper.xml @@ -48,13 +48,6 @@ uuid = #{projectUuid, jdbcType=VARCHAR} </update> - <delete id="deleteBranch" parameterType="string"> - delete from project_branches - where - project_uuid = #{projectUuid, jdbcType=VARCHAR}, - kee = #{branchKey, jdbcType=VARCHAR} - </delete> - <update id="updateExcludeFromPurge"> update project_branches set diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml index 76ca07cef96..5605626e4b8 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml @@ -782,10 +782,6 @@ and private <> #{isPrivate,jdbcType=BOOLEAN} </update> - <delete id="delete" parameterType="String"> - DELETE FROM components WHERE uuid=#{componentUuid,jdbcType=VARCHAR} - </delete> - <select id="selectComponentsFromPullRequestsTargetingCurrentBranchThatHaveOpenIssues" resultType="KeyWithUuid"> SELECT DISTINCT p.kee as kee, p.uuid as uuid FROM components p JOIN issues i diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml index 84824708ea9..655c142af2e 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml @@ -359,66 +359,6 @@ i.issue_type <> 4 </select> - <select id="selectBranchHotspotsCount" resultType="org.sonar.db.issue.HotspotGroupDto" parameterType="map"> - select i.status as status, count(i.status) as "count", - <if test="leakPeriodBeginningDate >= 0"> - (i.issue_creation_date > #{leakPeriodBeginningDate,jdbcType=BIGINT}) as inLeak - </if> - <if test="leakPeriodBeginningDate < 0"> - CASE WHEN n.uuid is null THEN false ELSE true END as inLeak - </if> - from issues i - <if test="leakPeriodBeginningDate < 0"> - left join new_code_reference_issues n on n.issue_key = i.kee - </if> - where i.project_uuid = #{rootUuid,jdbcType=VARCHAR} - and i.status !='CLOSED' - and i.issue_type = 4 - group by i.status, inLeak - </select> - - <select id="selectBranchHotspotsCount" resultType="org.sonar.db.issue.HotspotGroupDto" parameterType="map" databaseId="oracle"> - select i2.status as status, count(i2.status) as "count", i2.inLeak as inLeak - from ( - select i.status, - <if test="leakPeriodBeginningDate >= 0"> - case when i.issue_creation_date > #{leakPeriodBeginningDate,jdbcType=BIGINT} then 1 else 0 end as inLeak - </if> - <if test="leakPeriodBeginningDate < 0"> - case when n.uuid is null then 0 else 1 end as inLeak - </if> - from issues i - <if test="leakPeriodBeginningDate < 0"> - left join new_code_reference_issues n on n.issue_key = i.kee - </if> - where i.project_uuid = #{rootUuid,jdbcType=VARCHAR} - and i.status !='CLOSED' - and i.issue_type = 4 - ) i2 - group by i2.status, i2.inLeak - </select> - - <select id="selectBranchHotspotsCount" resultType="org.sonar.db.issue.HotspotGroupDto" parameterType="map" databaseId="mssql"> - select i2.status as status, count(i2.status) as "count", i2.inLeak as inLeak - from ( - select i.status, - <if test="leakPeriodBeginningDate >= 0"> - case when i.issue_creation_date > #{leakPeriodBeginningDate,jdbcType=BIGINT} then 1 else 0 end as inLeak - </if> - <if test="leakPeriodBeginningDate < 0"> - case when n.uuid is null then 0 else 1 end as inLeak - </if> - from issues i - <if test="leakPeriodBeginningDate < 0"> - left join new_code_reference_issues n on n.issue_key = i.kee - </if> - where i.project_uuid = #{rootUuid,jdbcType=VARCHAR} - and i.status !='CLOSED' - and i.issue_type = 4 - ) i2 - group by i2.status, i2.inLeak - </select> - <select id="selectIssueGroupsByComponent" resultType="org.sonar.db.issue.IssueGroupDto" parameterType="map"> select i.issue_type as ruleType, i.severity as severity, i.resolution as resolution, i.status as status, sum(i.effort) as effort, count(i.issue_type) as "count", <if test="leakPeriodBeginningDate >= 0"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateMapper.xml index 8c9a5c8d2e0..0ced621cbd7 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateMapper.xml @@ -25,15 +25,6 @@ WHERE uuid = #{uuid} </delete> - <delete id="deleteByUuids" parameterType="String"> - delete from - permission_templates - where - uuid in <foreach collection="templateUuids" open="(" close=")" item="uuid" separator=","> - #{uuid,jdbcType=BIGINT} - </foreach> - </delete> - <delete id="deleteUserPermissionsByTemplateUuid" parameterType="string"> delete from perm_templates_users @@ -41,15 +32,6 @@ template_uuid = #{templateUuid,jdbcType=VARCHAR} </delete> - <delete id="deleteUserPermissionsByTemplateUuids"> - delete from - perm_templates_users - where - template_uuid in <foreach collection="templateUuids" open="(" close=")" item="templateUuid" separator=","> - #{templateUuid,jdbcType=BIGINT} - </foreach> - </delete> - <delete id="deleteUserPermission" parameterType="PermissionTemplateUser"> DELETE FROM perm_templates_users WHERE template_uuid = #{templateUuid} @@ -70,15 +52,6 @@ template_uuid = #{templateUuid,jdbcType=VARCHAR} </delete> - <delete id="deleteGroupPermissionsByTemplateUuids"> - delete from - perm_templates_groups - where - template_uuid in <foreach collection="templateUuids" open="(" close=")" item="templateUuid" separator=","> - #{templateUuid,jdbcType=VARCHAR} - </foreach> - </delete> - <delete id="deleteGroupPermission" parameterType="PermissionTemplateGroup"> DELETE FROM perm_templates_groups WHERE template_uuid = #{templateUuid} @@ -389,13 +362,6 @@ </if> </select> - <select id="selectTemplateUuidsn" resultType="String"> - select - uuid - from - permission_templates - </select> - <select id="selectAllGroupPermissionTemplatesByGroupUuid" parameterType="string" resultType="PermissionTemplateGroup"> SELECT ptg.uuid, 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 87ee3c5edce..1da38dd2e06 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 @@ -170,15 +170,7 @@ uuid = #{uuid,jdbcType=VARCHAR} </update> - <update id="updateKey"> - update projects set - kee = #{newKey,jdbcType=VARCHAR}, - updated_at = #{updatedAt,jdbcType=BIGINT} - where - uuid = #{uuid,jdbcType=VARCHAR} - </update> - - <update id="updateVisibility"> + <update id="updateVisibility"> update projects set private = #{isPrivate,jdbcType=BOOLEAN}, updated_at = #{updatedAt,jdbcType=BIGINT} diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/property/PropertiesMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/property/PropertiesMapper.xml index 40e2a56a551..f1f3f77500a 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/property/PropertiesMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/property/PropertiesMapper.xml @@ -94,18 +94,6 @@ and p.user_uuid is null </select> - <select id="selectProjectProperties" parameterType="String" resultType="ScrapProperty"> - select - <include refid="columnsToScrapPropertyDto"/> - from - properties p, - components r - where - p.component_uuid=r.uuid - and p.user_uuid is null - and r.kee=#{resourceKey,jdbcType=VARCHAR} - </select> - <select id="selectByKey" parameterType="map" resultType="ScrapProperty"> select <include refid="columnsToScrapPropertyDto"/> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/ActiveRuleMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/ActiveRuleMapper.xml index 84a298f7dcc..d450e04b1a0 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/ActiveRuleMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/ActiveRuleMapper.xml @@ -102,20 +102,6 @@ and r.plugin_name = #{repository, jdbcType=VARCHAR} </select> - <select id="selectByKeys" parameterType="map" resultType="ActiveRule"> - select - <include refid="activeRuleColumns"/> - from active_rules a - <include refid="activeRuleKeyJoin"/> - where - <foreach collection="keys" item="key" open="(" separator=" or " close=")"> - (rp.uuid = #{key.ruleProfileUuid, jdbcType=VARCHAR} - AND r.plugin_rule_key = #{key.ruleKey.rule, jdbcType=VARCHAR} - AND r.plugin_name = #{key.ruleKey.repository, jdbcType=VARCHAR} - ) - </foreach> - </select> - <select id="selectByProfileUuid" parameterType="string" resultType="org.sonar.db.qualityprofile.OrgActiveRuleDto"> select <include refid="orgActiveRuleColumns"/> diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java index f575c82df67..64a8d59cf36 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java @@ -192,20 +192,6 @@ public class IssueDaoTest { } @Test - public void selectIssueKeysByComponentUuidAndChangedSince() { - long t1 = 1_340_000_000_000L; - long t2 = 1_400_000_000_000L; - // contains I1 and I2 - prepareTables(); - // Insert I3, I4, where t1 < t2 - IntStream.range(3, 5).forEach(i -> underTest.insert(db.getSession(), newIssueDto("I" + i).setUpdatedAt(t1))); - - Set<String> issues = underTest.selectIssueKeysByComponentUuidAndChangedSinceDate(db.getSession(), PROJECT_UUID, t2, 1); - - assertThat(issues).contains("I1"); - } - - @Test public void selectIssueKeysByComponentUuidAndChangedSinceFiltersAccordingly() { long t1 = 1_340_000_000_000L; long t2 = 1_400_000_000_000L; @@ -422,16 +408,6 @@ public class IssueDaoTest { } @Test - public void test_selectBranchHotspotsCount_on_component_without_issues() { - ComponentDto project = db.components().insertPublicProject(); - ComponentDto file = db.components().insertComponent(ComponentTesting.newFileDto(project)); - - Collection<HotspotGroupDto> groups = underTest.selectBranchHotspotsCount(db.getSession(), project.uuid(), 1_000L); - - assertThat(groups).isEmpty(); - } - - @Test public void selectByKey_givenOneIssueWithQuickFix_selectOneIssueWithQuickFix() { prepareIssuesComponent(); underTest.insert(db.getSession(), newIssueDto(ISSUE_KEY1) @@ -551,74 +527,6 @@ public class IssueDaoTest { } @Test - public void selectBranchHotspotsCount_on_project() { - ComponentDto project = db.components().insertPublicProject(); - ComponentDto file = db.components().insertComponent(ComponentTesting.newFileDto(project)); - RuleDto rule = db.rules().insert(); - IssueDto i1 = db.issues().insert(rule, project, file, - i -> i.setStatus("REVIEWED").setResolution("SAFE").setSeverity("CRITICAL").setType(RuleType.SECURITY_HOTSPOT).setIssueCreationTime(1_500L)); - IssueDto i2 = db.issues().insert(rule, project, file, - i -> i.setStatus("TO_REVIEW").setResolution(null).setSeverity("CRITICAL").setType(RuleType.SECURITY_HOTSPOT).setIssueCreationTime(1_600L)); - IssueDto i3 = db.issues().insert(rule, project, file, - i -> i.setStatus("TO_REVIEW").setResolution(null).setSeverity("CRITICAL").setType(RuleType.SECURITY_HOTSPOT).setIssueCreationTime(1_700L)); - - // closed issues or other types are ignored - IssueDto closed = db.issues().insert(rule, project, file, - i -> i.setStatus("CLOSED").setResolution("REMOVED").setSeverity("CRITICAL").setType(RuleType.BUG).setIssueCreationTime(1_700L)); - IssueDto bug = db.issues().insert(rule, project, file, - i -> i.setStatus("OPEN").setResolution(null).setSeverity("CRITICAL").setType(RuleType.BUG).setIssueCreationTime(1_700L)); - - Collection<HotspotGroupDto> result = underTest.selectBranchHotspotsCount(db.getSession(), project.uuid(), 1_000L); - - assertThat(result.stream().mapToLong(HotspotGroupDto::getCount).sum()).isEqualTo(3); - - assertThat(result.stream().filter(g -> g.getStatus().equals("TO_REVIEW")).mapToLong(HotspotGroupDto::getCount).sum()).isEqualTo(2); - assertThat(result.stream().filter(g -> g.getStatus().equals("REVIEWED")).mapToLong(HotspotGroupDto::getCount).sum()).isOne(); - assertThat(result.stream().filter(g -> g.getStatus().equals("CLOSED")).mapToLong(HotspotGroupDto::getCount).sum()).isZero(); - - assertThat(result.stream().filter(HotspotGroupDto::isInLeak).mapToLong(HotspotGroupDto::getCount).sum()).isEqualTo(3); - assertThat(result.stream().filter(g -> !g.isInLeak()).mapToLong(HotspotGroupDto::getCount).sum()).isZero(); - - // test leak - result = underTest.selectBranchHotspotsCount(db.getSession(), project.uuid(), 999_999_999L); - assertThat(result.stream().filter(HotspotGroupDto::isInLeak).mapToLong(HotspotGroupDto::getCount).sum()).isZero(); - assertThat(result.stream().filter(g -> !g.isInLeak()).mapToLong(HotspotGroupDto::getCount).sum()).isEqualTo(3); - } - - @Test - public void selectBranchHotspotsCount_on_project_with_reference_branch() { - ComponentDto project = db.components().insertPublicProject(); - ComponentDto file = db.components().insertComponent(ComponentTesting.newFileDto(project)); - RuleDto rule = db.rules().insert(); - IssueDto i1 = db.issues().insert(rule, project, file, - i -> i.setStatus("REVIEWED").setResolution("SAFE").setSeverity("CRITICAL").setType(RuleType.SECURITY_HOTSPOT).setIssueCreationTime(1_500L)); - IssueDto i2 = db.issues().insert(rule, project, file, - i -> i.setStatus("TO_REVIEW").setResolution(null).setSeverity("CRITICAL").setType(RuleType.SECURITY_HOTSPOT).setIssueCreationTime(1_600L)); - IssueDto i3 = db.issues().insert(rule, project, file, - i -> i.setStatus("TO_REVIEW").setResolution(null).setSeverity("CRITICAL").setType(RuleType.SECURITY_HOTSPOT).setIssueCreationTime(1_700L)); - - // closed issues or other types are ignored - IssueDto closed = db.issues().insert(rule, project, file, - i -> i.setStatus("CLOSED").setResolution("REMOVED").setSeverity("CRITICAL").setType(RuleType.BUG).setIssueCreationTime(1_700L)); - IssueDto bug = db.issues().insert(rule, project, file, - i -> i.setStatus("OPEN").setResolution(null).setSeverity("CRITICAL").setType(RuleType.BUG).setIssueCreationTime(1_700L)); - - db.issues().insertNewCodeReferenceIssue(i1); - db.issues().insertNewCodeReferenceIssue(bug); - - Collection<HotspotGroupDto> result = underTest.selectBranchHotspotsCount(db.getSession(), project.uuid(), -1); - - assertThat(result.stream().mapToLong(HotspotGroupDto::getCount).sum()).isEqualTo(3); - - assertThat(result.stream().filter(g -> g.getStatus().equals("TO_REVIEW")).mapToLong(HotspotGroupDto::getCount).sum()).isEqualTo(2); - assertThat(result.stream().filter(g -> g.getStatus().equals("REVIEWED")).mapToLong(HotspotGroupDto::getCount).sum()).isOne(); - assertThat(result.stream().filter(g -> g.getStatus().equals("CLOSED")).mapToLong(HotspotGroupDto::getCount).sum()).isZero(); - - assertThat(result.stream().filter(HotspotGroupDto::isInLeak).mapToLong(HotspotGroupDto::getCount).sum()).isEqualTo(1); - assertThat(result.stream().filter(g -> !g.isInLeak()).mapToLong(HotspotGroupDto::getCount).sum()).isEqualTo(2); - } - - @Test public void selectModuleAndDirComponentUuidsOfOpenIssuesForProjectUuid() { assertThat(underTest.selectModuleAndDirComponentUuidsOfOpenIssuesForProjectUuid(db.getSession(), randomAlphabetic(12))) .isEmpty(); |