From 90864dacb4972d0251c5659d4cb962fbd919b032 Mon Sep 17 00:00:00 2001 From: Stephane Gamard Date: Thu, 21 Aug 2014 16:51:35 +0200 Subject: [PATCH] SONAR-5530 - IssueDto extends Dto --- .../org/sonar/core/issue/db/IssueDto.java | 29 +++++++++---------- .../java/org/sonar/core/persistence/Dto.java | 6 ++-- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDto.java b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDto.java index be0d275f1cd..858a1b7c8ff 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDto.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDto.java @@ -27,17 +27,18 @@ import org.sonar.api.issue.internal.DefaultIssue; import org.sonar.api.rule.RuleKey; import org.sonar.api.utils.Duration; import org.sonar.api.utils.KeyValueFormat; +import org.sonar.core.persistence.Dto; import javax.annotation.CheckForNull; import javax.annotation.Nullable; - import java.io.Serializable; import java.util.Date; /** * @since 3.6 */ -public final class IssueDto implements Serializable { +public final class IssueDto extends Dto implements Serializable { + private Long id; private String kee; @@ -64,10 +65,6 @@ public final class IssueDto implements Serializable { private Date issueUpdateDate; private Date issueCloseDate; - // technical dates - private Date createdAt; - private Date updatedAt; - /** * Temporary date used only during scan */ @@ -79,6 +76,12 @@ public final class IssueDto implements Serializable { private String componentKey; private String rootComponentKey; + + @Override + public String getKey() { + return kee; + } + public Long getId() { return id; } @@ -261,21 +264,15 @@ public final class IssueDto implements Serializable { return this; } - public Date getCreatedAt() { - return createdAt; - } - + @Override public IssueDto setCreatedAt(Date createdAt) { - this.createdAt = createdAt; + super.setCreatedAt(createdAt); return this; } - public Date getUpdatedAt() { - return updatedAt; - } - + @Override public IssueDto setUpdatedAt(@Nullable Date updatedAt) { - this.updatedAt = updatedAt; + super.setUpdatedAt(updatedAt); return this; } diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/Dto.java b/sonar-core/src/main/java/org/sonar/core/persistence/Dto.java index 891ebcd595c..e5cfec6109b 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/Dto.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/Dto.java @@ -29,12 +29,14 @@ public abstract class Dto { public abstract K getKey(); - public final void setCreatedAt(Date datetime) { + public Dto setCreatedAt(Date datetime) { this.createdAt = datetime; + return this; } - public final void setUpdatedAt(Date datetime) { + public Dto setUpdatedAt(Date datetime) { this.updatedAt = datetime; + return this; } public final Date getCreatedAt() { -- 2.39.5