blob: c5b7bcde83a4760781b97ba3de6147ac90af1521 [file] [log] [blame]
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +01001package eu.mulk.entity;
2
3import com.vladmihalcea.hibernate.type.basic.Inet;
4import com.vladmihalcea.hibernate.type.basic.PostgreSQLInetType;
5import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
6import java.sql.Timestamp;
7import java.util.Objects;
8import javax.persistence.Basic;
9import javax.persistence.Column;
10import javax.persistence.Entity;
11import javax.persistence.Id;
12import javax.persistence.JoinColumn;
13import javax.persistence.ManyToOne;
14import javax.persistence.Table;
15import org.hibernate.annotations.TypeDef;
16
17@Entity
18@Table(name = "comment_revisions", schema = "public", catalog = "mulkcms")
19@TypeDef(
20 name = "inet",
21 typeClass = PostgreSQLInetType.class,
22 defaultForType = Inet.class
23)
24public class CommentRevision extends PanacheEntityBase {
25
26 private int id;
27 private Timestamp date;
28 private String content;
29 private String format;
30 private String status;
31 private Integer articleRevision;
32 private Inet submitterIp;
33 private String submitterUserAgent;
34 private Comment comment;
35 private User user;
36
37 @Id
38 @Column(name = "id", nullable = false)
39 public int getId() {
40 return id;
41 }
42
43 public void setId(int id) {
44 this.id = id;
45 }
46
47 @Basic
48 @Column(name = "date", nullable = true)
49 public Timestamp getDate() {
50 return date;
51 }
52
53 public void setDate(Timestamp date) {
54 this.date = date;
55 }
56
57 @Basic
58 @Column(name = "content", nullable = false, length = -1)
59 public String getContent() {
60 return content;
61 }
62
63 public void setContent(String content) {
64 this.content = content;
65 }
66
67 @Basic
68 @Column(name = "format", nullable = false, length = -1)
69 public String getFormat() {
70 return format;
71 }
72
73 public void setFormat(String format) {
74 this.format = format;
75 }
76
77 @Basic
78 @Column(name = "status", nullable = false, length = -1)
79 public String getStatus() {
80 return status;
81 }
82
83 public void setStatus(String status) {
84 this.status = status;
85 }
86
87 @Basic
88 @Column(name = "article_revision", nullable = true)
89 public Integer getArticleRevision() {
90 return articleRevision;
91 }
92
93 public void setArticleRevision(Integer articleRevision) {
94 this.articleRevision = articleRevision;
95 }
96
97 @Column(name = "submitter_ip", nullable = true, columnDefinition = "inet")
98 public Inet getSubmitterIp() {
99 return submitterIp;
100 }
101
102 public void setSubmitterIp(Inet submitterIp) {
103 this.submitterIp = submitterIp;
104 }
105
106 @Basic
107 @Column(name = "submitter_user_agent", nullable = true, length = -1)
108 public String getSubmitterUserAgent() {
109 return submitterUserAgent;
110 }
111
112 public void setSubmitterUserAgent(String submitterUserAgent) {
113 this.submitterUserAgent = submitterUserAgent;
114 }
115
116 @Override
117 public boolean equals(Object o) {
118 if (this == o) {
119 return true;
120 }
121 if (o == null || getClass() != o.getClass()) {
122 return false;
123 }
124 CommentRevision that = (CommentRevision) o;
125 return id == that.id &&
126 Objects.equals(date, that.date) &&
127 Objects.equals(content, that.content) &&
128 Objects.equals(format, that.format) &&
129 Objects.equals(status, that.status) &&
130 Objects.equals(articleRevision, that.articleRevision) &&
131 Objects.equals(submitterIp, that.submitterIp) &&
132 Objects.equals(submitterUserAgent, that.submitterUserAgent);
133 }
134
135 @Override
136 public int hashCode() {
137 return Objects
138 .hash(id, date, content, format, status, articleRevision, submitterIp, submitterUserAgent);
139 }
140
141 @ManyToOne
142 @JoinColumn(name = "comment", referencedColumnName = "id", nullable = false)
143 public Comment getComment() {
144 return comment;
145 }
146
147 public void setComment(Comment comment) {
148 this.comment = comment;
149 }
150
151 @ManyToOne
152 @JoinColumn(name = "author", referencedColumnName = "id")
153 public User getUser() {
154 return user;
155 }
156
157 public void setUser(User user) {
158 this.user = user;
159 }
160}