]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-15259 Audit portfolios
authorJacek <jacek.poreda@sonarsource.com>
Wed, 1 Sep 2021 09:18:08 +0000 (11:18 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 8 Sep 2021 20:03:35 +0000 (20:03 +0000)
server/sonar-db-dao/src/main/java/org/sonar/db/portfolio/PortfolioDao.java
server/sonar-db-dao/src/main/java/org/sonar/db/portfolio/PortfolioMapper.java
server/sonar-db-dao/src/main/resources/org/sonar/db/portfolio/PortfolioMapper.xml

index 14b757459c429e1bc340ba6f91ee04d81b82f72f..5a70462b650e95ba7bf695c0fb1104e99cb05a81 100644 (file)
@@ -66,6 +66,10 @@ public class PortfolioDao implements Dao {
     return Optional.ofNullable(mapper(dbSession).selectByKey(key));
   }
 
+  public List<PortfolioDto> selectByKeys(DbSession dbSession, Set<String> portfolioDbKeys) {
+    return executeLargeInputs(portfolioDbKeys, input -> mapper(dbSession).selectByKeys(input));
+  }
+
   public Optional<PortfolioDto> 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);
   }
+
 }
index 4340b395686e69f2d3e87064a05bfa76ae3336a0..c337e8a1b46cd1f8b0a27ad596e4ee2c00f07831 100644 (file)
@@ -30,6 +30,8 @@ public interface PortfolioMapper {
   @CheckForNull
   PortfolioDto selectByKey(String key);
 
+  List<PortfolioDto> selectByKeys(@Param("keys")List<String> keys);
+
   @CheckForNull
   PortfolioDto selectByUuid(String uuid);
 
@@ -90,4 +92,6 @@ public interface PortfolioMapper {
   List<PortfolioProjectDto> selectAllPortfolioProjects();
 
   List<ReferenceDto> selectAllReferencesInHierarchy(String rootUuid);
+
+
 }
index 1281dfbec3979465de81a3efa0b8a89821add448..e39f210d60fdc75b267d00b076c61fa96a7adc7d 100644 (file)
       p.kee=#{kee,jdbcType=VARCHAR}
   </select>
 
+  <select id="selectByKeys" parameterType="String" resultType="Portfolio">
+    SELECT
+    <include refid="portfolioColumns"/>
+    FROM portfolios p
+    where
+    p.kee in
+    <foreach collection="keys" open="(" close=")" item="key" separator=",">
+      #{key,jdbcType=VARCHAR}
+    </foreach>
+  </select>
+
   <select id="selectAll" resultType="Portfolio">
     SELECT
     <include refid="portfolioColumns"/>