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.util.Collection; |
| 5 | import java.util.Objects; |
| 6 | import javax.persistence.Basic; |
| 7 | import javax.persistence.Column; |
| 8 | import javax.persistence.Entity; |
| 9 | import javax.persistence.Id; |
| 10 | import javax.persistence.OneToMany; |
| 11 | import javax.persistence.Table; |
| 12 | |
| 13 | @Entity |
| 14 | @Table(name = "journals", schema = "public", catalog = "mulkcms") |
| 15 | public 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 | } |