]> source.dussan.org Git - sonarqube.git/commitdiff
make naming of method in PurgeMapper consistent
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Fri, 2 Jun 2017 09:52:36 +0000 (11:52 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Mon, 5 Jun 2017 07:02:47 +0000 (09:02 +0200)
server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java
server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java
server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java
server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml

index 8df3dfbc83b315da3903da3c85283d54e206acb8..7e6c0f1bf6fada1ff08fd9d7ea5ae3228c367426 100644 (file)
@@ -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<List<String>> 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();
   }
index 216a92217e1fc7941eeea0b63ffddf936585cf09..59b621b7747c9165aa97dc19c7005948825b0dbe 100644 (file)
@@ -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();
       });
index 6889113e7ae2b81ffb7912d24b1c5ca3956a453d..6ea23a7994b774d79f6e264e6d641c6148c40b8b 100644 (file)
@@ -50,27 +50,27 @@ public interface PurgeMapper {
 
   void resolveComponentIssuesNotAlreadyResolved(@Param("componentUuids") List<String> componentUuids, @Param("dateAsLong") Long dateAsLong);
 
-  void deleteComponentLinks(@Param("rootUuid") String rootUuid);
+  void deleteProjectLinksByComponentUuid(@Param("rootUuid") String rootUuid);
 
-  void deleteComponentProperties(@Param("componentIds") List<Long> componentIds);
+  void deletePropertiesByComponentIds(@Param("componentIds") List<Long> 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<String> componentUuids);
+  void deleteManualMeasuresByComponentUuids(@Param("componentUuids") List<String> componentUuids);
 
-  void deleteComponentEvents(@Param("componentUuid") String componentUuid);
+  void deleteEventsByComponentUuid(@Param("componentUuid") String componentUuid);
 
   List<PurgeableAnalysisDto> selectPurgeableAnalysesWithEvents(@Param("componentUuid") String componentUuid);
 
   List<PurgeableAnalysisDto> 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<String> 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<String> fileUuids);
+  void deleteFileSourcesByFileUuid(@Param("fileUuids") List<String> fileUuids);
 
   void deleteCeActivityByProjectUuid(@Param("projectUuid") String projectUuid);
 
index 8f81562b9a6ced133f883c146e82047705dc55e6..80f7f5787845e61e086e254f14c9b756b9dc29e8 100644 (file)
       and resolution is null
   </update>
 
-  <delete id="deleteComponentLinks" parameterType="map">
+  <delete id="deleteProjectLinksByComponentUuid" parameterType="map">
     delete from project_links
     where
       component_uuid = #{rootUuid,jdbcType=VARCHAR}
   </delete>
 
-  <delete id="deleteComponentProperties" parameterType="map">
+  <delete id="deletePropertiesByComponentIds" parameterType="map">
     delete from properties
     where
       resource_id in
       </foreach>
   </delete>
 
-  <delete id="deleteComponents" parameterType="map">
+  <delete id="deleteComponentsByProjectUuid" parameterType="map">
     delete from projects
     where
       project_uuid = #{rootUuid,jdbcType=VARCHAR}
   </delete>
 
-  <delete id="deleteComponentGroupRoles" parameterType="map">
+  <delete id="deleteGroupRolesByComponentId" parameterType="map">
     delete from group_roles
     where
       resource_id = #{rootId,jdbcType=INTEGER}
   </delete>
 
-  <delete id="deleteComponentUserRoles" parameterType="map">
+  <delete id="deleteUserRolesByComponentId" parameterType="map">
     delete from user_roles
     where
       resource_id = #{rootId,jdbcType=INTEGER}
   </delete>
 
-  <delete id="deleteComponentManualMeasures" parameterType="map">
+  <delete id="deleteManualMeasuresByComponentUuids" parameterType="map">
     delete from manual_measures where component_uuid in
     <foreach collection="componentUuids" open="(" close=")" item="componentUuid" separator=",">
       #{componentUuid,jdbcType=VARCHAR}
     </foreach>
   </delete>
 
-  <delete id="deleteComponentEvents" parameterType="map">
+  <delete id="deleteEventsByComponentUuid" parameterType="map">
     delete from events
     where
       component_uuid = #{componentUuid,jdbcType=VARCHAR}
   </delete>
 
-  <delete id="deleteComponentIssueChanges" parameterType="map">
+  <delete id="deleteIssueChangesByProjectUuid" parameterType="map">
     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>
 
   <!-- Mssql -->
-  <delete id="deleteComponentIssueChanges" databaseId="mssql" parameterType="map">
+  <delete id="deleteIssueChangesByProjectUuid" databaseId="mssql" parameterType="map">
     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>
 
   <!-- Mysql -->
-  <delete id="deleteComponentIssueChanges" databaseId="mysql" parameterType="map">
+  <delete id="deleteIssueChangesByProjectUuid" databaseId="mysql" parameterType="map">
     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>
 
-  <delete id="deleteComponentIssues" parameterType="map">
+  <delete id="deleteIssuesByProjectUuid" parameterType="map">
     delete from issues
-    where project_uuid = #{rootUuid,jdbcType=VARCHAR}
+    where project_uuid = #{projectUuid,jdbcType=VARCHAR}
   </delete>
 
   <delete id="deleteFileSourcesByProjectUuid">
     delete from file_sources where project_uuid=#{rootProjectUuid,jdbcType=VARCHAR}
   </delete>
 
-  <delete id="deleteFileSourcesByUuid">
+  <delete id="deleteFileSourcesByFileUuid">
     delete from file_sources
     where
       file_uuid in