From 6235d034202d6045b125da68065d61d2ec11acd4 Mon Sep 17 00:00:00 2001 From: uPagge Date: Thu, 14 Jan 2021 21:58:17 +0300 Subject: [PATCH] BasicEntity --- .../gitlab/context/domain/entity/Chat.java | 19 +++++---------- .../gitlab/context/domain/entity/Comment.java | 21 ++++++----------- .../context/domain/entity/NotifySetting.java | 19 +++++---------- .../gitlab/context/domain/entity/Project.java | 19 +++++---------- .../context/domain/entity/PullRequest.java | 23 +++++++------------ .../gitlab/context/domain/entity/Task.java | 21 ++++++----------- .../core/domain/entity/BuildShort.java | 19 +++++---------- .../core/domain/entity/TeamcityProject.java | 19 +++++---------- .../core/domain/entity/TeamcitySetting.java | 21 ++++++----------- 9 files changed, 59 insertions(+), 122 deletions(-) diff --git a/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Chat.java b/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Chat.java index 64c7ed0..b2e2364 100644 --- a/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Chat.java +++ b/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Chat.java @@ -18,21 +18,14 @@ import javax.persistence.Id; //@Entity //@Table(name = "chat") @EqualsAndHashCode(onlyExplicitlyIncluded = true) -public class Chat extends BasicEntity { +public class Chat implements BasicEntity { + + @Id + @Column(name = "key") + @EqualsAndHashCode.Include + private String id; @Column(name = "telegram_id") private Long telegramId; - @Override - @Id - @Column(name = "key") - @EqualsAndHashCode.Include - public String getId() { - return super.getId(); - } - - @Override - public void setId(String id) { - super.setId(id); - } } diff --git a/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Comment.java b/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Comment.java index 31922eb..7571e18 100644 --- a/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Comment.java +++ b/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Comment.java @@ -18,8 +18,13 @@ import java.util.Set; @Setter //@Entity //@Table(name = "comment") -@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -public class Comment extends BasicEntity { +@EqualsAndHashCode(onlyExplicitlyIncluded = true) +public class Comment implements BasicEntity { + + @Id + @Column(name = "id") + @EqualsAndHashCode.Include + private Long id; @Column(name = "url_api") private String urlApi; @@ -53,16 +58,4 @@ public class Comment extends BasicEntity { @Column(name = "child_id") private Set answers; - @Override - @Id - @Column(name = "id") - @EqualsAndHashCode.Include - public Long getId() { - return super.getId(); - } - - @Override - public void setId(Long id) { - super.setId(id); - } } diff --git a/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/NotifySetting.java b/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/NotifySetting.java index 9b622f0..8ded784 100644 --- a/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/NotifySetting.java +++ b/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/NotifySetting.java @@ -19,7 +19,12 @@ import java.time.LocalDateTime; //@Entity //@Table(name = "setting_notify") @EqualsAndHashCode(onlyExplicitlyIncluded = true) -public class NotifySetting extends BasicEntity { +public class NotifySetting implements BasicEntity { + + @Id + @Column(name = "login") + @EqualsAndHashCode.Include + private String id; /** * Дата, после которой пользователю будут поступать уведомления. @@ -27,16 +32,4 @@ public class NotifySetting extends BasicEntity { @Column(name = "start_receiving") private LocalDateTime startReceiving; - @Override - @Id - @Column(name = "login") - @EqualsAndHashCode.Include - public String getId() { - return super.getId(); - } - - @Override - public void setId(String id) { - super.setId(id); - } } diff --git a/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Project.java b/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Project.java index 483e2ab..53359e8 100644 --- a/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Project.java +++ b/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Project.java @@ -20,8 +20,12 @@ import java.time.LocalDateTime; @Setter @Entity @Table(name = "project") -@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -public class Project extends BasicEntity { +@EqualsAndHashCode(onlyExplicitlyIncluded = true) +public class Project implements BasicEntity { + + @Id + @Column(name = "id") + private Long id; @Column(name = "name") private String name; @@ -35,15 +39,4 @@ public class Project extends BasicEntity { @Column(name = "creator_id") private Integer creatorId; - @Id - @Column(name = "id") - @Override - public Long getId() { - return super.getId(); - } - - @Override - public void setId(Long id) { - super.setId(id); - } } diff --git a/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/PullRequest.java b/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/PullRequest.java index ceb19cc..82c8a23 100644 --- a/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/PullRequest.java +++ b/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/PullRequest.java @@ -28,8 +28,14 @@ import java.util.List; @Setter //@Entity //@Table(name = "pull_request") -@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -public class PullRequest extends BasicEntity { +@EqualsAndHashCode(onlyExplicitlyIncluded = true) +public class PullRequest implements BasicEntity { + + @Id + @Column(name = "id") + @EqualsAndHashCode.Include + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; /** * Идентификатор на стороне битбакета @@ -130,17 +136,4 @@ public class PullRequest extends BasicEntity { this.reviewers = reviewers; } - @Id - @Override - @Column(name = "id") - @EqualsAndHashCode.Include - @GeneratedValue(strategy = GenerationType.IDENTITY) - public Long getId() { - return super.getId(); - } - - @Override - public void setId(Long id) { - super.setId(id); - } } diff --git a/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Task.java b/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Task.java index f08c1ad..a2efed1 100644 --- a/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Task.java +++ b/bot-context/src/main/java/org/sadtech/bot/gitlab/context/domain/entity/Task.java @@ -22,8 +22,13 @@ import java.util.Set; @Getter @Setter //@Table(name = "task") -@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -public class Task extends BasicEntity { +@EqualsAndHashCode(onlyExplicitlyIncluded = true) +public class Task implements BasicEntity { + + @Id + @Column(name = "id") + @EqualsAndHashCode.Include + private Long id; /** * Описание задачи @@ -64,16 +69,4 @@ public class Task extends BasicEntity { @Column(name = "comment_id") private Set answers = new HashSet<>(); - @Override - @Id - @Column(name = "id") - @EqualsAndHashCode.Include - public Long getId() { - return super.getId(); - } - - @Override - public void setId(Long id) { - super.setId(id); - } } diff --git a/teamcity/teamcity-core/src/main/java/org/sadtech/bot/gitlab/teamcity/core/domain/entity/BuildShort.java b/teamcity/teamcity-core/src/main/java/org/sadtech/bot/gitlab/teamcity/core/domain/entity/BuildShort.java index 6001ce9..80e4929 100644 --- a/teamcity/teamcity-core/src/main/java/org/sadtech/bot/gitlab/teamcity/core/domain/entity/BuildShort.java +++ b/teamcity/teamcity-core/src/main/java/org/sadtech/bot/gitlab/teamcity/core/domain/entity/BuildShort.java @@ -24,7 +24,12 @@ import javax.persistence.Table; @Entity @Table(name = "teamcity_build") @EqualsAndHashCode(onlyExplicitlyIncluded = true) -public class BuildShort extends BasicEntity { +public class BuildShort implements BasicEntity { + + @Id + @Column(name = "id") + @EqualsAndHashCode.Include + private Long id; @Column(name = "project_id") private String projectId; @@ -52,16 +57,4 @@ public class BuildShort extends BasicEntity { @Column(name = "url") private String url; - @Override - @Id - @Column(name = "id") - @EqualsAndHashCode.Include - public Long getId() { - return super.getId(); - } - - @Override - public void setId(Long id) { - super.setId(id); - } } diff --git a/teamcity/teamcity-core/src/main/java/org/sadtech/bot/gitlab/teamcity/core/domain/entity/TeamcityProject.java b/teamcity/teamcity-core/src/main/java/org/sadtech/bot/gitlab/teamcity/core/domain/entity/TeamcityProject.java index 4dcb2e4..ea9b344 100644 --- a/teamcity/teamcity-core/src/main/java/org/sadtech/bot/gitlab/teamcity/core/domain/entity/TeamcityProject.java +++ b/teamcity/teamcity-core/src/main/java/org/sadtech/bot/gitlab/teamcity/core/domain/entity/TeamcityProject.java @@ -20,7 +20,12 @@ import javax.persistence.Table; @Entity @Table(name = "teamcity_project") @EqualsAndHashCode(onlyExplicitlyIncluded = true) -public class TeamcityProject extends BasicEntity { +public class TeamcityProject implements BasicEntity { + + @Id + @Column(name = "id") + @EqualsAndHashCode.Include + private String id; @Column(name = "name") private String name; @@ -31,16 +36,4 @@ public class TeamcityProject extends BasicEntity { @Column(name = "url") private String url; - @Override - @Id - @Column(name = "id") - @EqualsAndHashCode.Include - public String getId() { - return super.getId(); - } - - @Override - public void setId(String id) { - super.setId(id); - } } diff --git a/teamcity/teamcity-core/src/main/java/org/sadtech/bot/gitlab/teamcity/core/domain/entity/TeamcitySetting.java b/teamcity/teamcity-core/src/main/java/org/sadtech/bot/gitlab/teamcity/core/domain/entity/TeamcitySetting.java index 8e95491..00b0e33 100644 --- a/teamcity/teamcity-core/src/main/java/org/sadtech/bot/gitlab/teamcity/core/domain/entity/TeamcitySetting.java +++ b/teamcity/teamcity-core/src/main/java/org/sadtech/bot/gitlab/teamcity/core/domain/entity/TeamcitySetting.java @@ -25,7 +25,13 @@ import javax.persistence.Table; @Entity @Table(name = "teamcity_setting") @EqualsAndHashCode(onlyExplicitlyIncluded = true) -public class TeamcitySetting extends BasicEntity { +public class TeamcitySetting implements BasicEntity { + + @Id + @Column(name = "id") + @EqualsAndHashCode.Include + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; @Column(name = "recipient_id") private String recipientId; @@ -46,17 +52,4 @@ public class TeamcitySetting extends BasicEntity { @Column(name = "failure") private boolean failure; - @Override - @Id - @Column(name = "id") - @EqualsAndHashCode.Include - @GeneratedValue(strategy = GenerationType.IDENTITY) - public Long getId() { - return super.getId(); - } - - @Override - public void setId(Long id) { - super.setId(id); - } }