From: Lukasz Jarocki Date: Mon, 11 Oct 2021 12:57:05 +0000 (+0200) Subject: SONAR-15479 updated saving issues from report in the database - added quickFixAvailab... X-Git-Tag: 9.2.0.49834~154 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=72ebaa7e1dc6c931fa6d0aaa6addcb0563d65ba8;p=sonarqube.git SONAR-15479 updated saving issues from report in the database - added quickFixAvailable support --- diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerRawInputFactory.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerRawInputFactory.java index 81fe3370f42..a593e4315db 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerRawInputFactory.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerRawInputFactory.java @@ -198,6 +198,7 @@ public class TrackerRawInputFactory { } issue.setIsFromExternalRuleEngine(false); issue.setLocations(dbLocationsBuilder.build()); + issue.setQuickFixAvailable(reportIssue.getQuickFixAvailable()); return issue; } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/util/cache/ProtobufIssueDiskCache.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/util/cache/ProtobufIssueDiskCache.java index 793d9d60ab4..56e3926b353 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/util/cache/ProtobufIssueDiskCache.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/util/cache/ProtobufIssueDiskCache.java @@ -129,6 +129,7 @@ public class ProtobufIssueDiskCache implements DiskCache { 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 { 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)); diff --git a/server/sonar-ce-task-projectanalysis/src/main/protobuf/issue_cache.proto b/server/sonar-ce-task-projectanalysis/src/main/protobuf/issue_cache.proto index bb3352920a5..6c488ffafd6 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/protobuf/issue_cache.proto +++ b/server/sonar-ce-task-projectanalysis/src/main/protobuf/issue_cache.proto @@ -73,6 +73,8 @@ message Issue { optional int64 selectedAt = 37; repeated Comment comments = 38; + + optional bool quickFixAvailable = 39; } message Comment { diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java index 704e41514a0..48798e55759 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java @@ -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; } } diff --git a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java index 7fce1a75dd5..e52dc7355d1 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java @@ -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;