]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-15479 updated saving issues from report in the database - added quickFixAvailab...
authorLukasz Jarocki <lukasz.jarocki@sonarsource.com>
Mon, 11 Oct 2021 12:57:05 +0000 (14:57 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 13 Oct 2021 20:03:34 +0000 (20:03 +0000)
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerRawInputFactory.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/util/cache/ProtobufIssueDiskCache.java
server/sonar-ce-task-projectanalysis/src/main/protobuf/issue_cache.proto
server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java
sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java

index 81fe3370f42709c81db8afb539e373ed92d1b205..a593e4315db5737ba44ae3c3b256e5e06a859512 100644 (file)
@@ -198,6 +198,7 @@ public class TrackerRawInputFactory {
       }
       issue.setIsFromExternalRuleEngine(false);
       issue.setLocations(dbLocationsBuilder.build());
+      issue.setQuickFixAvailable(reportIssue.getQuickFixAvailable());
       return issue;
     }
 
index 793d9d60ab43f98d1f9d8a78fabe946975e0eb05..56e3926b353d5a9e9f1bfb9bb813d6f4a9d639ce 100644 (file)
@@ -129,6 +129,7 @@ public class ProtobufIssueDiskCache implements DiskCache<DefaultIssue> {
     defaultIssue.setChanged(next.getIsChanged());
     defaultIssue.setSendNotifications(next.getSendNotifications());
     defaultIssue.setSelectedAt(next.hasSelectedAt() ? next.getSelectedAt() : null);
+    defaultIssue.setQuickFixAvailable(next.getQuickFixAvailable());
 
     for (IssueCache.FieldDiffs protoFieldDiffs : next.getChangesList()) {
       defaultIssue.addChange(toDefaultIssueChanges(protoFieldDiffs));
@@ -176,6 +177,7 @@ public class ProtobufIssueDiskCache implements DiskCache<DefaultIssue> {
     builder.setIsChanged(defaultIssue.isChanged());
     builder.setSendNotifications(defaultIssue.mustSendNotifications());
     ofNullable(defaultIssue.selectedAt()).ifPresent(builder::setSelectedAt);
+    builder.setQuickFixAvailable(defaultIssue.isQuickFixAvailable());
 
     for (FieldDiffs fieldDiffs : defaultIssue.changes()) {
       builder.addChanges(toProtoIssueChanges(fieldDiffs));
index bb3352920a597a633e25827cc6fc0e46a383bdc9..6c488ffafd63d0667d48ef1a06aaedce2e7df36f 100644 (file)
@@ -73,6 +73,8 @@ message Issue {
   optional int64 selectedAt = 37;
 
   repeated Comment comments = 38;
+
+  optional bool quickFixAvailable = 39;
 }
 
 message Comment {
index 704e41514a07ff4e785bc66f3b11e4faa3762f72..48798e55759220407209d283d24760d78f24e1d9 100644 (file)
@@ -140,6 +140,7 @@ public final class IssueDto implements Serializable {
       .setIssueCloseDate(issue.closeDate())
       .setIssueUpdateDate(issue.updateDate())
       .setSelectedAt(issue.selectedAt())
+      .setQuickFixAvailable(issue.isQuickFixAvailable())
 
       // technical dates
       .setCreatedAt(now)
@@ -186,6 +187,7 @@ public final class IssueDto implements Serializable {
       .setIssueCloseDate(issue.closeDate())
       .setIssueUpdateDate(issue.updateDate())
       .setSelectedAt(issue.selectedAt())
+      .setQuickFixAvailable(issue.isQuickFixAvailable())
 
       // technical date
       .setUpdatedAt(now);
@@ -756,6 +758,7 @@ public final class IssueDto implements Serializable {
     issue.setSelectedAt(selectedAt);
     issue.setLocations(parseLocations());
     issue.setIsFromExternalRuleEngine(isExternal);
+    issue.setQuickFixAvailable(quickFixAvailable != null ? quickFixAvailable : false);
     return issue;
   }
 }
index 7fce1a75dd5e44577dbded1cc827ce029e2f4505..e52dc7355d12c7d8661a3a0c582bcc37d295edc9 100644 (file)
@@ -118,6 +118,8 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure.
   // Date when issue was loaded from db (only when isNew=false)
   private Long selectedAt;
 
+  private boolean quickFixAvailable;
+
   @Override
   public String key() {
     return key;
@@ -513,6 +515,15 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure.
     return this;
   }
 
+  public boolean isQuickFixAvailable() {
+    return quickFixAvailable;
+  }
+
+  public DefaultIssue setQuickFixAvailable(boolean quickFixAvailable) {
+    this.quickFixAvailable = quickFixAvailable;
+    return this;
+  }
+
   @CheckForNull
   public FieldDiffs currentChange() {
     return currentChange;