From eded18b4837348b53770b13786e141dee515a0d8 Mon Sep 17 00:00:00 2001 From: Jacek Date: Wed, 1 Sep 2021 11:18:08 +0200 Subject: [PATCH] SONAR-15259 Audit portfolios --- .../java/org/sonar/db/portfolio/PortfolioDao.java | 5 +++++ .../java/org/sonar/db/portfolio/PortfolioMapper.java | 4 ++++ .../org/sonar/db/portfolio/PortfolioMapper.xml | 11 +++++++++++ 3 files changed, 20 insertions(+) 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 14b757459c4..5a70462b650 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 @@ -66,6 +66,10 @@ public class PortfolioDao implements Dao { return Optional.ofNullable(mapper(dbSession).selectByKey(key)); } + public List selectByKeys(DbSession dbSession, Set portfolioDbKeys) { + return executeLargeInputs(portfolioDbKeys, input -> mapper(dbSession).selectByKeys(input)); + } + public Optional selectByUuid(DbSession dbSession, String uuid) { return Optional.ofNullable(mapper(dbSession).selectByUuid(uuid)); } @@ -199,4 +203,5 @@ public class PortfolioDao implements Dao { private static PortfolioMapper mapper(DbSession session) { return session.getMapper(PortfolioMapper.class); } + } 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 4340b395686..c337e8a1b46 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 @@ -30,6 +30,8 @@ public interface PortfolioMapper { @CheckForNull PortfolioDto selectByKey(String key); + List selectByKeys(@Param("keys")List keys); + @CheckForNull PortfolioDto selectByUuid(String uuid); @@ -90,4 +92,6 @@ public interface PortfolioMapper { List selectAllPortfolioProjects(); List selectAllReferencesInHierarchy(String rootUuid); + + } diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/portfolio/PortfolioMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/portfolio/PortfolioMapper.xml index 1281dfbec39..e39f210d60f 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/portfolio/PortfolioMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/portfolio/PortfolioMapper.xml @@ -55,6 +55,17 @@ p.kee=#{kee,jdbcType=VARCHAR} + +