diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-05-16 00:13:37 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-05-16 00:13:37 +0200 |
commit | 883bedcd6f64f4ac63cd85276ffcc19e0acd376c (patch) | |
tree | 87f76f4d01429a53d2090b18240b8cc5ec8a4f8d /sonar-core | |
parent | 089aa6047cc98c53e93db61bee7f2b0cfac3f610 (diff) | |
download | sonarqube-883bedcd6f64f4ac63cd85276ffcc19e0acd376c.tar.gz sonarqube-883bedcd6f64f4ac63cd85276ffcc19e0acd376c.zip |
SONAR-4285 support the edition and deletion of comments
Diffstat (limited to 'sonar-core')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java | 15 | ||||
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/issue/db/ChangeDtoConverter.java | 6 |
2 files changed, 16 insertions, 5 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java b/sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java index 6d2444cb7df..d01c8f5ffb1 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java @@ -23,6 +23,7 @@ import com.google.common.base.Objects; import org.apache.commons.lang.StringUtils; import org.sonar.api.BatchComponent; import org.sonar.api.ServerComponent; +import org.sonar.api.issue.IssueComment; import javax.annotation.Nullable; @@ -40,6 +41,7 @@ public class IssueUpdater implements BatchComponent, ServerComponent { if (!Objects.equal(severity, issue.severity())) { issue.setFieldDiff(context, "severity", issue.severity(), severity); issue.setSeverity(severity); + issue.setUpdateDate(context.date()); return true; } return false; @@ -50,6 +52,7 @@ public class IssueUpdater implements BatchComponent, ServerComponent { issue.setFieldDiff(context, "severity", issue.severity(), severity); issue.setSeverity(severity); issue.setManualSeverity(true); + issue.setUpdateDate(context.date()); return true; } return false; @@ -60,6 +63,7 @@ public class IssueUpdater implements BatchComponent, ServerComponent { if (!Objects.equal(sanitizedAssignee, issue.assignee())) { issue.setFieldDiff(context, "assignee", issue.assignee(), sanitizedAssignee); issue.setAssignee(sanitizedAssignee); + issue.setUpdateDate(context.date()); return true; } return false; @@ -77,6 +81,7 @@ public class IssueUpdater implements BatchComponent, ServerComponent { if (!Objects.equal(resolution, issue.resolution())) { issue.setFieldDiff(context, "resolution", issue.resolution(), resolution); issue.setResolution(resolution); + issue.setUpdateDate(context.date()); return true; } return false; @@ -86,6 +91,7 @@ public class IssueUpdater implements BatchComponent, ServerComponent { if (!Objects.equal(status, issue.status())) { issue.setFieldDiff(context, "status", issue.status(), status); issue.setStatus(status); + issue.setUpdateDate(context.date()); return true; } return false; @@ -95,20 +101,23 @@ public class IssueUpdater implements BatchComponent, ServerComponent { issue.setAuthorLogin(authorLogin); } - public void setMessage(DefaultIssue issue, @Nullable String s) { + public void setMessage(DefaultIssue issue, @Nullable String s, IssueChangeContext context) { issue.setMessage(s); + issue.setUpdateDate(context.date()); } public void addComment(DefaultIssue issue, String text, IssueChangeContext context) { issue.addComment(DefaultIssueComment.create(issue.key(), context.login(), text)); + issue.setUpdateDate(context.date()); } public void setCloseDate(DefaultIssue issue, @Nullable Date d) { issue.setCloseDate(d); } - public void setEffortToFix(DefaultIssue issue, @Nullable Double d) { + public void setEffortToFix(DefaultIssue issue, @Nullable Double d, IssueChangeContext context) { issue.setEffortToFix(d); + issue.setUpdateDate(context.date()); } public boolean setAttribute(DefaultIssue issue, String key, @Nullable String value, IssueChangeContext context) { @@ -116,6 +125,7 @@ public class IssueUpdater implements BatchComponent, ServerComponent { if (!Objects.equal(oldValue, value)) { issue.setFieldDiff(context, key, oldValue, value); issue.setAttribute(key, value); + issue.setUpdateDate(context.date()); return true; } return false; @@ -126,6 +136,7 @@ public class IssueUpdater implements BatchComponent, ServerComponent { if (!Objects.equal(sanitizedActionPlanKey, issue.actionPlanKey())) { issue.setFieldDiff(context, "actionPlanKey", issue.actionPlanKey(), sanitizedActionPlanKey); issue.setActionPlanKey(sanitizedActionPlanKey); + issue.setUpdateDate(context.date()); return true; } return false; diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/ChangeDtoConverter.java b/sonar-core/src/main/java/org/sonar/core/issue/db/ChangeDtoConverter.java index 49cde1f22c1..f1b0af58f17 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/db/ChangeDtoConverter.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/db/ChangeDtoConverter.java @@ -24,13 +24,13 @@ import org.sonar.core.issue.FieldDiffs; import java.util.Date; -class ChangeDtoConverter { +public class ChangeDtoConverter { private ChangeDtoConverter() { // only static methods } - static IssueChangeDto commentToDto(DefaultIssueComment comment) { + public static IssueChangeDto commentToDto(DefaultIssueComment comment) { IssueChangeDto dto = newDto(comment.issueKey()); dto.setKey(comment.key()); dto.setChangeType(IssueChangeDto.TYPE_COMMENT); @@ -39,7 +39,7 @@ class ChangeDtoConverter { return dto; } - static IssueChangeDto changeToDto(String issueKey, FieldDiffs diffs) { + public static IssueChangeDto changeToDto(String issueKey, FieldDiffs diffs) { IssueChangeDto dto = newDto(issueKey); dto.setChangeType(IssueChangeDto.TYPE_FIELD_CHANGE); dto.setChangeData(diffs.toString()); |