]> source.dussan.org Git - sonarqube.git/commitdiff
Incremental indexing of activities
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 20 Feb 2015 14:29:36 +0000 (15:29 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 20 Feb 2015 14:33:50 +0000 (15:33 +0100)
server/sonar-server/src/main/java/org/sonar/server/activity/db/ActivityDao.java
sonar-core/src/main/java/org/sonar/core/activity/db/ActivityMapper.java
sonar-core/src/main/resources/org/sonar/core/activity/db/ActivityMapper.xml

index f2c9b9561e3487e52a06c224fb0364d93674ef4f..7d4a636947f7f7c9e2258ac33ce229e41cf10ff8 100644 (file)
@@ -58,11 +58,6 @@ public class ActivityDao extends BaseDao<ActivityMapper, ActivityDto, String> {
     throw new IllegalStateException("Cannot delete Log!");
   }
 
-  @Override
-  protected String getSynchronizationStatementName() {
-    return "selectAll";
-  }
-
   public List<ActivityDto> findAll(DbSession session) {
     return mapper(session).selectAll();
   }
index 0d507e08a832b08eb140a2de76d952b7a8ade88c..d7f5959c42234756086507518b4405b0d5c4aa5b 100644 (file)
  */
 package org.sonar.core.activity.db;
 
+import org.apache.ibatis.annotations.Param;
+
+import javax.annotation.Nullable;
+
+import java.sql.Timestamp;
 import java.util.List;
 
 /**
@@ -29,4 +34,6 @@ public interface ActivityMapper {
   void insert(ActivityDto rule);
 
   List<ActivityDto> selectAll();
+
+  List<ActivityDto> selectAfterDate(@Nullable @Param("date") Timestamp timestamp);
 }
index 0c516fa3f89ed419b13b56c96633fad8ebfbaa50..fecd0b0210f58470ea63aa76d5740c803ec9d7cf 100644 (file)
@@ -9,7 +9,7 @@
     values (#{createdAt}, #{key}, #{type}, #{action}, #{author}, #{data}, #{message})
   </insert>
 
-  <select id="selectAll" parameterType="map" resultType="Activity" >
+  <select id="selectAll" parameterType="map" resultType="Activity" fetchSize="${_scrollFetchSize}" resultSetType="FORWARD_ONLY">
     SELECT
     created_at as "createdAt",
     log_type as "type",
     FROM activities
   </select>
 
+
+  <select id="selectAfterDate" parameterType="map" resultType="Activity" fetchSize="${_scrollFetchSize}" resultSetType="FORWARD_ONLY">
+    SELECT
+    created_at as "createdAt",
+    log_type as "type",
+    user_login as "author",
+    data_field as "data",
+    log_message as "message",
+    log_key as "key",
+    log_action as "action"
+    FROM activities
+    <where>
+      <if test="date != null">
+        created_at &gt;= #{date}
+      </if>
+    </where>
+  </select>
 </mapper>