From f46890edae710809b3f2ee455d059c3646c80295 Mon Sep 17 00:00:00 2001 From: Mark Struchkov Date: Sat, 18 May 2019 13:10:25 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B2=20=D0=B8=D0=B5=D1=80=D0=B0=D1=80=D1=85?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B5=D0=BD=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/sadtech/bot/core/domain/Content.java | 15 +++++++++++++-- .../java/org/sadtech/bot/core/domain/Mail.java | 15 ++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/sadtech/bot/core/domain/Content.java b/src/main/java/org/sadtech/bot/core/domain/Content.java index 96ae304..1059a82 100644 --- a/src/main/java/org/sadtech/bot/core/domain/Content.java +++ b/src/main/java/org/sadtech/bot/core/domain/Content.java @@ -5,6 +5,7 @@ import java.util.Objects; public abstract class Content { private Integer personId; + private String message; public Content() { @@ -12,6 +13,7 @@ public abstract class Content { public Content(Content source) { this.personId = source.getPersonId(); + this.message = source.getMessage(); } public Integer getPersonId() { @@ -22,16 +24,25 @@ public abstract class Content { this.personId = personId; } + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Content)) return false; Content content = (Content) o; - return Objects.equals(personId, content.personId); + return Objects.equals(personId, content.personId) && + Objects.equals(message, content.message); } @Override public int hashCode() { - return Objects.hash(personId); + return Objects.hash(personId, message); } } diff --git a/src/main/java/org/sadtech/bot/core/domain/Mail.java b/src/main/java/org/sadtech/bot/core/domain/Mail.java index 9057d34..a69d39f 100644 --- a/src/main/java/org/sadtech/bot/core/domain/Mail.java +++ b/src/main/java/org/sadtech/bot/core/domain/Mail.java @@ -10,7 +10,6 @@ public class Mail extends Content { private Integer id; private LocalDateTime date; - private String message; private List attachments; public Mail() { @@ -21,7 +20,6 @@ public class Mail extends Content { super(source); this.id = source.getId(); this.date = source.getDate(); - this.message = source.getMessage(); } public Integer getId() { @@ -41,14 +39,6 @@ public class Mail extends Content { } - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - public Mail prototype() { return new Mail(this); } @@ -69,12 +59,12 @@ public class Mail extends Content { Mail mail = (Mail) o; return Objects.equals(id, mail.id) && Objects.equals(date, mail.date) && - Objects.equals(message, mail.message); + Objects.equals(attachments, mail.attachments); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), id, date, message); + return Objects.hash(super.hashCode(), id, date, attachments); } @Override @@ -82,7 +72,6 @@ public class Mail extends Content { return "Mail{" + "id=" + id + ", date=" + date + - ", message='" + message + '\'' + ", attachments=" + attachments + '}'; }