From: Sébastien Lesaint Date: Tue, 18 Oct 2016 16:15:39 +0000 (+0200) Subject: SONAR-8100 add GroupDao#deleteByOrganization X-Git-Tag: 6.2-RC1~323 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5d21ae8d7ff15fe76833159f880bd134710434b9;p=sonarqube.git SONAR-8100 add GroupDao#deleteByOrganization --- diff --git a/sonar-db/src/main/java/org/sonar/db/user/GroupDao.java b/sonar-db/src/main/java/org/sonar/db/user/GroupDao.java index 30ad7a49f28..a88029e17fb 100644 --- a/sonar-db/src/main/java/org/sonar/db/user/GroupDao.java +++ b/sonar-db/src/main/java/org/sonar/db/user/GroupDao.java @@ -71,6 +71,10 @@ public class GroupDao implements Dao { mapper(dbSession).deleteById(groupId); } + public void deleteByOrganization(DbSession dbSession, String organizationUuid) { + mapper(dbSession).deleteByOrganization(organizationUuid); + } + public int countByQuery(DbSession session, String organizationUuid, @Nullable String query) { return mapper(session).countByQuery(organizationUuid, groupSearchToSql(query)); } diff --git a/sonar-db/src/main/java/org/sonar/db/user/GroupMapper.java b/sonar-db/src/main/java/org/sonar/db/user/GroupMapper.java index d056931638a..cbb3e0dff7c 100644 --- a/sonar-db/src/main/java/org/sonar/db/user/GroupMapper.java +++ b/sonar-db/src/main/java/org/sonar/db/user/GroupMapper.java @@ -44,6 +44,8 @@ public interface GroupMapper { void deleteById(long groupId); + void deleteByOrganization(@Param("organizationUuid") String organizationUuid); + @CheckForNull GroupDto selectByName(@Param("organizationUuid") String organizationUuid, @Param("name") String name); diff --git a/sonar-db/src/main/resources/org/sonar/db/user/GroupMapper.xml b/sonar-db/src/main/resources/org/sonar/db/user/GroupMapper.xml index 45d71a4d7b6..bc74e334d7e 100644 --- a/sonar-db/src/main/resources/org/sonar/db/user/GroupMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/user/GroupMapper.xml @@ -46,6 +46,13 @@ + + delete from + groups + where + organization_uuid=#{organizationUuid,jdbcType=VARCHAR} + +