From 6affc4080d8b98d499174f64e2c86c84cbd2872d Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Wed, 16 Aug 2017 16:03:25 +0200 Subject: SONAR-9720 Issue tracking for long branches --- .../main/java/org/sonar/core/issue/DefaultIssue.java | 17 +++++++++++++++-- .../java/org/sonar/core/issue/DefaultIssueBuilder.java | 1 + .../java/org/sonar/core/issue/DefaultIssueTest.java | 2 ++ 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'sonar-core') 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 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(); -- cgit v1.2.3