blob: 63447dfb4364262f0d15352e790b2bbe0ae288cf [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.Basic;
7import javax.persistence.Column;
8import javax.persistence.Entity;
9import javax.persistence.Id;
10import javax.persistence.OneToMany;
11import javax.persistence.Table;
12
13@Entity
14@Table(name = "journals", schema = "public", catalog = "mulkcms")
15public class Journal extends PanacheEntityBase {
16
17 private int id;
18 private String pathPrefix;
19 private Collection<JournalEntry> entries;
20
21 @Id
22 @Column(name = "id", nullable = false)
23 public int getId() {
24 return id;
25 }
26
27 public void setId(int id) {
28 this.id = id;
29 }
30
31 @Basic
32 @Column(name = "path_prefix", nullable = true, length = -1)
33 public String getPathPrefix() {
34 return pathPrefix;
35 }
36
37 public void setPathPrefix(String pathPrefix) {
38 this.pathPrefix = pathPrefix;
39 }
40
41 @Override
42 public boolean equals(Object o) {
43 if (this == o) {
44 return true;
45 }
46 if (o == null || getClass() != o.getClass()) {
47 return false;
48 }
49 Journal journal = (Journal) o;
50 return id == journal.id &&
51 Objects.equals(pathPrefix, journal.pathPrefix);
52 }
53
54 @Override
55 public int hashCode() {
56 return Objects.hash(id, pathPrefix);
57 }
58
59 @OneToMany(mappedBy = "journal")
60 public Collection<JournalEntry> getEntries() {
61 return entries;
62 }
63
64 public void setEntries(Collection<JournalEntry> entries) {
65 this.entries = entries;
66 }
67}