diff options
author | Léo Geoffroy <leo.geoffroy@sonarsource.com> | 2023-12-18 11:25:08 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-01-17 20:02:43 +0000 |
commit | d6fd3827d2e54ab066b15c2da0834f7a3c42d58e (patch) | |
tree | b4d38447b504384eeacfd8a398758dd4e27114b2 /server/sonar-db-dao/src/main/java/org/sonar/db | |
parent | 55a7cc58fdded3a0670a2409c0a2b44e018a8381 (diff) | |
download | sonarqube-d6fd3827d2e54ab066b15c2da0834f7a3c42d58e.tar.gz sonarqube-d6fd3827d2e54ab066b15c2da0834f7a3c42d58e.zip |
SONAR-21259 Add Dao methods for issues_fixed table
Diffstat (limited to 'server/sonar-db-dao/src/main/java/org/sonar/db')
6 files changed, 102 insertions, 0 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 a83bc824058..83ef19a5185 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 @@ -46,6 +46,7 @@ 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.issue.IssueFixedDao; import org.sonar.db.measure.LiveMeasureDao; import org.sonar.db.measure.MeasureDao; import org.sonar.db.metric.MetricDao; @@ -144,6 +145,7 @@ public class DaoModule extends Module { InternalPropertiesDao.class, IssueChangeDao.class, IssueDao.class, + IssueFixedDao.class, LiveMeasureDao.class, MeasureDao.class, MetricDao.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 159beb83745..a670f4fbca1 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 @@ -46,6 +46,7 @@ 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.issue.IssueFixedDao; import org.sonar.db.measure.LiveMeasureDao; import org.sonar.db.measure.MeasureDao; import org.sonar.db.metric.MetricDao; @@ -193,6 +194,7 @@ public class DbClient { private final GithubPermissionsMappingDao githubPermissionsMappingDao; private final RuleChangeDao ruleChangeDao; private final ProjectExportDao projectExportDao; + private final IssueFixedDao issueFixedDao; public DbClient(Database database, MyBatis myBatis, DBSessions dbSessions, Dao... daos) { this.database = database; @@ -285,6 +287,7 @@ public class DbClient { anticipatedTransitionDao = getDao(map, AnticipatedTransitionDao.class); ruleChangeDao = getDao(map, RuleChangeDao.class); projectExportDao = getDao(map, ProjectExportDao.class); + issueFixedDao = getDao(map, IssueFixedDao.class); } public DbSession openSession(boolean batch) { @@ -335,6 +338,10 @@ public class DbClient { return issueChangeDao; } + public IssueFixedDao issueFixedDao() { + return issueFixedDao; + } + public QualityProfileDao qualityProfileDao() { return qualityProfileDao; } 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 0d920488076..28b941519ce 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 @@ -77,6 +77,7 @@ import org.sonar.db.issue.ImpactDto; import org.sonar.db.issue.IssueChangeDto; import org.sonar.db.issue.IssueChangeMapper; import org.sonar.db.issue.IssueDto; +import org.sonar.db.issue.IssueFixedMapper; import org.sonar.db.issue.IssueMapper; import org.sonar.db.issue.NewCodeReferenceIssueDto; import org.sonar.db.issue.PrIssueDto; @@ -301,6 +302,7 @@ public class MyBatis { IsAliveMapper.class, IssueChangeMapper.class, IssueMapper.class, + IssueFixedMapper.class, MeasureMapper.class, MetricMapper.class, NewCodePeriodMapper.class, diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueFixedDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueFixedDao.java new file mode 100644 index 00000000000..e0cd66256a7 --- /dev/null +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueFixedDao.java @@ -0,0 +1,40 @@ +/* + * 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; +import org.sonar.db.Dao; +import org.sonar.db.DbSession; + +public class IssueFixedDao implements Dao { + + public void insert(DbSession dbSession, IssueFixedDto fixedIssue) { + mapper(dbSession).insert(fixedIssue); + } + + private static IssueFixedMapper mapper(DbSession session) { + return session.getMapper(IssueFixedMapper.class); + } + + public List<IssueFixedDto> selectByPullRequest(DbSession dbSession, @Param("pullRequestUuid") String pullRequestUuid) { + return mapper(dbSession).selectByPullRequest(pullRequestUuid); + } +} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueFixedDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueFixedDto.java new file mode 100644 index 00000000000..aeb19978f8e --- /dev/null +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueFixedDto.java @@ -0,0 +1,23 @@ +/* + * 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; + +public record IssueFixedDto(String pullRequestUuid, String issueKey) { +} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueFixedMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueFixedMapper.java new file mode 100644 index 00000000000..1970440b39a --- /dev/null +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueFixedMapper.java @@ -0,0 +1,28 @@ +/* + * 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; + +public interface IssueFixedMapper { + void insert(IssueFixedDto dto); + + List<IssueFixedDto> selectByPullRequest(String pullRequestUuid); +} |