diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-06-04 15:54:15 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-06-04 15:58:18 +0200 |
commit | 2b90c6d9deb4fafe99ae7c88cdc67d02cd1d2d76 (patch) | |
tree | f07399be46b8d3032732e976134df5008bc808f9 /sonar-plugin-api/src | |
parent | ea4b51a3ad43e7d6ce6b18b9eac32fd45e0cc367 (diff) | |
download | sonarqube-2b90c6d9deb4fafe99ae7c88cdc67d02cd1d2d76.tar.gz sonarqube-2b90c6d9deb4fafe99ae7c88cdc67d02cd1d2d76.zip |
SONAR-4284 Display a changelog in the Issue detail page
Diffstat (limited to 'sonar-plugin-api/src')
3 files changed, 16 insertions, 12 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java index 11a9e67dcb7..e594b754145 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java @@ -63,16 +63,19 @@ public class DefaultIssue implements Issue { private String checksum; private Map<String, String> attributes = null; private String authorLogin = null; - private FieldDiffs diffs = null; private String actionPlanKey; private List<IssueComment> comments = null; - // functional dates + // FUNCTIONAL DATES private Date creationDate; private Date updateDate; private Date closeDate; - // The following states are used only during scan. + + // FOLLOWING FIELDS ARE AVAILABLE ONLY DURING SCAN + + // Current changes + private FieldDiffs currentChange = null; // true if the the issue did not exist in the previous scan. private boolean isNew = true; @@ -348,20 +351,20 @@ public class DefaultIssue implements Issue { return this; } - public DefaultIssue setFieldDiff(IssueChangeContext context, String field, @Nullable Serializable oldValue, @Nullable Serializable newValue) { + public DefaultIssue setFieldChange(IssueChangeContext context, String field, @Nullable Serializable oldValue, @Nullable Serializable newValue) { if (!Objects.equal(oldValue, newValue)) { - if (diffs == null) { - diffs = new FieldDiffs(); - diffs.setUserLogin(context.login()); + if (currentChange == null) { + currentChange = new FieldDiffs(); + currentChange.setUserLogin(context.login()); } - diffs.setDiff(field, oldValue, newValue); + currentChange.setDiff(field, oldValue, newValue); } return this; } @CheckForNull - public FieldDiffs diffs() { - return diffs; + public FieldDiffs currentChange() { + return currentChange; } public DefaultIssue addComment(DefaultIssueComment comment) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/FieldDiffs.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/FieldDiffs.java index 5479bfb4392..b0d44ee6bf9 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/FieldDiffs.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/FieldDiffs.java @@ -25,7 +25,6 @@ import com.google.common.collect.Maps; import javax.annotation.CheckForNull; import javax.annotation.Nullable; - import java.io.Serializable; import java.util.Date; import java.util.Map; @@ -79,7 +78,7 @@ public class FieldDiffs implements Serializable { @SuppressWarnings("unchecked") - public void setDiff(String field, @Nullable Serializable oldValue, @Nullable Serializable newValue) { + public FieldDiffs setDiff(String field, @Nullable Serializable oldValue, @Nullable Serializable newValue) { Diff diff = diffs.get(field); if (diff == null) { diff = new Diff(oldValue, newValue); @@ -87,6 +86,7 @@ public class FieldDiffs implements Serializable { } else { diff.setNewValue(newValue); } + return this; } @Override diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/user/UserFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/user/UserFinder.java index 66234bb177d..6bf2c76017c 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/user/UserFinder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/user/UserFinder.java @@ -22,6 +22,7 @@ package org.sonar.api.user; import org.sonar.api.ServerComponent; import javax.annotation.CheckForNull; +import java.util.Collection; import java.util.List; /** |