blob: 6fc6794c544a1d0d02b5a26c69680a5b087a5691 [file] [log] [blame]
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +01001package eu.mulk.entity;
2
3import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
4import java.util.Collection;
5import java.util.Objects;
6import javax.persistence.Column;
7import javax.persistence.Entity;
8import javax.persistence.Id;
9import javax.persistence.JoinColumn;
10import javax.persistence.ManyToOne;
11import javax.persistence.OneToMany;
12import javax.persistence.Table;
13
14@Entity
15@Table(name = "articles", schema = "public", catalog = "mulkcms")
16public class Article extends PanacheEntityBase {
17
18 private int id;
19 private Collection<ArticleAlias> aliases;
20 private Collection<ArticleCategoryMembership> categoryMemberships;
21 private Collection<ArticleRevision> revisions;
22 private ArticleType type;
23 private Collection<Comment> comments;
24 private Collection<JournalEntry> journalEntries;
25
26 @Id
27 @Column(name = "id", nullable = false)
28 public int getId() {
29 return id;
30 }
31
32 public void setId(int id) {
33 this.id = id;
34 }
35
36 @Override
37 public boolean equals(Object o) {
38 if (this == o) {
39 return true;
40 }
41 if (o == null || getClass() != o.getClass()) {
42 return false;
43 }
44 Article article = (Article) o;
45 return id == article.id;
46 }
47
48 @Override
49 public int hashCode() {
50 return Objects.hash(id);
51 }
52
53 @OneToMany(mappedBy = "article")
54 public Collection<ArticleAlias> getAliases() {
55 return aliases;
56 }
57
58 public void setAliases(Collection<ArticleAlias> aliases) {
59 this.aliases = aliases;
60 }
61
62 @OneToMany(mappedBy = "article")
63 public Collection<ArticleCategoryMembership> getCategoryMemberships() {
64 return categoryMemberships;
65 }
66
67 public void setCategoryMemberships(
68 Collection<ArticleCategoryMembership> categoryMemberships) {
69 this.categoryMemberships = categoryMemberships;
70 }
71
72 @OneToMany(mappedBy = "article")
73 public Collection<ArticleRevision> getRevisions() {
74 return revisions;
75 }
76
77 public void setRevisions(Collection<ArticleRevision> revisions) {
78 this.revisions = revisions;
79 }
80
81 @ManyToOne
82 @JoinColumn(name = "type", referencedColumnName = "id", nullable = false)
83 public ArticleType getType() {
84 return type;
85 }
86
87 public void setType(ArticleType type) {
88 this.type = type;
89 }
90
91 @OneToMany(mappedBy = "article")
92 public Collection<Comment> getComments() {
93 return comments;
94 }
95
96 public void setComments(Collection<Comment> comments) {
97 this.comments = comments;
98 }
99
100 @OneToMany(mappedBy = "article")
101 public Collection<JournalEntry> getJournalEntries() {
102 return journalEntries;
103 }
104
105 public void setJournalEntries(Collection<JournalEntry> journalEntries) {
106 this.journalEntries = journalEntries;
107 }
108}