Matthias Andreas Benkard | 2f0b370 | 2020-01-12 15:46:34 +0100 | [diff] [blame^] | 1 | package eu.mulk.entity; |
| 2 | |
| 3 | import io.quarkus.hibernate.orm.panache.PanacheEntityBase; |
| 4 | import java.sql.Timestamp; |
| 5 | import java.util.Collection; |
| 6 | import java.util.Objects; |
| 7 | import javax.persistence.Basic; |
| 8 | import javax.persistence.Column; |
| 9 | import javax.persistence.Entity; |
| 10 | import javax.persistence.Id; |
| 11 | import javax.persistence.JoinColumn; |
| 12 | import javax.persistence.ManyToOne; |
| 13 | import javax.persistence.OneToMany; |
| 14 | import javax.persistence.Table; |
| 15 | |
| 16 | @Entity |
| 17 | @Table(name = "article_revisions", schema = "public", catalog = "mulkcms") |
| 18 | public class ArticleRevision extends PanacheEntityBase { |
| 19 | |
| 20 | private int id; |
| 21 | private Timestamp date; |
| 22 | private String title; |
| 23 | private String content; |
| 24 | private String format; |
| 25 | private String status; |
| 26 | private String globalId; |
| 27 | private Collection<ArticleRevisionCharacteristic> characteristics; |
| 28 | private Collection<ArticleRevisionParenthood> children; |
| 29 | private Collection<ArticleRevisionParenthood> parents; |
| 30 | private Article article; |
| 31 | private User authors; |
| 32 | |
| 33 | @Id |
| 34 | @Column(name = "id", nullable = false) |
| 35 | public int getId() { |
| 36 | return id; |
| 37 | } |
| 38 | |
| 39 | public void setId(int id) { |
| 40 | this.id = id; |
| 41 | } |
| 42 | |
| 43 | @Basic |
| 44 | @Column(name = "date", nullable = true) |
| 45 | public Timestamp getDate() { |
| 46 | return date; |
| 47 | } |
| 48 | |
| 49 | public void setDate(Timestamp date) { |
| 50 | this.date = date; |
| 51 | } |
| 52 | |
| 53 | @Basic |
| 54 | @Column(name = "title", nullable = false, length = -1) |
| 55 | public String getTitle() { |
| 56 | return title; |
| 57 | } |
| 58 | |
| 59 | public void setTitle(String title) { |
| 60 | this.title = title; |
| 61 | } |
| 62 | |
| 63 | @Basic |
| 64 | @Column(name = "content", nullable = false, length = -1) |
| 65 | public String getContent() { |
| 66 | return content; |
| 67 | } |
| 68 | |
| 69 | public void setContent(String content) { |
| 70 | this.content = content; |
| 71 | } |
| 72 | |
| 73 | @Basic |
| 74 | @Column(name = "format", nullable = false, length = -1) |
| 75 | public String getFormat() { |
| 76 | return format; |
| 77 | } |
| 78 | |
| 79 | public void setFormat(String format) { |
| 80 | this.format = format; |
| 81 | } |
| 82 | |
| 83 | @Basic |
| 84 | @Column(name = "status", nullable = false, length = -1) |
| 85 | public String getStatus() { |
| 86 | return status; |
| 87 | } |
| 88 | |
| 89 | public void setStatus(String status) { |
| 90 | this.status = status; |
| 91 | } |
| 92 | |
| 93 | @Basic |
| 94 | @Column(name = "global_id", nullable = true, length = -1) |
| 95 | public String getGlobalId() { |
| 96 | return globalId; |
| 97 | } |
| 98 | |
| 99 | public void setGlobalId(String globalId) { |
| 100 | this.globalId = globalId; |
| 101 | } |
| 102 | |
| 103 | @Override |
| 104 | public boolean equals(Object o) { |
| 105 | if (this == o) { |
| 106 | return true; |
| 107 | } |
| 108 | if (o == null || getClass() != o.getClass()) { |
| 109 | return false; |
| 110 | } |
| 111 | ArticleRevision that = (ArticleRevision) o; |
| 112 | return id == that.id && |
| 113 | Objects.equals(date, that.date) && |
| 114 | Objects.equals(title, that.title) && |
| 115 | Objects.equals(content, that.content) && |
| 116 | Objects.equals(format, that.format) && |
| 117 | Objects.equals(status, that.status) && |
| 118 | Objects.equals(globalId, that.globalId); |
| 119 | } |
| 120 | |
| 121 | @Override |
| 122 | public int hashCode() { |
| 123 | return Objects.hash(id, date, title, content, format, status, globalId); |
| 124 | } |
| 125 | |
| 126 | @OneToMany(mappedBy = "articleRevision") |
| 127 | public Collection<ArticleRevisionCharacteristic> getCharacteristics() { |
| 128 | return characteristics; |
| 129 | } |
| 130 | |
| 131 | public void setCharacteristics( |
| 132 | Collection<ArticleRevisionCharacteristic> characteristics) { |
| 133 | this.characteristics = characteristics; |
| 134 | } |
| 135 | |
| 136 | @OneToMany(mappedBy = "parent") |
| 137 | public Collection<ArticleRevisionParenthood> getChildren() { |
| 138 | return children; |
| 139 | } |
| 140 | |
| 141 | public void setChildren(Collection<ArticleRevisionParenthood> children) { |
| 142 | this.children = children; |
| 143 | } |
| 144 | |
| 145 | @OneToMany(mappedBy = "child") |
| 146 | public Collection<ArticleRevisionParenthood> getParents() { |
| 147 | return parents; |
| 148 | } |
| 149 | |
| 150 | public void setParents(Collection<ArticleRevisionParenthood> parents) { |
| 151 | this.parents = parents; |
| 152 | } |
| 153 | |
| 154 | @ManyToOne |
| 155 | @JoinColumn(name = "article", referencedColumnName = "id", nullable = false) |
| 156 | public Article getArticle() { |
| 157 | return article; |
| 158 | } |
| 159 | |
| 160 | public void setArticle(Article article) { |
| 161 | this.article = article; |
| 162 | } |
| 163 | |
| 164 | @ManyToOne |
| 165 | @JoinColumn(name = "author", referencedColumnName = "id") |
| 166 | public User getAuthors() { |
| 167 | return authors; |
| 168 | } |
| 169 | |
| 170 | public void setAuthors(User authors) { |
| 171 | this.authors = authors; |
| 172 | } |
| 173 | } |