From 97ca9e16fc27e19f021558502fdce23fe9a77460 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 23 Jan 2015 09:28:43 +0100 Subject: [PATCH] SONAR-3499 do not update tags when issues are unchanged --- .../server/computation/AnalysisReportService.java | 1 + ...757_feed_issue_tags.rb => 770_feed_issue_tags.rb} | 0 .../batch/protocol/output/issue/ReportIssue.java | 12 ++++++++++++ .../java/org/sonar/batch/report/IssuesPublisher.java | 1 + .../org/sonar/core/persistence/DatabaseVersion.java | 2 +- .../resources/org/sonar/core/persistence/rows-h2.sql | 2 +- 6 files changed, 16 insertions(+), 2 deletions(-) rename server/sonar-web/src/main/webapp/WEB-INF/db/migrate/{757_feed_issue_tags.rb => 770_feed_issue_tags.rb} (100%) diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java b/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java index 9a48c923812..98af67b2546 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java @@ -109,6 +109,7 @@ public class AnalysisReportService { setDebt(defaultIssue, issue.debt()); setFieldDiffs(defaultIssue, issue.diffFields(), context.getAnalysisDate()); defaultIssue.setStatus(issue.status()); + defaultIssue.setTags(issue.tags()); defaultIssue.setResolution(issue.resolution()); defaultIssue.setReporter(issue.reporter()); defaultIssue.setAssignee(issue.assignee()); diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/757_feed_issue_tags.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/770_feed_issue_tags.rb similarity index 100% rename from server/sonar-web/src/main/webapp/WEB-INF/db/migrate/757_feed_issue_tags.rb rename to server/sonar-web/src/main/webapp/WEB-INF/db/migrate/770_feed_issue_tags.rb diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/issue/ReportIssue.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/issue/ReportIssue.java index dc545559938..0de8dd5803e 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/issue/ReportIssue.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/issue/ReportIssue.java @@ -21,6 +21,7 @@ package org.sonar.batch.protocol.output.issue; import javax.annotation.Nullable; +import java.util.Collection; import java.util.Date; public class ReportIssue { @@ -32,6 +33,7 @@ public class ReportIssue { private String message; private Double effortToFix; private String severity; + private Collection tags; // Temporary fields that should be removed when aggregation/issue tracking is done by computation private boolean isNew; @@ -53,6 +55,7 @@ public class ReportIssue { private String diffFields; private boolean isChanged; + public ReportIssue setKey(String key) { this.key = key; return this; @@ -179,6 +182,15 @@ public class ReportIssue { return assignee; } + public Collection tags() { + return tags; + } + + public ReportIssue setTags(Collection s) { + this.tags = s; + return this; + } + public ReportIssue setRuleKey(String ruleRepo, String ruleKey) { this.ruleRepo = ruleRepo; this.ruleKey = ruleKey; diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/IssuesPublisher.java b/sonar-batch/src/main/java/org/sonar/batch/report/IssuesPublisher.java index 5399b1ac149..4edf13d2e18 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/report/IssuesPublisher.java +++ b/sonar-batch/src/main/java/org/sonar/batch/report/IssuesPublisher.java @@ -81,6 +81,7 @@ public class IssuesPublisher implements ReportPublisher { .setUpdateDate(issue.updateDate()) .setSelectedAt(issue.selectedAt()) .setDiffFields(toString(issue.currentChange())) + .setTags(issue.tags()) .setChanged(issue.isChanged()); } diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java index c06f0d75330..d45867e74e0 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java @@ -33,7 +33,7 @@ import java.util.List; */ public class DatabaseVersion implements BatchComponent, ServerComponent { - public static final int LAST_VERSION = 769; + public static final int LAST_VERSION = 770; /** * List of all the tables.n diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql index f25336b3b50..5d5fbca06b6 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql @@ -285,7 +285,6 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('753'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('754'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('755'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('756'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('757'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('758'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('759'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('760'); @@ -298,6 +297,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('766'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('767'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('768'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('769'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('770'); INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '1418215735482', '1418215735482', null, null); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2; -- 2.39.5