]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5560 - fixed getByKeys for nullables
authorStephane Gamard <stephane.gamard@sonarsource.com>
Fri, 12 Sep 2014 09:57:21 +0000 (11:57 +0200)
committerStephane Gamard <stephane.gamard@sonarsource.com>
Fri, 12 Sep 2014 09:57:21 +0000 (11:57 +0200)
server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java
server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueNormalizer.java

index 415c43c7acf2d28a2e68c4d0adbab687e76a0582..319fa934581208088589b7623a4d314cd12d0871 100644 (file)
@@ -159,7 +159,10 @@ public abstract class BaseDao<MAPPER, DTO extends Dto<KEY>, KEY extends Serializ
   public List<DTO> getByKeys(DbSession session, Collection<KEY> keys) {
     List<DTO> results = new ArrayList<DTO>();
     for (KEY key : keys) {
-      results.add(this.getByKey(session, key));
+      DTO result = this.getNullableByKey(session, key);
+      if (result != null) {
+        results.add(result);
+      }
     }
     return results;
   }
index 76284ca648ce23f63fd5d7d068f476273bb5916c..4fc6977e070a60c3f44bd13cf27b9ab6f5a60fd0 100644 (file)
@@ -43,19 +43,20 @@ public class IssueNormalizer extends BaseNormalizer<IssueDto, String> {
     public static final IndexField CREATED_AT = add(IndexField.Type.DATE, "createdAt");
     public static final IndexField UPDATED_AT = add(IndexField.Type.DATE, "updatedAt");
 
-    public static final IndexField DEBT = add(IndexField.Type.NUMERIC, "debt");
     public static final IndexField ACTION_PLAN = add(IndexField.Type.STRING, "actionPlan");
     public static final IndexField ASSIGNEE = add(IndexField.Type.STRING, "assignee");
+    public static final IndexField ATTRIBUTE = add(IndexField.Type.OBJECT, "attributes");
     public static final IndexField AUTHOR_LOGIN = add(IndexField.Type.STRING, "authorLogin");
+    public static final IndexField COMPONENT = add(IndexField.Type.STRING, "component");
+    public static final IndexField DEBT = add(IndexField.Type.NUMERIC, "debt");
+    public static final IndexField EFFORT = add(IndexField.Type.NUMERIC, "effort");
     public static final IndexField ISSUE_CREATED_AT = add(IndexField.Type.DATE, "issueCreatedAt");
     public static final IndexField ISSUE_UPDATED_AT = add(IndexField.Type.DATE, "issueUpdatedAt");
     public static final IndexField ISSUE_CLOSE_DATE = add(IndexField.Type.DATE, "issueClosedAt");
-    public static final IndexField PROJECT = add(IndexField.Type.STRING, "project");
-    public static final IndexField COMPONENT = add(IndexField.Type.STRING, "component");
-    public static final IndexField EFFORT = add(IndexField.Type.NUMERIC, "effort");
-    public static final IndexField RESOLUTION = add(IndexField.Type.STRING, "resolution");
     public static final IndexField LINE = add(IndexField.Type.NUMERIC, "line");
     public static final IndexField MESSAGE = add(IndexField.Type.STRING, "message");
+    public static final IndexField PROJECT = add(IndexField.Type.STRING, "project");
+    public static final IndexField RESOLUTION = add(IndexField.Type.STRING, "resolution");
     public static final IndexField REPORTER = add(IndexField.Type.STRING, "reporter");
     public static final IndexField STATUS = add(IndexField.Type.STRING, "status");
     public static final IndexField SEVERITY = add(IndexField.Type.STRING, "severity");
@@ -136,5 +137,5 @@ public class IssueNormalizer extends BaseNormalizer<IssueDto, String> {
         .parent(dto.getRootComponentKey())
         .doc(update)
         .upsert(upsert));
- }
 }
 }