aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2017-08-16 16:03:25 +0200
committerJanos Gyerik <janos.gyerik@sonarsource.com>2017-09-12 10:59:56 +0200
commit6affc4080d8b98d499174f64e2c86c84cbd2872d (patch)
tree2c737e253ee9db89d53fee73e31f2f5896ad41e9 /sonar-core
parentfe946b35cfad0e572dc07408e6ac1fabc9f65958 (diff)
downloadsonarqube-6affc4080d8b98d499174f64e2c86c84cbd2872d.tar.gz
sonarqube-6affc4080d8b98d499174f64e2c86c84cbd2872d.zip
SONAR-9720 Issue tracking for long branches
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java17
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java1
-rw-r--r--sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java2
3 files changed, 18 insertions, 2 deletions
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 a92b911d44f..8ac7a205d58 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
@@ -96,10 +96,13 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure.
// all changes
private List<FieldDiffs> changes = null;
- // true if the the issue did not exist in the previous scan.
+ // true if the issue did not exist in the previous scan.
private boolean isNew = true;
- // True if the the issue did exist in the previous scan but not in the current one. That means
+ // true if the issue is being copied to a different branch
+ private boolean isCopied = false;
+
+ // True if the issue did exist in the previous scan but not in the current one. That means
// that this issue should be closed.
private boolean beingClosed = false;
@@ -412,6 +415,16 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure.
return isNew;
}
+ @Override
+ public boolean isCopied() {
+ return isCopied;
+ }
+
+ public DefaultIssue setCopied(boolean b) {
+ isCopied = b;
+ return this;
+ }
+
public DefaultIssue setNew(boolean b) {
isNew = b;
return this;
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java
index 9a1a2c3e5dc..29323740902 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java
@@ -161,6 +161,7 @@ public class DefaultIssueBuilder implements Issuable.IssueBuilder {
issue.setStatus(Issue.STATUS_OPEN);
issue.setCloseDate(null);
issue.setNew(true);
+ issue.setCopied(false);
issue.setBeingClosed(false);
issue.setOnDisabledRule(false);
return issue;
diff --git a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java
index f9c36b3bc2a..247c2d32ebd 100644
--- a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java
@@ -59,6 +59,7 @@ public class DefaultIssueTest {
.setNew(true)
.setBeingClosed(true)
.setOnDisabledRule(true)
+ .setCopied(true)
.setChanged(true)
.setSendNotifications(true)
.setCreationDate(new SimpleDateFormat("yyyy-MM-dd").parse("2013-08-19"))
@@ -83,6 +84,7 @@ public class DefaultIssueTest {
assertThat(issue.authorLogin()).isEqualTo("steph");
assertThat(issue.checksum()).isEqualTo("c7b5db46591806455cf082bb348631e8");
assertThat(issue.isNew()).isTrue();
+ assertThat(issue.isCopied()).isTrue();
assertThat(issue.isBeingClosed()).isTrue();
assertThat(issue.isOnDisabledRule()).isTrue();
assertThat(issue.isChanged()).isTrue();