From 97fa907f891466b4e622e500d6ef94cf4c7eea8f Mon Sep 17 00:00:00 2001 From: Sébastien Lesaint Date: Fri, 2 Mar 2018 14:02:03 +0100 Subject: GOV-325 trigger refresh of view with project and not with it anymore --- .../java/org/sonar/db/component/ComponentDao.java | 7 + .../org/sonar/db/component/ComponentMapper.java | 3 + .../org/sonar/db/component/ComponentMapper.xml | 16 ++ .../org/sonar/db/component/ComponentDaoTest.java | 181 ++++++++++++++++++++- 4 files changed, 206 insertions(+), 1 deletion(-) (limited to 'server') diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java index 535d585ad73..eeea7944264 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java @@ -265,6 +265,13 @@ public class ComponentDao implements Dao { return mapper(session).selectUuidsForQualifiers(Qualifiers.APP, Qualifiers.VIEW, Qualifiers.SUBVIEW); } + /** + * Used by Governance + */ + public Set selectViewKeysWithEnabledCopyOfProject(DbSession session, String projectUuid) { + return mapper(session).selectViewKeysWithEnabledCopyOfProject(projectUuid); + } + public List selectProjectsFromView(DbSession session, String viewUuid, String projectViewUuid) { return mapper(session).selectProjectsFromView("%." + viewUuid + ".%", projectViewUuid); } 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 4560af88e6c..95025cd3290 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 @@ -21,6 +21,7 @@ package org.sonar.db.component; import java.util.Collection; import java.util.List; +import java.util.Set; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.apache.ibatis.annotations.Param; @@ -120,6 +121,8 @@ public interface ComponentMapper { */ List selectUuidsByKeyFromProjectKey(@Param("projectKey") String projectKey); + Set selectViewKeysWithEnabledCopyOfProject(@Param("projectUuid") String projectUuid); + /** * Return technical projects from a view or a sub-view */ 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 0ba7f68f4e8..0473a825eb2 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 @@ -396,6 +396,22 @@ + +