From 35783a55e7af7375639011c63cdba778134bad30 Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Fri, 20 Jan 2023 18:36:39 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=BF=D1=80=D0=BE=D1=81=D1=82=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=81=D1=83=D1=89=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20Iss?= =?UTF-8?q?ue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitlab/context/domain/entity/Issue.java | 85 +++++-------------- .../gitlab/context/domain/entity/Links.java | 23 ----- .../context/domain/entity/Milestone.java | 64 -------------- .../context/domain/entity/References.java | 21 ----- .../domain/entity/TaskCompletionStatus.java | 20 ----- .../context/domain/entity/TimeStats.java | 23 ----- 6 files changed, 23 insertions(+), 213 deletions(-) delete mode 100644 bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Links.java delete mode 100644 bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Milestone.java delete mode 100644 bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/References.java delete mode 100644 bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/TaskCompletionStatus.java delete mode 100644 bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/TimeStats.java diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Issue.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Issue.java index 0253047..901a566 100644 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Issue.java +++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Issue.java @@ -8,9 +8,24 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; -import javax.persistence.*; +import javax.persistence.CascadeType; +import javax.persistence.CollectionTable; +import javax.persistence.Column; +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Set; @@ -68,10 +83,6 @@ public class Issue { @Column(name = "labels") private Set labels = new HashSet<>(); - @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) - @JoinColumn(name = "milestone_id") - private Milestone milestone; - @Column(name = "assignees") @OneToMany( fetch = FetchType.LAZY, @@ -82,7 +93,7 @@ public class Issue { joinColumns = @JoinColumn(name = "issue_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "person_id", referencedColumnName = "id") ) - private Set assignees = new HashSet<>(); + private List assignees = new ArrayList<>(); @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) @JoinColumn(name = "author_id") @@ -90,11 +101,7 @@ public class Issue { @Enumerated(value = EnumType.STRING) @Column(name = "type") - private IssueType type; // ОБразец приходящего значения "INCIDENT" - - @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) - @JoinColumn(name = "assignee_id") - private Person assignee; + private IssueType type; @Column(name = "user_notes_count") private Integer userNotesCount; @@ -117,65 +124,19 @@ public class Issue { @Column(name = "discussion_locked") private Integer discussionLocked; - @Column(name = "issue_type") - private String issueType; //TODO выяснить зачем дублирует поле type Образец приходящего значения "incident" + @Column(name = "task_count") + private Integer taskCount; + + @Column(name = "task_completed_count") + private Integer taskCompletedCount; @Column(name = "web_url") private String webUrl; - @Embedded - @AttributeOverrides({ - @AttributeOverride(name = "timeEstimate", column = @Column(name = "time_estimate")), - @AttributeOverride(name = "totalTimeSpent", column = @Column(name = "total_time_spent")), - @AttributeOverride(name = "humanTimeEstimate", column = @Column(name = "human_time_estimate")), - @AttributeOverride(name = "humanTotalTimeSpent", column = @Column(name = "human_total_time_spent")) - }) - private TimeStats timeStats; - - @Embedded - @AttributeOverrides({ - @AttributeOverride(name = "count", column = @Column(name = "task_count")), - @AttributeOverride(name = "completedCount", column = @Column(name = "task_completed_count")) - }) - private TaskCompletionStatus taskCompletionStatus; - @Column(name = "blocking_issues_count") private Integer blockingIssuesCount; @Column(name = "has_tasks") private Boolean hasTasks; - @Embedded - @AttributeOverrides({ - @AttributeOverride(name = "self", column = @Column(name = "link_to_self")), - @AttributeOverride(name = "notes", column = @Column(name = "link_to_notes")), - @AttributeOverride(name = "awardEmoji", column = @Column(name = "link_to_award_emoji")), - @AttributeOverride(name = "project", column = @Column(name = "link_to_project")), - @AttributeOverride(name = "closedAsDuplicateOf", column = @Column(name = "link_to_closed_as_duplicate_of")) - }) - private Links links; - - @Embedded - @AttributeOverrides({ - @AttributeOverride(name = "shortReference", column = @Column(name = "short_reference")), - @AttributeOverride(name = "relativeReference", column = @Column(name = "relative_reference")), - @AttributeOverride(name = "fullReference", column = @Column(name = "full_reference")) - }) - private References references; - - /** - Возможно надо заменить на енум: "UNKNOWN", "Critical - S1", "High - S2", "Medium - S3", "Low - S4". - Но выбор любых значений кроме "UNKNOWN" доступен только для премиум акаунтов и я не могу получить точные значения котоые оно принимает. - */ - @Column(name = "severity") - private String severity; - - @Column(name = "moved_to_id") - private Long movedToId; - - @Column(name = "service_desk_reply_to") - private String serviceDescReplyTo; - - @Column(name = "epic_issue_id") - private Long epicId; // "epic_issue_id" Поле доснтупное только для премиум акаунтов } \ No newline at end of file diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Links.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Links.java deleted file mode 100644 index 0537369..0000000 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Links.java +++ /dev/null @@ -1,23 +0,0 @@ -package dev.struchkov.bot.gitlab.context.domain.entity; - -import lombok.Getter; -import lombok.Setter; - -import javax.persistence.Embeddable; - -/** - * Сущность Issue. - * - * @author Dmitry Sheyko [17.01.2023] - */ - -@Embeddable -@Getter -@Setter -public class Links { - private String self; - private String notes; - private String awardEmoji; - private String project; - private String closedAsDuplicateOf; -} \ No newline at end of file diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Milestone.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Milestone.java deleted file mode 100644 index ed7e7b3..0000000 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Milestone.java +++ /dev/null @@ -1,64 +0,0 @@ -package dev.struchkov.bot.gitlab.context.domain.entity; - -import dev.struchkov.bot.gitlab.context.domain.MilestoneState; -import dev.struchkov.haiti.utils.fieldconstants.annotation.FieldNames; -import dev.struchkov.haiti.utils.fieldconstants.domain.Mode; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; - -import javax.persistence.*; -import java.time.LocalDateTime; - -/** - * Сущность Milestone. - * - * @author Dmitry Sheyko 17.01.2023 - */ - -@Entity -@Getter -@Setter -@EqualsAndHashCode(onlyExplicitlyIncluded = true) -@Table(name = "milestone") -@FieldNames(mode = {Mode.TABLE, Mode.SIMPLE}) -public class Milestone { - - @Id - @EqualsAndHashCode.Include - private Long id; - - @Column(name = "two_id") - private Long twoId; - - @Column(name = "project_id") - private Long projectId; - - @Column(name = "title") - private String title; - - @Column(name = "description") - private String description; - - @Enumerated(value = EnumType.STRING) - @Column(name = "state") - private MilestoneState state; - - @Column(name = "created_date") - private LocalDateTime createdDate; - - @Column(name = "updated_date") - private LocalDateTime updatedDate; - - @Column(name = "start_date") - private LocalDateTime startDate; //установленное создателем время начала - - @Column(name = "due_date") - private LocalDateTime dueDate; //установленное создателем время окончания - - @Column(name = "expired") - private Boolean expired; - - @Column(name = "web_url") - private String webUrl; -} \ No newline at end of file diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/References.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/References.java deleted file mode 100644 index d6cbbb9..0000000 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/References.java +++ /dev/null @@ -1,21 +0,0 @@ -package dev.struchkov.bot.gitlab.context.domain.entity; - -import lombok.Getter; -import lombok.Setter; - -import javax.persistence.Embeddable; - -/** - * Сущность References. - * - * @author Dmitry Sheyko [17.01.2023] - */ - -@Embeddable -@Getter -@Setter -public class References { - private String shortReference; - private String relativeReference; - private String fullReference; -} \ No newline at end of file diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/TaskCompletionStatus.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/TaskCompletionStatus.java deleted file mode 100644 index 5361f09..0000000 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/TaskCompletionStatus.java +++ /dev/null @@ -1,20 +0,0 @@ -package dev.struchkov.bot.gitlab.context.domain.entity; - -import lombok.Getter; -import lombok.Setter; - -import javax.persistence.Embeddable; - -/** - * Сущность TaskCompletionStatus. - * - * @author Dmitry Sheyko [17.01.2023] - */ - -@Embeddable -@Getter -@Setter -public class TaskCompletionStatus { - private Integer count; - private Integer completedCount; -} \ No newline at end of file diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/TimeStats.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/TimeStats.java deleted file mode 100644 index 672feb5..0000000 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/TimeStats.java +++ /dev/null @@ -1,23 +0,0 @@ -package dev.struchkov.bot.gitlab.context.domain.entity; - -import lombok.Getter; -import lombok.Setter; - -import javax.persistence.Embeddable; - -/** - * Сущность TimeStats. - * - * @author Dmitry Sheyko [17.01.2023] - */ - -@Embeddable -@Getter -@Setter -public class TimeStats { - private Integer timeEstimate; - private Integer totalTimeSpent; // количество секунд затраченых на работы, пример 37800" - private String humanTimeEstimate; - private String humanTotalTimeSpent; // Время строкой, пример "10h 30m" -} -