From: Julien Lancelot Date: Mon, 4 Dec 2017 15:51:34 +0000 (+0100) Subject: SONAR-10134 Add organization parameter in api/qualitygates/list X-Git-Tag: 7.0-RC1~150 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8bce129e9efa0cd8573e8f817ac32979fd43cfcc;p=sonarqube.git SONAR-10134 Add organization parameter in api/qualitygates/list --- diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/qualitygate/QualityGateDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/qualitygate/QualityGateDao.java index 11a5a704ca2..4c109c56ba9 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/qualitygate/QualityGateDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/qualitygate/QualityGateDao.java @@ -38,8 +38,8 @@ public class QualityGateDao implements Dao { mapper(dbSession).insertOrgQualityGate(uuid, organization.getUuid(), qualityGate.getUuid()); } - public Collection selectAll(DbSession session) { - return mapper(session).selectAll(); + public Collection selectAll(DbSession session, OrganizationDto organization) { + return mapper(session).selectAll(organization.getUuid()); } @CheckForNull diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/qualitygate/QualityGateMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/qualitygate/QualityGateMapper.java index e60464e237c..4d2d37058a5 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/qualitygate/QualityGateMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/qualitygate/QualityGateMapper.java @@ -28,7 +28,7 @@ public interface QualityGateMapper { void insertOrgQualityGate(@Param("uuid") String uuid, @Param("organizationUuid") String organizationUuid, @Param("qualityGateUuid") String qualityGateUuuid); - List selectAll(); + List selectAll(@Param("organizationUuid") String organizationUuid); QualityGateDto selectByName(String name); diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/QualityGateMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/QualityGateMapper.xml index ad1cedba967..ef19f754d53 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/QualityGateMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/QualityGateMapper.xml @@ -27,11 +27,13 @@ VALUES (#{uuid, jdbcType=VARCHAR}, #{organizationUuid, jdbcType=VARCHAR}, #{qualityGateUuid, jdbcType=VARCHAR}) - + SELECT + + FROM quality_gates qg + INNER JOIN + org_quality_gates oqg ON oqg.quality_gate_uuid = qg.uuid AND oqg.organization_uuid = #{organizationUuid, jdbcType=VARCHAR} + ORDER BY qg.name ASC