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.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.IdClass; |
| 11 | import javax.persistence.Table; |
| 12 | |
| 13 | @Entity |
| 14 | @Table(name = "cached_pages", schema = "public", catalog = "mulkcms") |
| 15 | @IdClass(CachedPagePK.class) |
| 16 | public class CachedPage extends PanacheEntityBase { |
| 17 | |
| 18 | private String alias; |
| 19 | private int characteristicHash; |
| 20 | private Timestamp date; |
| 21 | private String content; |
| 22 | |
| 23 | @Id |
| 24 | @Column(name = "alias", nullable = false, length = -1) |
| 25 | public String getAlias() { |
| 26 | return alias; |
| 27 | } |
| 28 | |
| 29 | public void setAlias(String alias) { |
| 30 | this.alias = alias; |
| 31 | } |
| 32 | |
| 33 | @Id |
| 34 | @Column(name = "characteristic_hash", nullable = false) |
| 35 | public int getCharacteristicHash() { |
| 36 | return characteristicHash; |
| 37 | } |
| 38 | |
| 39 | public void setCharacteristicHash(int characteristicHash) { |
| 40 | this.characteristicHash = characteristicHash; |
| 41 | } |
| 42 | |
| 43 | @Basic |
| 44 | @Column(name = "date", nullable = false) |
| 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 = "content", nullable = false, length = -1) |
| 55 | public String getContent() { |
| 56 | return content; |
| 57 | } |
| 58 | |
| 59 | public void setContent(String content) { |
| 60 | this.content = content; |
| 61 | } |
| 62 | |
| 63 | @Override |
| 64 | public boolean equals(Object o) { |
| 65 | if (this == o) { |
| 66 | return true; |
| 67 | } |
| 68 | if (o == null || getClass() != o.getClass()) { |
| 69 | return false; |
| 70 | } |
| 71 | CachedPage that = (CachedPage) o; |
| 72 | return characteristicHash == that.characteristicHash && |
| 73 | Objects.equals(alias, that.alias) && |
| 74 | Objects.equals(date, that.date) && |
| 75 | Objects.equals(content, that.content); |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public int hashCode() { |
| 80 | return Objects.hash(alias, characteristicHash, date, content); |
| 81 | } |
| 82 | } |