diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-01-12 20:30:21 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-01-12 20:30:21 +0100 |
commit | 571fd8525478424e1aa328b3170fc0804b2d33fc (patch) | |
tree | 9cb5c1300d8220441ad49e5b90d5d1dfd9f6a84b /src/main | |
parent | 4be112f6ad6ca385fabfa572233fb9db3c8b36e4 (diff) |
Simplify JPA entities with Panache.
Change-Id: I09cbea27e6f81e4092dcbbc2f56e5abb9494a945
Diffstat (limited to 'src/main')
33 files changed, 200 insertions, 1783 deletions
diff --git a/src/main/java/eu/mulk/mulkcms2/entity/Article.java b/src/main/java/eu/mulk/mulkcms2/entity/Article.java index d06eb3f..8d3aa7e 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/Article.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/Article.java @@ -2,7 +2,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; -import java.util.Objects; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; @@ -14,103 +13,35 @@ import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; -import org.hibernate.annotations.Fetch; @Entity @Table(name = "articles", schema = "public", catalog = "mulkcms") public class Article extends PanacheEntityBase { - private int id; - private Collection<ArticleAlias> aliases; - private Set<Category> categories; - private Collection<ArticleRevision> revisions; - private ArticleType type; - private Collection<Comment> comments; - private Collection<JournalEntry> journalEntries; - @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Article article = (Article) o; - return id == article.id; - } - - @Override - public int hashCode() { - return Objects.hash(id); - } + public int id; @OneToMany(mappedBy = "article", fetch = FetchType.LAZY) - public Collection<ArticleAlias> getAliases() { - return aliases; - } - - public void setAliases(Collection<ArticleAlias> aliases) { - this.aliases = aliases; - } + public Collection<ArticleAlias> aliases; @ManyToMany(fetch = FetchType.LAZY) - @JoinTable(name = "article_category_memberships", + @JoinTable( + name = "article_category_memberships", joinColumns = @JoinColumn(name = "article"), - inverseJoinColumns = @JoinColumn(name = "category") - ) - public Set<Category> getCategories() { - return categories; - } - - public void setCategories(Set<Category> categories) { - this.categories = categories; - } + inverseJoinColumns = @JoinColumn(name = "category")) + public Set<Category> categories; @OneToMany(mappedBy = "article", fetch = FetchType.LAZY) - public Collection<ArticleRevision> getRevisions() { - return revisions; - } - - public void setRevisions(Collection<ArticleRevision> revisions) { - this.revisions = revisions; - } + public Collection<ArticleRevision> revisions; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "type", referencedColumnName = "id", nullable = false) - public ArticleType getType() { - return type; - } - - public void setType(ArticleType type) { - this.type = type; - } + public ArticleType type; @OneToMany(mappedBy = "article", fetch = FetchType.LAZY) - public Collection<Comment> getComments() { - return comments; - } - - public void setComments(Collection<Comment> comments) { - this.comments = comments; - } + public Collection<Comment> comments; @OneToMany(mappedBy = "article", fetch = FetchType.LAZY) - public Collection<JournalEntry> getJournalEntries() { - return journalEntries; - } - - public void setJournalEntries(Collection<JournalEntry> journalEntries) { - this.journalEntries = journalEntries; - } + public Collection<JournalEntry> journalEntries; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/ArticleAlias.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleAlias.java index d41e28f..7974d5e 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/ArticleAlias.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleAlias.java @@ -1,7 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -14,43 +13,11 @@ import javax.persistence.Table; @Table(name = "article_aliases", schema = "public", catalog = "mulkcms") public class ArticleAlias extends PanacheEntityBase { - private String alias; - private Article article; - @Id @Column(name = "alias", nullable = false, length = -1) - public String getAlias() { - return alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ArticleAlias that = (ArticleAlias) o; - return Objects.equals(alias, that.alias); - } - - @Override - public int hashCode() { - return Objects.hash(alias); - } + public String alias; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "article", referencedColumnName = "id", nullable = false) - public Article getArticle() { - return article; - } - - public void setArticle(Article article) { - this.article = article; - } + public Article article; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/ArticleBranchTip.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleBranchTip.java index c061ed9..eacc151 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/ArticleBranchTip.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleBranchTip.java @@ -1,8 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -14,46 +12,11 @@ import javax.persistence.Table; @IdClass(ArticleBranchTipPK.class) public class ArticleBranchTip extends PanacheEntityBase { - private Integer articleId; - private Integer revisionId; - - @Basic @Column(name = "article", nullable = true) @Id - public Integer getArticleId() { - return articleId; - } - - public void setArticleId(Integer articleId) { - this.articleId = articleId; - } + private Integer articleId; - @Basic @Column(name = "revision", nullable = true) @Id - public Integer getRevisionId() { - return revisionId; - } - - public void setRevisionId(Integer revision) { - this.revisionId = revision; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ArticleBranchTip that = (ArticleBranchTip) o; - return Objects.equals(articleId, that.articleId) && - Objects.equals(revisionId, that.revisionId); - } - - @Override - public int hashCode() { - return Objects.hash(articleId, revisionId); - } + private Integer revisionId; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/ArticleCommentCount.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleCommentCount.java index a12cb66..4ec408d 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/ArticleCommentCount.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleCommentCount.java @@ -1,8 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -12,45 +10,10 @@ import javax.persistence.Table; @Table(name = "article_comment_counts", schema = "public", catalog = "mulkcms") public class ArticleCommentCount extends PanacheEntityBase { - @Id - private Integer article; - private Long commentCount; - - @Basic @Column(name = "article", nullable = true) - public Integer getArticle() { - return article; - } - - public void setArticle(Integer article) { - this.article = article; - } + @Id + public Integer article; - @Basic @Column(name = "comment_count", nullable = true) - public Long getCommentCount() { - return commentCount; - } - - public void setCommentCount(Long commentCount) { - this.commentCount = commentCount; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ArticleCommentCount that = (ArticleCommentCount) o; - return Objects.equals(article, that.article) && - Objects.equals(commentCount, that.commentCount); - } - - @Override - public int hashCode() { - return Objects.hash(article, commentCount); - } + public Long commentCount; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/ArticlePublishingDate.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticlePublishingDate.java index d3a8073..39d0c4a 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/ArticlePublishingDate.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticlePublishingDate.java @@ -2,8 +2,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.sql.Timestamp; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -13,45 +11,10 @@ import javax.persistence.Table; @Table(name = "article_publishing_dates", schema = "public", catalog = "mulkcms") public class ArticlePublishingDate extends PanacheEntityBase { - @Id - private Integer article; - private Timestamp publishingDate; - - @Basic @Column(name = "article", nullable = true) - public Integer getArticle() { - return article; - } - - public void setArticle(Integer article) { - this.article = article; - } + @Id + public Integer article; - @Basic @Column(name = "publishing_date", nullable = true) - public Timestamp getPublishingDate() { - return publishingDate; - } - - public void setPublishingDate(Timestamp publishingDate) { - this.publishingDate = publishingDate; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ArticlePublishingDate that = (ArticlePublishingDate) o; - return Objects.equals(article, that.article) && - Objects.equals(publishingDate, that.publishingDate); - } - - @Override - public int hashCode() { - return Objects.hash(article, publishingDate); - } + public Timestamp publishingDate; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevision.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevision.java index 9ea1450..f9ed05c 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevision.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevision.java @@ -3,9 +3,7 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.sql.Timestamp; import java.util.Collection; -import java.util.Objects; import java.util.Set; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -21,161 +19,46 @@ import javax.persistence.Table; @Table(name = "article_revisions", schema = "public", catalog = "mulkcms") public class ArticleRevision extends PanacheEntityBase { - private int id; - private Timestamp date; - private String title; - private String content; - private String format; - private String status; - private String globalId; - private Collection<ArticleRevisionCharacteristic> characteristics; - private Set<ArticleRevision> children; - private Set<ArticleRevision> parents; - private Article article; - private User authors; - @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "date", nullable = true) - public Timestamp getDate() { - return date; - } + public Timestamp date; - public void setDate(Timestamp date) { - this.date = date; - } - - @Basic @Column(name = "title", nullable = false, length = -1) - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } + public String title; - @Basic @Column(name = "content", nullable = false, length = -1) - public String getContent() { - return content; - } + public String content; - public void setContent(String content) { - this.content = content; - } - - @Basic @Column(name = "format", nullable = false, length = -1) - public String getFormat() { - return format; - } - - public void setFormat(String format) { - this.format = format; - } + public String format; - @Basic @Column(name = "status", nullable = false, length = -1) - public String getStatus() { - return status; - } + public String status; - public void setStatus(String status) { - this.status = status; - } - - @Basic @Column(name = "global_id", nullable = true, length = -1) - public String getGlobalId() { - return globalId; - } - - public void setGlobalId(String globalId) { - this.globalId = globalId; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ArticleRevision that = (ArticleRevision) o; - return id == that.id && - Objects.equals(date, that.date) && - Objects.equals(title, that.title) && - Objects.equals(content, that.content) && - Objects.equals(format, that.format) && - Objects.equals(status, that.status) && - Objects.equals(globalId, that.globalId); - } - - @Override - public int hashCode() { - return Objects.hash(id, date, title, content, format, status, globalId); - } + public String globalId; @OneToMany(mappedBy = "articleRevision", fetch = FetchType.LAZY) - public Collection<ArticleRevisionCharacteristic> getCharacteristics() { - return characteristics; - } - - public void setCharacteristics( - Collection<ArticleRevisionCharacteristic> characteristics) { - this.characteristics = characteristics; - } + public Collection<ArticleRevisionCharacteristic> characteristics; @ManyToMany(fetch = FetchType.LAZY) - @JoinTable(name = "article_revision_parenthood", + @JoinTable( + name = "article_revision_parenthood", joinColumns = @JoinColumn(name = "parent"), - inverseJoinColumns = @JoinColumn(name = "child") - ) - public Set<ArticleRevision> getChildren() { - return children; - } - - public void setChildren(Set<ArticleRevision> children) { - this.children = children; - } + inverseJoinColumns = @JoinColumn(name = "child")) + public Set<ArticleRevision> children; @ManyToMany(mappedBy = "children") - public Set<ArticleRevision> getParents() { - return parents; - } - - public void setParents(Set<ArticleRevision> parents) { - this.parents = parents; - } + public Set<ArticleRevision> parents; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "article", referencedColumnName = "id", nullable = false) - public Article getArticle() { - return article; - } - - public void setArticle(Article article) { - this.article = article; - } + public Article article; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "author", referencedColumnName = "id") - public User getAuthors() { - return authors; - } - - public void setAuthors(User authors) { - this.authors = authors; - } + public User authors; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevisionCharacteristic.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevisionCharacteristic.java index 6dfc881..cd7c302 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevisionCharacteristic.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevisionCharacteristic.java @@ -1,8 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -17,68 +15,23 @@ import javax.persistence.Table; @IdClass(ArticleRevisionCharacteristicPK.class) public class ArticleRevisionCharacteristic extends PanacheEntityBase { - private String characteristic; - private int articleRevisionId; - - private ArticleRevision articleRevision; - private String value; - - @Basic @Column(name = "characteristic", nullable = false, length = -1) @Id - public String getCharacteristic() { - return characteristic; - } - - public void setCharacteristic(String characteristic) { - this.characteristic = characteristic; - } - - @Basic - @Column(name = "value", nullable = true, length = -1) - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ArticleRevisionCharacteristic that = (ArticleRevisionCharacteristic) o; - return Objects.equals(characteristic, that.characteristic) && - Objects.equals(value, that.value); - } - - @Override - public int hashCode() { - return Objects.hash(characteristic, value); - } - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "revision", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) - public ArticleRevision getArticleRevision() { - return articleRevision; - } - - public void setArticleRevision(ArticleRevision articleRevision) { - this.articleRevision = articleRevision; - } + public String characteristic; @Id @Column(name = "revision", nullable = false) - public int getArticleRevisionId() { - return articleRevisionId; - } + public int articleRevisionId; - public void setArticleRevisionId(int articleRevisionId) { - this.articleRevisionId = articleRevisionId; - } + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn( + name = "revision", + referencedColumnName = "id", + nullable = false, + insertable = false, + updatable = false) + public ArticleRevision articleRevision; + + @Column(name = "value", nullable = true, length = -1) + public String value; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/ArticleType.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleType.java index 6f8d02d..0a98680 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/ArticleType.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleType.java @@ -2,8 +2,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -15,66 +13,16 @@ import javax.persistence.Table; @Table(name = "article_types", schema = "public", catalog = "mulkcms") public class ArticleType extends PanacheEntityBase { - private int id; - private String name; - private String pageTemplate; - private Collection<Article> articles; - @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "name", nullable = true, length = -1) - public String getName() { - return name; - } + public String name; - public void setName(String name) { - this.name = name; - } - - @Basic @Column(name = "page_template", nullable = true, length = -1) - public String getPageTemplate() { - return pageTemplate; - } - - public void setPageTemplate(String pageTemplate) { - this.pageTemplate = pageTemplate; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ArticleType that = (ArticleType) o; - return id == that.id && - Objects.equals(name, that.name) && - Objects.equals(pageTemplate, that.pageTemplate); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, pageTemplate); - } + public String pageTemplate; @OneToMany(mappedBy = "type", fetch = FetchType.LAZY) - public Collection<Article> getArticles() { - return articles; - } - - public void setArticles(Collection<Article> articles) { - this.articles = articles; - } + public Collection<Article> articles; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/CachedPage.java b/src/main/java/eu/mulk/mulkcms2/entity/CachedPage.java index ac8a438..36fff48 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/CachedPage.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/CachedPage.java @@ -2,8 +2,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.sql.Timestamp; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -15,68 +13,17 @@ import javax.persistence.Table; @IdClass(CachedPagePK.class) public class CachedPage extends PanacheEntityBase { - private String alias; - private int characteristicHash; - private Timestamp date; - private String content; - @Id @Column(name = "alias", nullable = false, length = -1) - public String getAlias() { - return alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } + public String alias; @Id @Column(name = "characteristic_hash", nullable = false) - public int getCharacteristicHash() { - return characteristicHash; - } + public int characteristicHash; - public void setCharacteristicHash(int characteristicHash) { - this.characteristicHash = characteristicHash; - } - - @Basic @Column(name = "date", nullable = false) - public Timestamp getDate() { - return date; - } - - public void setDate(Timestamp date) { - this.date = date; - } + public Timestamp date; - @Basic @Column(name = "content", nullable = false, length = -1) - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CachedPage that = (CachedPage) o; - return characteristicHash == that.characteristicHash && - Objects.equals(alias, that.alias) && - Objects.equals(date, that.date) && - Objects.equals(content, that.content); - } - - @Override - public int hashCode() { - return Objects.hash(alias, characteristicHash, date, content); - } + public String content; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/CachedPagePK.java b/src/main/java/eu/mulk/mulkcms2/entity/CachedPagePK.java index d22b3f7..e4b6fc3 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/CachedPagePK.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/CachedPagePK.java @@ -39,8 +39,7 @@ public class CachedPagePK implements Serializable { return false; } CachedPagePK that = (CachedPagePK) o; - return characteristicHash == that.characteristicHash && - Objects.equals(alias, that.alias); + return characteristicHash == that.characteristicHash && Objects.equals(alias, that.alias); } @Override diff --git a/src/main/java/eu/mulk/mulkcms2/entity/Category.java b/src/main/java/eu/mulk/mulkcms2/entity/Category.java index 20d91c2..08c473b 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/Category.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/Category.java @@ -1,9 +1,7 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; import java.util.Set; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -17,68 +15,20 @@ import javax.persistence.Table; @Table(name = "categories", schema = "public", catalog = "mulkcms") public class Category extends PanacheEntityBase { - private int id; - private String name; - private Set<Category> supercategories; - private Set<Category> subcategories; - @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "name", nullable = false, length = -1) - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Category category = (Category) o; - return id == category.id && - Objects.equals(name, category.name); - } - - @Override - public int hashCode() { - return Objects.hash(id, name); - } + public String name; @ManyToMany(fetch = FetchType.LAZY) - @JoinTable(name = "category_inclusions", + @JoinTable( + name = "category_inclusions", joinColumns = @JoinColumn(name = "category"), - inverseJoinColumns = @JoinColumn(name = "supercategory") - ) - public Set<Category> getSupercategories() { - return supercategories; - } - - public void setSupercategories(Set<Category> supercategories) { - this.supercategories = supercategories; - } + inverseJoinColumns = @JoinColumn(name = "supercategory")) + public Set<Category> supercategories; @ManyToMany(mappedBy = "supercategories", fetch = FetchType.LAZY) - public Set<Category> getSubcategories() { - return subcategories; - } - - public void setSubcategories(Set<Category> subcategories) { - this.subcategories = subcategories; - } + public Set<Category> subcategories; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/Comment.java b/src/main/java/eu/mulk/mulkcms2/entity/Comment.java index 8e38b95..0e3cb16 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/Comment.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/Comment.java @@ -2,8 +2,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -17,65 +15,17 @@ import javax.persistence.Table; @Table(name = "comments", schema = "public", catalog = "mulkcms") public class Comment extends PanacheEntityBase { - private int id; - private String globalId; - private Collection<CommentRevision> revisions; - private Article article; - @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "global_id", nullable = true, length = -1) - public String getGlobalId() { - return globalId; - } - - public void setGlobalId(String globalId) { - this.globalId = globalId; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Comment comment = (Comment) o; - return id == comment.id && - Objects.equals(globalId, comment.globalId); - } - - @Override - public int hashCode() { - return Objects.hash(id, globalId); - } + public String globalId; @OneToMany(mappedBy = "comment", fetch = FetchType.LAZY) - public Collection<CommentRevision> getRevisions() { - return revisions; - } - - public void setRevisions(Collection<CommentRevision> revisions) { - this.revisions = revisions; - } + public Collection<CommentRevision> revisions; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "article", referencedColumnName = "id", nullable = false) - public Article getArticle() { - return article; - } - - public void setArticle(Article article) { - this.article = article; - } + public Article article; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/CommentRevision.java b/src/main/java/eu/mulk/mulkcms2/entity/CommentRevision.java index a700bd6..920bff6 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/CommentRevision.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/CommentRevision.java @@ -4,8 +4,6 @@ import com.vladmihalcea.hibernate.type.basic.Inet; import com.vladmihalcea.hibernate.type.basic.PostgreSQLInetType; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.sql.Timestamp; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -17,145 +15,39 @@ import org.hibernate.annotations.TypeDef; @Entity @Table(name = "comment_revisions", schema = "public", catalog = "mulkcms") -@TypeDef( - name = "inet", - typeClass = PostgreSQLInetType.class, - defaultForType = Inet.class -) +@TypeDef(name = "inet", typeClass = PostgreSQLInetType.class, defaultForType = Inet.class) public class CommentRevision extends PanacheEntityBase { - private int id; - private Timestamp date; - private String content; - private String format; - private String status; - private Integer articleRevision; - private Inet submitterIp; - private String submitterUserAgent; - private Comment comment; - private User user; - @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "date", nullable = true) - public Timestamp getDate() { - return date; - } + public Timestamp date; - public void setDate(Timestamp date) { - this.date = date; - } - - @Basic @Column(name = "content", nullable = false, length = -1) - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } + public String content; - @Basic @Column(name = "format", nullable = false, length = -1) - public String getFormat() { - return format; - } + public String format; - public void setFormat(String format) { - this.format = format; - } - - @Basic @Column(name = "status", nullable = false, length = -1) - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } + public String status; - @Basic @Column(name = "article_revision", nullable = true) - public Integer getArticleRevision() { - return articleRevision; - } - - public void setArticleRevision(Integer articleRevision) { - this.articleRevision = articleRevision; - } + public Integer articleRevision; @Column(name = "submitter_ip", nullable = true, columnDefinition = "inet") - public Inet getSubmitterIp() { - return submitterIp; - } + public Inet submitterIp; - public void setSubmitterIp(Inet submitterIp) { - this.submitterIp = submitterIp; - } - - @Basic @Column(name = "submitter_user_agent", nullable = true, length = -1) - public String getSubmitterUserAgent() { - return submitterUserAgent; - } - - public void setSubmitterUserAgent(String submitterUserAgent) { - this.submitterUserAgent = submitterUserAgent; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CommentRevision that = (CommentRevision) o; - return id == that.id && - Objects.equals(date, that.date) && - Objects.equals(content, that.content) && - Objects.equals(format, that.format) && - Objects.equals(status, that.status) && - Objects.equals(articleRevision, that.articleRevision) && - Objects.equals(submitterIp, that.submitterIp) && - Objects.equals(submitterUserAgent, that.submitterUserAgent); - } - - @Override - public int hashCode() { - return Objects - .hash(id, date, content, format, status, articleRevision, submitterIp, submitterUserAgent); - } + public String submitterUserAgent; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "comment", referencedColumnName = "id", nullable = false) - public Comment getComment() { - return comment; - } - - public void setComment(Comment comment) { - this.comment = comment; - } + public Comment comment; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "author", referencedColumnName = "id") - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/Journal.java b/src/main/java/eu/mulk/mulkcms2/entity/Journal.java index 4ef3fa6..865f3af 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/Journal.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/Journal.java @@ -2,8 +2,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -15,54 +13,13 @@ import javax.persistence.Table; @Table(name = "journals", schema = "public", catalog = "mulkcms") public class Journal extends PanacheEntityBase { - private int id; - private String pathPrefix; - private Collection<JournalEntry> entries; - @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "path_prefix", nullable = true, length = -1) - public String getPathPrefix() { - return pathPrefix; - } - - public void setPathPrefix(String pathPrefix) { - this.pathPrefix = pathPrefix; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Journal journal = (Journal) o; - return id == journal.id && - Objects.equals(pathPrefix, journal.pathPrefix); - } - - @Override - public int hashCode() { - return Objects.hash(id, pathPrefix); - } + public String pathPrefix; @OneToMany(mappedBy = "journal", fetch = FetchType.LAZY) - public Collection<JournalEntry> getEntries() { - return entries; - } - - public void setEntries(Collection<JournalEntry> entries) { - this.entries = entries; - } + public Collection<JournalEntry> entries; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/JournalEntry.java b/src/main/java/eu/mulk/mulkcms2/entity/JournalEntry.java index da04b8a..7dedf02 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/JournalEntry.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/JournalEntry.java @@ -1,7 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -16,66 +15,24 @@ import javax.persistence.Table; @IdClass(JournalEntryPK.class) public class JournalEntry extends PanacheEntityBase { - private int journalId; - private int index; - private Journal journal; - private Article article; - @Id @Column(name = "journal", nullable = false) - public int getJournalId() { - return journalId; - } - - public void setJournalId(int journalId) { - this.journalId = journalId; - } + public int journalId; @Id @Column(name = "index", nullable = false) - public int getIndex() { - return index; - } - - public void setIndex(int index) { - this.index = index; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - JournalEntry that = (JournalEntry) o; - return journalId == that.journalId && - index == that.index; - } - - @Override - public int hashCode() { - return Objects.hash(journalId, index); - } + public int index; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "journal", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) - public Journal getJournal() { - return journal; - } - - public void setJournal(Journal journal) { - this.journal = journal; - } + @JoinColumn( + name = "journal", + referencedColumnName = "id", + nullable = false, + insertable = false, + updatable = false) + public Journal journal; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "article", referencedColumnName = "id", nullable = false) - public Article getArticle() { - return article; - } - - public void setArticle(Article article) { - this.article = article; - } + public Article article; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/JournalEntryPK.java b/src/main/java/eu/mulk/mulkcms2/entity/JournalEntryPK.java index f867d31..2d00c6e 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/JournalEntryPK.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/JournalEntryPK.java @@ -39,8 +39,7 @@ public class JournalEntryPK implements Serializable { return false; } JournalEntryPK that = (JournalEntryPK) o; - return journalId == that.journalId && - index == that.index; + return journalId == that.journalId && index == that.index; } @Override diff --git a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalCategory.java b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalCategory.java index 88a5ed4..b2837c7 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalCategory.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalCategory.java @@ -1,8 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -12,44 +10,10 @@ import javax.persistence.Table; @Table(name = "journal_category", schema = "public", catalog = "mulkcms") public class LegacyJournalCategory extends PanacheEntityBase { - private int id; - private String uuid; - @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "uuid", nullable = false, length = 36) - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - LegacyJournalCategory that = (LegacyJournalCategory) o; - return id == that.id && - Objects.equals(uuid, that.uuid); - } - - @Override - public int hashCode() { - return Objects.hash(id, uuid); - } + public String uuid; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalComment.java b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalComment.java index a1bfd95..00144fe 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalComment.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalComment.java @@ -1,8 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -15,152 +13,38 @@ import javax.persistence.Table; @Table(name = "journal_comment", schema = "public", catalog = "mulkcms") public class LegacyJournalComment extends PanacheEntityBase { - private int id; - private String uuid; - private long date; - private String body; - private String author; - private String email; - private String website; - private Boolean spamP; - private String submitterIp; - private String submitterUserAgent; - private LegacyJournalEntry journalEntry; - @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "uuid", nullable = false, length = 36) - public String getUuid() { - return uuid; - } + public String uuid; - public void setUuid(String uuid) { - this.uuid = uuid; - } - - @Basic @Column(name = "date", nullable = false) - public long getDate() { - return date; - } - - public void setDate(long date) { - this.date = date; - } + public long date; - @Basic @Column(name = "body", nullable = false, length = -1) - public String getBody() { - return body; - } + public String body; - public void setBody(String body) { - this.body = body; - } - - @Basic @Column(name = "author", nullable = true, length = -1) - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } + public String author; - @Basic @Column(name = "email", nullable = true, length = -1) - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } + public String email; - @Basic @Column(name = "website", nullable = true, length = -1) - public String getWebsite() { - return website; - } + public String website; - public void setWebsite(String website) { - this.website = website; - } - - @Basic @Column(name = "spam_p", nullable = true) - public Boolean getSpamP() { - return spamP; - } - - public void setSpamP(Boolean spamP) { - this.spamP = spamP; - } + public Boolean spamP; - @Basic @Column(name = "submitter_ip", nullable = false, length = -1) - public String getSubmitterIp() { - return submitterIp; - } + public String submitterIp; - public void setSubmitterIp(String submitterIp) { - this.submitterIp = submitterIp; - } - - @Basic @Column(name = "submitter_user_agent", nullable = false, length = -1) - public String getSubmitterUserAgent() { - return submitterUserAgent; - } - - public void setSubmitterUserAgent(String submitterUserAgent) { - this.submitterUserAgent = submitterUserAgent; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - LegacyJournalComment that = (LegacyJournalComment) o; - return id == that.id && - date == that.date && - Objects.equals(uuid, that.uuid) && - Objects.equals(body, that.body) && - Objects.equals(author, that.author) && - Objects.equals(email, that.email) && - Objects.equals(website, that.website) && - Objects.equals(spamP, that.spamP) && - Objects.equals(submitterIp, that.submitterIp) && - Objects.equals(submitterUserAgent, that.submitterUserAgent); - } - - @Override - public int hashCode() { - return Objects - .hash(id, uuid, date, body, author, email, website, spamP, submitterIp, submitterUserAgent); - } + public String submitterUserAgent; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "entry_id", referencedColumnName = "id", nullable = false) - public LegacyJournalEntry getJournalEntry() { - return journalEntry; - } - - public void setJournalEntry(LegacyJournalEntry journalEntry) { - this.journalEntry = journalEntry; - } + public LegacyJournalEntry journalEntry; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalEntry.java b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalEntry.java index ce36c47..dd905d1 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalEntry.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalEntry.java @@ -2,8 +2,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -15,134 +13,34 @@ import javax.persistence.Table; @Table(name = "journal_entry", schema = "public", catalog = "mulkcms") public class LegacyJournalEntry extends PanacheEntityBase { - private int id; - private String uuid; - private String title; - private long date; - private Long lastModification; - private String body; - private String type; - private Collection<LegacyJournalComment> comments; - private Collection<LegacyJournalPingback> pingbacks; - private Collection<LegacyJournalTrackback> trackbacks; - @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "uuid", nullable = false, length = 36) - public String getUuid() { - return uuid; - } + public String uuid; - public void setUuid(String uuid) { - this.uuid = uuid; - } - - @Basic @Column(name = "title", nullable = false, length = -1) - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } + public String title; - @Basic @Column(name = "date", nullable = false) - public long getDate() { - return date; - } + public long date; - public void setDate(long date) { - this.date = date; - } - - @Basic @Column(name = "last_modification", nullable = true) - public Long getLastModification() { - return lastModification; - } - - public void setLastModification(Long lastModification) { - this.lastModification = lastModification; - } + public Long lastModification; - @Basic @Column(name = "body", nullable = false, length = -1) - public String getBody() { - return body; - } - - public void setBody(String body) { - this.body = body; - } + public String body; - @Basic @Column(name = "type", nullable = false, length = -1) - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - LegacyJournalEntry that = (LegacyJournalEntry) o; - return id == that.id && - date == that.date && - Objects.equals(uuid, that.uuid) && - Objects.equals(title, that.title) && - Objects.equals(lastModification, that.lastModification) && - Objects.equals(body, that.body) && - Objects.equals(type, that.type); - } - - @Override - public int hashCode() { - return Objects.hash(id, uuid, title, date, lastModification, body, type); - } + public String type; @OneToMany(mappedBy = "journalEntry", fetch = FetchType.LAZY) - public Collection<LegacyJournalComment> getComments() { - return comments; - } - - public void setComments(Collection<LegacyJournalComment> comments) { - this.comments = comments; - } + public Collection<LegacyJournalComment> comments; @OneToMany(mappedBy = "journalEntry", fetch = FetchType.LAZY) - public Collection<LegacyJournalPingback> getPingbacks() { - return pingbacks; - } - - public void setPingbacks(Collection<LegacyJournalPingback> pingbacks) { - this.pingbacks = pingbacks; - } + public Collection<LegacyJournalPingback> pingbacks; @OneToMany(mappedBy = "journalEntry", fetch = FetchType.LAZY) - public Collection<LegacyJournalTrackback> getTrackbacks() { - return trackbacks; - } - - public void setTrackbacks(Collection<LegacyJournalTrackback> trackbacks) { - this.trackbacks = trackbacks; - } + public Collection<LegacyJournalTrackback> trackbacks; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalPingback.java b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalPingback.java index 9b683b7..a629a78 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalPingback.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalPingback.java @@ -1,8 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -15,115 +13,29 @@ import javax.persistence.Table; @Table(name = "journal_pingback", schema = "public", catalog = "mulkcms") public class LegacyJournalPingback extends PanacheEntityBase { - private int id; - private String uuid; - private long date; - private String url; - private Boolean spamP; - private String submitterIp; - private String submitterUserAgent; - private LegacyJournalEntry journalEntry; - @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "uuid", nullable = false, length = 36) - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } + public String uuid; - @Basic @Column(name = "date", nullable = false) - public long getDate() { - return date; - } + public long date; - public void setDate(long date) { - this.date = date; - } - - @Basic @Column(name = "url", nullable = true, length = -1) - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } + public String url; - @Basic @Column(name = "spam_p", nullable = true) - public Boolean getSpamP() { - return spamP; - } - - public void setSpamP(Boolean spamP) { - this.spamP = spamP; - } + public Boolean spamP; - @Basic @Column(name = "submitter_ip", nullable = false, length = -1) - public String getSubmitterIp() { - return submitterIp; - } + public String submitterIp; - public void setSubmitterIp(String submitterIp) { - this.submitterIp = submitterIp; - } - - @Basic @Column(name = "submitter_user_agent", nullable = false, length = -1) - public String getSubmitterUserAgent() { - return submitterUserAgent; - } - - public void setSubmitterUserAgent(String submitterUserAgent) { - this.submitterUserAgent = submitterUserAgent; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - LegacyJournalPingback that = (LegacyJournalPingback) o; - return id == that.id && - date == that.date && - Objects.equals(uuid, that.uuid) && - Objects.equals(url, that.url) && - Objects.equals(spamP, that.spamP) && - Objects.equals(submitterIp, that.submitterIp) && - Objects.equals(submitterUserAgent, that.submitterUserAgent); - } - - @Override - public int hashCode() { - return Objects.hash(id, uuid, date, url, spamP, submitterIp, submitterUserAgent); - } + public String submitterUserAgent; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "entry_id", referencedColumnName = "id", nullable = false) - public LegacyJournalEntry getJournalEntry() { - return journalEntry; - } - - public void setJournalEntry(LegacyJournalEntry journalEntry) { - this.journalEntry = journalEntry; - } + public LegacyJournalEntry journalEntry; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalTrackback.java b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalTrackback.java index 76bfd54..6bd0920 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalTrackback.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalTrackback.java @@ -1,8 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -15,153 +13,38 @@ import javax.persistence.Table; @Table(name = "journal_trackback", schema = "public", catalog = "mulkcms") public class LegacyJournalTrackback extends PanacheEntityBase { - private int id; - private String uuid; - private long date; - private String excerpt; - private String title; - private String blogName; - private String url; - private Boolean spamP; - private String submitterIp; - private String submitterUserAgent; - private LegacyJournalEntry journalEntry; - @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "uuid", nullable = false, length = 36) - public String getUuid() { - return uuid; - } + public String uuid; - public void setUuid(String uuid) { - this.uuid = uuid; - } - - @Basic @Column(name = "date", nullable = false) - public long getDate() { - return date; - } - - public void setDate(long date) { - this.date = date; - } + public long date; - @Basic @Column(name = "excerpt", nullable = false, length = -1) - public String getExcerpt() { - return excerpt; - } + public String excerpt; - public void setExcerpt(String excerpt) { - this.excerpt = excerpt; - } - - @Basic @Column(name = "title", nullable = true, length = -1) - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } + public String title; - @Basic @Column(name = "blog_name", nullable = true, length = -1) - public String getBlogName() { - return blogName; - } - - public void setBlogName(String blogName) { - this.blogName = blogName; - } + public String blogName; - @Basic @Column(name = "url", nullable = true, length = -1) - public String getUrl() { - return url; - } + public String url; - public void setUrl(String url) { - this.url = url; - } - - @Basic @Column(name = "spam_p", nullable = true) - public Boolean getSpamP() { - return spamP; - } - - public void setSpamP(Boolean spamP) { - this.spamP = spamP; - } + public Boolean spamP; - @Basic @Column(name = "submitter_ip", nullable = false, length = -1) - public String getSubmitterIp() { - return submitterIp; - } + public String submitterIp; - public void setSubmitterIp(String submitterIp) { - this.submitterIp = submitterIp; - } - - @Basic @Column(name = "submitter_user_agent", nullable = false, length = -1) - public String getSubmitterUserAgent() { - return submitterUserAgent; - } - - public void setSubmitterUserAgent(String submitterUserAgent) { - this.submitterUserAgent = submitterUserAgent; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - LegacyJournalTrackback that = (LegacyJournalTrackback) o; - return id == that.id && - date == that.date && - Objects.equals(uuid, that.uuid) && - Objects.equals(excerpt, that.excerpt) && - Objects.equals(title, that.title) && - Objects.equals(blogName, that.blogName) && - Objects.equals(url, that.url) && - Objects.equals(spamP, that.spamP) && - Objects.equals(submitterIp, that.submitterIp) && - Objects.equals(submitterUserAgent, that.submitterUserAgent); - } - - @Override - public int hashCode() { - return Objects - .hash(id, uuid, date, excerpt, title, blogName, url, spamP, submitterIp, - submitterUserAgent); - } + public String submitterUserAgent; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "entry_id", referencedColumnName = "id", nullable = false) - public LegacyJournalEntry getJournalEntry() { - return journalEntry; - } - - public void setJournalEntry(LegacyJournalEntry journalEntry) { - this.journalEntry = journalEntry; - } + public LegacyJournalEntry journalEntry; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificate.java b/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificate.java index 1095420..0218aec 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificate.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificate.java @@ -1,8 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Arrays; -import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -17,57 +15,20 @@ import javax.persistence.Table; @IdClass(LoginCertificatePK.class) public class LoginCertificate extends PanacheEntityBase { - private int userId; - private byte[] certificate; - private User user; - @Id @Column(name = "user", nullable = false) - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } + public int userId; @Id @Column(name = "certificate", nullable = false) - public byte[] getCertificate() { - return certificate; - } - - public void setCertificate(byte[] certificate) { - this.certificate = certificate; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - LoginCertificate that = (LoginCertificate) o; - return userId == that.userId && - Arrays.equals(certificate, that.certificate); - } - - @Override - public int hashCode() { - int result = Objects.hash(userId); - result = 31 * result + Arrays.hashCode(certificate); - return result; - } + public byte[] certificate; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + @JoinColumn( + name = "user", + referencedColumnName = "id", + nullable = false, + insertable = false, + updatable = false) + public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificatePK.java b/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificatePK.java index bb74971..4ab6ad9 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificatePK.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificatePK.java @@ -40,8 +40,7 @@ public class LoginCertificatePK implements Serializable { return false; } LoginCertificatePK that = (LoginCertificatePK) o; - return userId == that.userId && - Arrays.equals(certificate, that.certificate); + return userId == that.userId && Arrays.equals(certificate, that.certificate); } @Override diff --git a/src/main/java/eu/mulk/mulkcms2/entity/OpenId.java b/src/main/java/eu/mulk/mulkcms2/entity/OpenId.java index ee86773..444bf3e 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/OpenId.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/OpenId.java @@ -1,7 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -16,55 +15,20 @@ import javax.persistence.Table; @IdClass(OpenIdPK.class) public class OpenId extends PanacheEntityBase { - private int userId; - private String openid; - private User user; - @Id @Column(name = "user", nullable = false) - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } + public int userId; @Id @Column(name = "openid", nullable = false, length = -1) - public String getOpenid() { - return openid; - } - - public void setOpenid(String openid) { - this.openid = openid; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - OpenId openId = (OpenId) o; - return userId == openId.userId && - Objects.equals(openid, openId.openid); - } - - @Override - public int hashCode() { - return Objects.hash(userId, openid); - } + public String openid; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + @JoinColumn( + name = "user", + referencedColumnName = "id", + nullable = false, + insertable = false, + updatable = false) + public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/OpenIdPK.java b/src/main/java/eu/mulk/mulkcms2/entity/OpenIdPK.java index 22b72c0..7ce0693 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/OpenIdPK.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/OpenIdPK.java @@ -39,8 +39,7 @@ public class OpenIdPK implements Serializable { return false; } OpenIdPK openIdPK = (OpenIdPK) o; - return userId == openIdPK.userId && - Objects.equals(openid, openIdPK.openid); + return userId == openIdPK.userId && Objects.equals(openid, openIdPK.openid); } @Override diff --git a/src/main/java/eu/mulk/mulkcms2/entity/Password.java b/src/main/java/eu/mulk/mulkcms2/entity/Password.java index bf7d443..c1505f2 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/Password.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/Password.java @@ -1,7 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -16,55 +15,20 @@ import javax.persistence.Table; @IdClass(PasswordPK.class) public class Password extends PanacheEntityBase { - private int userId; - private String password; - private User user; - @Id @Column(name = "user", nullable = false) - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } + public int userId; @Id @Column(name = "password", nullable = false, length = -1) - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Password password1 = (Password) o; - return userId == password1.userId && - Objects.equals(password, password1.password); - } - - @Override - public int hashCode() { - return Objects.hash(userId, password); - } + public String password; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + @JoinColumn( + name = "user", + referencedColumnName = "id", + nullable = false, + insertable = false, + updatable = false) + public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/PasswordPK.java b/src/main/java/eu/mulk/mulkcms2/entity/PasswordPK.java index 3c7c0bb..f9fc7f6 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/PasswordPK.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/PasswordPK.java @@ -39,8 +39,7 @@ public class PasswordPK implements Serializable { return false; } PasswordPK that = (PasswordPK) o; - return userId == that.userId && - Objects.equals(password, that.password); + return userId == that.userId && Objects.equals(password, that.password); } @Override diff --git a/src/main/java/eu/mulk/mulkcms2/entity/UsedTransactionKey.java b/src/main/java/eu/mulk/mulkcms2/entity/UsedTransactionKey.java index 7d562a6..f1a6f68 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/UsedTransactionKey.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/UsedTransactionKey.java @@ -1,7 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -11,32 +10,7 @@ import javax.persistence.Table; @Table(name = "used_transaction_keys", schema = "public", catalog = "mulkcms") public class UsedTransactionKey extends PanacheEntityBase { - private long key; - @Id @Column(name = "key", nullable = false) - public long getKey() { - return key; - } - - public void setKey(long key) { - this.key = key; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UsedTransactionKey that = (UsedTransactionKey) o; - return key == that.key; - } - - @Override - public int hashCode() { - return Objects.hash(key); - } + public long key; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/User.java b/src/main/java/eu/mulk/mulkcms2/entity/User.java index ebe5048..3c606b9 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/User.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/User.java @@ -2,8 +2,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -15,150 +13,40 @@ import javax.persistence.Table; @Table(name = "users", schema = "public", catalog = "mulkcms") public class User extends PanacheEntityBase { - private int id; - private String name; - private String status; - private String email; - private String website; - private Collection<ArticleRevision> articleRevisions; - private Collection<CommentRevision> commentRevisions; - private Collection<LoginCertificate> loginCertificates; - private Collection<OpenId> openids; - private Collection<Password> passwords; - private Collection<UserPermission> userPermissions; - private Collection<UserSetting> userSettings; - @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "name", nullable = true, length = -1) - public String getName() { - return name; - } + public String name; - public void setName(String name) { - this.name = name; - } - - @Basic @Column(name = "status", nullable = false, length = -1) - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } + public String status; - @Basic @Column(name = "email", nullable = true, length = -1) - public String getEmail() { - return email; - } + public String email; - public void setEmail(String email) { - this.email = email; - } - - @Basic @Column(name = "website", nullable = true, length = -1) - public String getWebsite() { - return website; - } - - public void setWebsite(String website) { - this.website = website; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - User user = (User) o; - return id == user.id && - Objects.equals(name, user.name) && - Objects.equals(status, user.status) && - Objects.equals(email, user.email) && - Objects.equals(website, user.website); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, status, email, website); - } + public String website; @OneToMany(mappedBy = "authors", fetch = FetchType.LAZY) - public Collection<ArticleRevision> getArticleRevisions() { - return articleRevisions; - } - - public void setArticleRevisions(Collection<ArticleRevision> articleRevisions) { - this.articleRevisions = articleRevisions; - } + public Collection<ArticleRevision> articleRevisions; @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) - public Collection<CommentRevision> getCommentRevisions() { - return commentRevisions; - } - - public void setCommentRevisions(Collection<CommentRevision> commentRevisions) { - this.commentRevisions = commentRevisions; - } + public Collection<CommentRevision> commentRevisions; @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) - public Collection<LoginCertificate> getLoginCertificates() { - return loginCertificates; - } - - public void setLoginCertificates(Collection<LoginCertificate> loginCertificates) { - this.loginCertificates = loginCertificates; - } + public Collection<LoginCertificate> loginCertificates; @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) - public Collection<OpenId> getOpenids() { - return openids; - } - - public void setOpenids(Collection<OpenId> openids) { - this.openids = openids; - } + public Collection<OpenId> openids; @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) - public Collection<Password> getPasswords() { - return passwords; - } - - public void setPasswords(Collection<Password> passwords) { - this.passwords = passwords; - } + public Collection<Password> passwords; @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) - public Collection<UserPermission> getUserPermissions() { - return userPermissions; - } - - public void setUserPermissions(Collection<UserPermission> userPermissions) { - this.userPermissions = userPermissions; - } + public Collection<UserPermission> userPermissions; @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) - public Collection<UserSetting> getUserSettings() { - return userSettings; - } - - public void setUserSettings(Collection<UserSetting> userSettings) { - this.userSettings = userSettings; - } + public Collection<UserSetting> userSettings; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/UserPermission.java b/src/main/java/eu/mulk/mulkcms2/entity/UserPermission.java index 1395742..8290f8f 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/UserPermission.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/UserPermission.java @@ -1,8 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -17,67 +15,23 @@ import javax.persistence.Table; @IdClass(UserPermissionPK.class) public class UserPermission extends PanacheEntityBase { - private int userId; - private String permission; - private Boolean status; - private User user; - @Id @Column(name = "user", nullable = false) - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } + public int userId; @Id @Column(name = "permission", nullable = false, length = -1) - public String getPermission() { - return permission; - } + public String permission; - public void setPermission(String permission) { - this.permission = permission; - } - - @Basic @Column(name = "status", nullable = true) - public Boolean getStatus() { - return status; - } - - public void setStatus(Boolean status) { - this.status = status; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UserPermission that = (UserPermission) o; - return userId == that.userId && - Objects.equals(permission, that.permission) && - Objects.equals(status, that.status); - } - - @Override - public int hashCode() { - return Objects.hash(userId, permission, status); - } + public Boolean status; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + @JoinColumn( + name = "user", + referencedColumnName = "id", + nullable = false, + insertable = false, + updatable = false) + public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/UserPermissionPK.java b/src/main/java/eu/mulk/mulkcms2/entity/UserPermissionPK.java index 085aae2..fd0e89d 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/UserPermissionPK.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/UserPermissionPK.java @@ -39,8 +39,7 @@ public class UserPermissionPK implements Serializable { return false; } UserPermissionPK that = (UserPermissionPK) o; - return userId == that.userId && - Objects.equals(permission, that.permission); + return userId == that.userId && Objects.equals(permission, that.permission); } @Override diff --git a/src/main/java/eu/mulk/mulkcms2/entity/UserSetting.java b/src/main/java/eu/mulk/mulkcms2/entity/UserSetting.java index 0d6bd05..1ecd781 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/UserSetting.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/UserSetting.java @@ -1,8 +1,6 @@ package eu.mulk.mulkcms2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -17,67 +15,23 @@ import javax.persistence.Table; @IdClass(UserSettingPK.class) public class UserSetting extends PanacheEntityBase { - private int userId; - private String setting; - private String value; - private User user; - @Id @Column(name = "user", nullable = false) - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } + public int userId; @Id @Column(name = "setting", nullable = false, length = -1) - public String getSetting() { - return setting; - } + public String setting; - public void setSetting(String setting) { - this.setting = setting; - } - - @Basic @Column(name = "value", nullable = true, length = -1) - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UserSetting that = (UserSetting) o; - return userId == that.userId && - Objects.equals(setting, that.setting) && - Objects.equals(value, that.value); - } - - @Override - public int hashCode() { - return Objects.hash(userId, setting, value); - } + public String value; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + @JoinColumn( + name = "user", + referencedColumnName = "id", + nullable = false, + insertable = false, + updatable = false) + public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/UserSettingPK.java b/src/main/java/eu/mulk/mulkcms2/entity/UserSettingPK.java index 3b77247..5530750 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/UserSettingPK.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/UserSettingPK.java @@ -39,8 +39,7 @@ public class UserSettingPK implements Serializable { return false; } UserSettingPK that = (UserSettingPK) o; - return userId == that.userId && - Objects.equals(setting, that.setting); + return userId == that.userId && Objects.equals(setting, that.setting); } @Override |