From: Sébastien Lesaint Date: Fri, 2 Jun 2017 09:52:36 +0000 (+0200) Subject: make naming of method in PurgeMapper consistent X-Git-Tag: 6.5-M1~108 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6ce959d53aa9b100f786db32a4231454702e5040;p=sonarqube.git make naming of method in PurgeMapper consistent --- diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java index 8df3dfbc83b..7e6c0f1bf6f 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java @@ -58,7 +58,7 @@ class PurgeCommands { void deleteAnalyses(String rootUuid) { profiler.start("deleteAnalyses (events)"); - purgeMapper.deleteComponentEvents(rootUuid); + purgeMapper.deleteEventsByComponentUuid(rootUuid); session.commit(); profiler.stop(); @@ -134,31 +134,31 @@ class PurgeCommands { void deletePermissions(long rootId) { profiler.start("deletePermissions (group_roles)"); - purgeMapper.deleteComponentGroupRoles(rootId); + purgeMapper.deleteGroupRolesByComponentId(rootId); session.commit(); profiler.stop(); profiler.start("deletePermissions (user_roles)"); - purgeMapper.deleteComponentUserRoles(rootId); + purgeMapper.deleteUserRolesByComponentId(rootId); session.commit(); profiler.stop(); } void deleteIssues(String rootUuid) { profiler.start("deleteIssues (issue_changes)"); - purgeMapper.deleteComponentIssueChanges(rootUuid); + purgeMapper.deleteIssueChangesByProjectUuid(rootUuid); session.commit(); profiler.stop(); profiler.start("deleteIssues (issues)"); - purgeMapper.deleteComponentIssues(rootUuid); + purgeMapper.deleteIssuesByProjectUuid(rootUuid); session.commit(); profiler.stop(); } void deleteLinks(String rootUuid) { profiler.start("deleteLinks (project_links)"); - purgeMapper.deleteComponentLinks(rootUuid); + purgeMapper.deleteProjectLinksByComponentUuid(rootUuid); session.commit(); profiler.stop(); } @@ -168,19 +168,19 @@ class PurgeCommands { List> uuidsPartitions = Lists.partition(IdUuidPairs.uuids(rootAndModulesOrSubviewsIds), MAX_RESOURCES_PER_QUERY); profiler.start("deleteByRootAndModulesOrSubviews (properties)"); - idPartitions.forEach(purgeMapper::deleteComponentProperties); + idPartitions.forEach(purgeMapper::deletePropertiesByComponentIds); session.commit(); profiler.stop(); profiler.start("deleteByRootAndModulesOrSubviews (manual_measures)"); - uuidsPartitions.forEach(purgeMapper::deleteComponentManualMeasures); + uuidsPartitions.forEach(purgeMapper::deleteManualMeasuresByComponentUuids); session.commit(); profiler.stop(); } void deleteComponents(String rootUuid) { profiler.start("deleteComponents (projects)"); - purgeMapper.deleteComponents(rootUuid); + purgeMapper.deleteComponentsByProjectUuid(rootUuid); session.commit(); profiler.stop(); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java index 216a92217e1..59b621b7747 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java @@ -126,7 +126,7 @@ public class PurgeDao implements Dao { PurgeMapper mapper = mapper(session); executeLargeInputs(conf.getDisabledComponentUuids(), input -> { - mapper.deleteFileSourcesByUuid(input); + mapper.deleteFileSourcesByFileUuid(input); mapper.resolveComponentIssuesNotAlreadyResolved(input, system2.now()); return emptyList(); }); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java index 6889113e7ae..6ea23a7994b 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java @@ -50,27 +50,27 @@ public interface PurgeMapper { void resolveComponentIssuesNotAlreadyResolved(@Param("componentUuids") List componentUuids, @Param("dateAsLong") Long dateAsLong); - void deleteComponentLinks(@Param("rootUuid") String rootUuid); + void deleteProjectLinksByComponentUuid(@Param("rootUuid") String rootUuid); - void deleteComponentProperties(@Param("componentIds") List componentIds); + void deletePropertiesByComponentIds(@Param("componentIds") List componentIds); - void deleteComponents(@Param("rootUuid") String rootUuid); + void deleteComponentsByProjectUuid(@Param("rootUuid") String rootUuid); - void deleteComponentGroupRoles(@Param("rootId") long rootId); + void deleteGroupRolesByComponentId(@Param("rootId") long rootId); - void deleteComponentUserRoles(@Param("rootId") long rootId); + void deleteUserRolesByComponentId(@Param("rootId") long rootId); - void deleteComponentManualMeasures(@Param("componentUuids") List componentUuids); + void deleteManualMeasuresByComponentUuids(@Param("componentUuids") List componentUuids); - void deleteComponentEvents(@Param("componentUuid") String componentUuid); + void deleteEventsByComponentUuid(@Param("componentUuid") String componentUuid); List selectPurgeableAnalysesWithEvents(@Param("componentUuid") String componentUuid); List selectPurgeableAnalysesWithoutEvents(@Param("componentUuid") String componentUuid); - void deleteComponentIssueChanges(@Param("rootUuid") String rootUuid); + void deleteIssueChangesByProjectUuid(@Param("projectUuid") String projectUuid); - void deleteComponentIssues(@Param("rootUuid") String rootUuid); + void deleteIssuesByProjectUuid(@Param("projectUuid") String projectUuid); List selectOldClosedIssueKeys(@Param("projectUuid") String projectUuid, @Nullable @Param("toDate") Long toDate); @@ -80,7 +80,7 @@ public interface PurgeMapper { void deleteFileSourcesByProjectUuid(String rootProjectUuid); - void deleteFileSourcesByUuid(@Param("fileUuids") List fileUuids); + void deleteFileSourcesByFileUuid(@Param("fileUuids") List fileUuids); void deleteCeActivityByProjectUuid(@Param("projectUuid") String projectUuid); diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml index 8f81562b9a6..80f7f578784 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml @@ -163,13 +163,13 @@ and resolution is null - + delete from project_links where component_uuid = #{rootUuid,jdbcType=VARCHAR} - + delete from properties where resource_id in @@ -178,70 +178,70 @@ - + delete from projects where project_uuid = #{rootUuid,jdbcType=VARCHAR} - + delete from group_roles where resource_id = #{rootId,jdbcType=INTEGER} - + delete from user_roles where resource_id = #{rootId,jdbcType=INTEGER} - + delete from manual_measures where component_uuid in #{componentUuid,jdbcType=VARCHAR} - + delete from events where component_uuid = #{componentUuid,jdbcType=VARCHAR} - + delete from issue_changes ic where - exists (select 1 from issues i where i.kee=ic.issue_key and i.project_uuid = #{rootUuid,jdbcType=VARCHAR}) + exists (select 1 from issues i where i.kee=ic.issue_key and i.project_uuid = #{projectUuid,jdbcType=VARCHAR}) - + delete issue_changes from issue_changes inner join issues on issue_changes.issue_key=issues.kee where - issues.project_uuid = #{rootUuid,jdbcType=VARCHAR} + issues.project_uuid = #{projectUuid,jdbcType=VARCHAR} - + delete ic from issue_changes as ic, issues as i where ic.issue_key=i.kee - and i.component_uuid = #{rootUuid,jdbcType=VARCHAR} + and i.component_uuid = #{projectUuid,jdbcType=VARCHAR} - + delete from issues - where project_uuid = #{rootUuid,jdbcType=VARCHAR} + where project_uuid = #{projectUuid,jdbcType=VARCHAR} delete from file_sources where project_uuid=#{rootProjectUuid,jdbcType=VARCHAR} - + delete from file_sources where file_uuid in