diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-01-12 15:46:34 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-01-12 15:46:34 +0100 |
commit | 2f0b3705c668ff4f353e45bda66d9c5f7e20552f (patch) | |
tree | aa56e2ba044d1eb7fee8d00063b1d1d38a2e8b82 /src/main/scala/eu | |
parent | 4c5847bffd0401e62a3f2beaeba8c0cb887359ce (diff) |
Import autogenerated JPA entities.
Adds JPA entities generated by IntelliJ for all existing tables in the
database.
Change-Id: Iac957b5d68ce45328db87487f105522f8595e124
Diffstat (limited to 'src/main/scala/eu')
41 files changed, 3247 insertions, 0 deletions
diff --git a/src/main/scala/eu/mulk/entity/Article.java b/src/main/scala/eu/mulk/entity/Article.java new file mode 100644 index 0000000..6fc6794 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/Article.java @@ -0,0 +1,108 @@ +package eu.mulk.entity; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.util.Collection; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "articles", schema = "public", catalog = "mulkcms") +public class Article extends PanacheEntityBase { + + private int id; + private Collection<ArticleAlias> aliases; + private Collection<ArticleCategoryMembership> categoryMemberships; + 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); + } + + @OneToMany(mappedBy = "article") + public Collection<ArticleAlias> getAliases() { + return aliases; + } + + public void setAliases(Collection<ArticleAlias> aliases) { + this.aliases = aliases; + } + + @OneToMany(mappedBy = "article") + public Collection<ArticleCategoryMembership> getCategoryMemberships() { + return categoryMemberships; + } + + public void setCategoryMemberships( + Collection<ArticleCategoryMembership> categoryMemberships) { + this.categoryMemberships = categoryMemberships; + } + + @OneToMany(mappedBy = "article") + public Collection<ArticleRevision> getRevisions() { + return revisions; + } + + public void setRevisions(Collection<ArticleRevision> revisions) { + this.revisions = revisions; + } + + @ManyToOne + @JoinColumn(name = "type", referencedColumnName = "id", nullable = false) + public ArticleType getType() { + return type; + } + + public void setType(ArticleType type) { + this.type = type; + } + + @OneToMany(mappedBy = "article") + public Collection<Comment> getComments() { + return comments; + } + + public void setComments(Collection<Comment> comments) { + this.comments = comments; + } + + @OneToMany(mappedBy = "article") + public Collection<JournalEntry> getJournalEntries() { + return journalEntries; + } + + public void setJournalEntries(Collection<JournalEntry> journalEntries) { + this.journalEntries = journalEntries; + } +} diff --git a/src/main/scala/eu/mulk/entity/ArticleAlias.java b/src/main/scala/eu/mulk/entity/ArticleAlias.java new file mode 100644 index 0000000..7599984 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/ArticleAlias.java @@ -0,0 +1,55 @@ +package eu.mulk.entity; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@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); + } + + @ManyToOne + @JoinColumn(name = "article", referencedColumnName = "id", nullable = false) + public Article getArticle() { + return article; + } + + public void setArticle(Article article) { + this.article = article; + } +} diff --git a/src/main/scala/eu/mulk/entity/ArticleBranchTip.java b/src/main/scala/eu/mulk/entity/ArticleBranchTip.java new file mode 100644 index 0000000..5bbb0a8 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/ArticleBranchTip.java @@ -0,0 +1,59 @@ +package eu.mulk.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; +import javax.persistence.IdClass; +import javax.persistence.Table; + +@Entity +@Table(name = "article_branch_tips", schema = "public", catalog = "mulkcms") +@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; + } + + @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); + } +} diff --git a/src/main/scala/eu/mulk/entity/ArticleBranchTipPK.java b/src/main/scala/eu/mulk/entity/ArticleBranchTipPK.java new file mode 100644 index 0000000..bab4247 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/ArticleBranchTipPK.java @@ -0,0 +1,32 @@ +package eu.mulk.entity; + +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Id; + +public class ArticleBranchTipPK implements Serializable { + + private int articleId; + private int revisionId; + + @Id + @Column(name = "article", nullable = false) + public int getArticleId() { + return articleId; + } + + @Id + @Column(name = "revision", nullable = false) + public int getRevisionId() { + return revisionId; + } + + public void setArticleId(int articleId) { + this.articleId = articleId; + } + + public void setRevisionId(int revisionId) { + this.revisionId = revisionId; + } +} diff --git a/src/main/scala/eu/mulk/entity/ArticleCategoryMembership.java b/src/main/scala/eu/mulk/entity/ArticleCategoryMembership.java new file mode 100644 index 0000000..dd5982d --- /dev/null +++ b/src/main/scala/eu/mulk/entity/ArticleCategoryMembership.java @@ -0,0 +1,69 @@ +package eu.mulk.entity; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "article_category_memberships", schema = "public", catalog = "mulkcms") +@IdClass(ArticleCategoryMembershipPK.class) +public class ArticleCategoryMembership extends PanacheEntityBase { + + private int articleId; + private String category; + private Article article; + + @Id + @Column(name = "article", nullable = false) + public int getArticleId() { + return articleId; + } + + public void setArticleId(int articleId) { + this.articleId = articleId; + } + + @Id + @Column(name = "category", nullable = false, length = -1) + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArticleCategoryMembership that = (ArticleCategoryMembership) o; + return articleId == that.articleId && + Objects.equals(category, that.category); + } + + @Override + public int hashCode() { + return Objects.hash(articleId, category); + } + + @ManyToOne + @JoinColumn(name = "article", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) + public Article getArticle() { + return article; + } + + public void setArticle(Article article) { + this.article = article; + } +} diff --git a/src/main/scala/eu/mulk/entity/ArticleCategoryMembershipPK.java b/src/main/scala/eu/mulk/entity/ArticleCategoryMembershipPK.java new file mode 100644 index 0000000..97ee625 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/ArticleCategoryMembershipPK.java @@ -0,0 +1,50 @@ +package eu.mulk.entity; + +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Id; + +public class ArticleCategoryMembershipPK implements Serializable { + + private int articleId; + private String category; + + @Column(name = "article", nullable = false) + @Id + public int getArticleId() { + return articleId; + } + + public void setArticleId(int articleId) { + this.articleId = articleId; + } + + @Column(name = "category", nullable = false, length = -1) + @Id + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArticleCategoryMembershipPK that = (ArticleCategoryMembershipPK) o; + return articleId == that.articleId && + Objects.equals(category, that.category); + } + + @Override + public int hashCode() { + return Objects.hash(articleId, category); + } +} diff --git a/src/main/scala/eu/mulk/entity/ArticleCommentCount.java b/src/main/scala/eu/mulk/entity/ArticleCommentCount.java new file mode 100644 index 0000000..283a7f4 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/ArticleCommentCount.java @@ -0,0 +1,56 @@ +package eu.mulk.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; +import javax.persistence.Table; + +@Entity +@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; + } + + @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); + } +} diff --git a/src/main/scala/eu/mulk/entity/ArticlePublishingDate.java b/src/main/scala/eu/mulk/entity/ArticlePublishingDate.java new file mode 100644 index 0000000..cc311b7 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/ArticlePublishingDate.java @@ -0,0 +1,57 @@ +package eu.mulk.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; +import javax.persistence.Table; + +@Entity +@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; + } + + @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); + } +} diff --git a/src/main/scala/eu/mulk/entity/ArticleRevision.java b/src/main/scala/eu/mulk/entity/ArticleRevision.java new file mode 100644 index 0000000..278c304 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/ArticleRevision.java @@ -0,0 +1,173 @@ +package eu.mulk.entity; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.sql.Timestamp; +import java.util.Collection; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@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 Collection<ArticleRevisionParenthood> children; + private Collection<ArticleRevisionParenthood> 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; + } + + @Basic + @Column(name = "date", nullable = true) + public Timestamp getDate() { + return 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; + } + + @Basic + @Column(name = "content", nullable = false, length = -1) + public String getContent() { + return 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; + } + + @Basic + @Column(name = "status", nullable = false, length = -1) + public String getStatus() { + return 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); + } + + @OneToMany(mappedBy = "articleRevision") + public Collection<ArticleRevisionCharacteristic> getCharacteristics() { + return characteristics; + } + + public void setCharacteristics( + Collection<ArticleRevisionCharacteristic> characteristics) { + this.characteristics = characteristics; + } + + @OneToMany(mappedBy = "parent") + public Collection<ArticleRevisionParenthood> getChildren() { + return children; + } + + public void setChildren(Collection<ArticleRevisionParenthood> children) { + this.children = children; + } + + @OneToMany(mappedBy = "child") + public Collection<ArticleRevisionParenthood> getParents() { + return parents; + } + + public void setParents(Collection<ArticleRevisionParenthood> parents) { + this.parents = parents; + } + + @ManyToOne + @JoinColumn(name = "article", referencedColumnName = "id", nullable = false) + public Article getArticle() { + return article; + } + + public void setArticle(Article article) { + this.article = article; + } + + @ManyToOne + @JoinColumn(name = "author", referencedColumnName = "id") + public User getAuthors() { + return authors; + } + + public void setAuthors(User authors) { + this.authors = authors; + } +} diff --git a/src/main/scala/eu/mulk/entity/ArticleRevisionCharacteristic.java b/src/main/scala/eu/mulk/entity/ArticleRevisionCharacteristic.java new file mode 100644 index 0000000..8cc0661 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/ArticleRevisionCharacteristic.java @@ -0,0 +1,83 @@ +package eu.mulk.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; +import javax.persistence.IdClass; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "article_revision_characteristics", schema = "public", catalog = "mulkcms") +@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 + @JoinColumn(name = "revision", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) + public ArticleRevision getArticleRevision() { + return articleRevision; + } + + public void setArticleRevision(ArticleRevision articleRevision) { + this.articleRevision = articleRevision; + } + + @Id + @Column(name = "revision", nullable = false) + public int getArticleRevisionId() { + return articleRevisionId; + } + + public void setArticleRevisionId(int articleRevisionId) { + this.articleRevisionId = articleRevisionId; + } +} diff --git a/src/main/scala/eu/mulk/entity/ArticleRevisionCharacteristicPK.java b/src/main/scala/eu/mulk/entity/ArticleRevisionCharacteristicPK.java new file mode 100644 index 0000000..5e28967 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/ArticleRevisionCharacteristicPK.java @@ -0,0 +1,27 @@ +package eu.mulk.entity; + +import java.io.Serializable; +import javax.persistence.Id; + +public class ArticleRevisionCharacteristicPK implements Serializable { + private String characteristic; + private int articleRevisionId; + + @Id + public String getCharacteristic() { + return characteristic; + } + + public void setCharacteristic(String characteristic) { + this.characteristic = characteristic; + } + + @Id + public int getArticleRevisionId() { + return articleRevisionId; + } + + public void setArticleRevisionId(int articleRevisionId) { + this.articleRevisionId = articleRevisionId; + } +} diff --git a/src/main/scala/eu/mulk/entity/ArticleRevisionParenthood.java b/src/main/scala/eu/mulk/entity/ArticleRevisionParenthood.java new file mode 100644 index 0000000..823ca09 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/ArticleRevisionParenthood.java @@ -0,0 +1,80 @@ +package eu.mulk.entity; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "article_revision_parenthood", schema = "public", catalog = "mulkcms") +@IdClass(ArticleRevisionParenthoodPK.class) +public class ArticleRevisionParenthood extends PanacheEntityBase { + + private int parentId; + private int childId; + private ArticleRevision parent; + private ArticleRevision child; + + @Id + @Column(name = "parent", nullable = false) + public int getParentId() { + return parentId; + } + + public void setParentId(int parentId) { + this.parentId = parentId; + } + + @Id + @Column(name = "child", nullable = false) + public int getChildId() { + return childId; + } + + public void setChildId(int childId) { + this.childId = childId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArticleRevisionParenthood that = (ArticleRevisionParenthood) o; + return parentId == that.parentId && + childId == that.childId; + } + + @Override + public int hashCode() { + return Objects.hash(parentId, childId); + } + + @ManyToOne + @JoinColumn(name = "parent", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) + public ArticleRevision getParent() { + return parent; + } + + public void setParent(ArticleRevision parent) { + this.parent = parent; + } + + @ManyToOne + @JoinColumn(name = "child", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) + public ArticleRevision getChild() { + return child; + } + + public void setChild(ArticleRevision child) { + this.child = child; + } +} diff --git a/src/main/scala/eu/mulk/entity/ArticleRevisionParenthoodPK.java b/src/main/scala/eu/mulk/entity/ArticleRevisionParenthoodPK.java new file mode 100644 index 0000000..ecb918c --- /dev/null +++ b/src/main/scala/eu/mulk/entity/ArticleRevisionParenthoodPK.java @@ -0,0 +1,50 @@ +package eu.mulk.entity; + +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Id; + +public class ArticleRevisionParenthoodPK implements Serializable { + + private int parentId; + private int childId; + + @Column(name = "parent", nullable = false) + @Id + public int getParentId() { + return parentId; + } + + public void setParentId(int parentId) { + this.parentId = parentId; + } + + @Column(name = "child", nullable = false) + @Id + public int getChildId() { + return childId; + } + + public void setChildId(int childId) { + this.childId = childId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArticleRevisionParenthoodPK that = (ArticleRevisionParenthoodPK) o; + return parentId == that.parentId && + childId == that.childId; + } + + @Override + public int hashCode() { + return Objects.hash(parentId, childId); + } +} diff --git a/src/main/scala/eu/mulk/entity/ArticleType.java b/src/main/scala/eu/mulk/entity/ArticleType.java new file mode 100644 index 0000000..4bc5e08 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/ArticleType.java @@ -0,0 +1,79 @@ +package eu.mulk.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.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@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; + } + + @Basic + @Column(name = "name", nullable = true, length = -1) + public String getName() { + return 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); + } + + @OneToMany(mappedBy = "type") + public Collection<Article> getArticles() { + return articles; + } + + public void setArticles(Collection<Article> articles) { + this.articles = articles; + } +} diff --git a/src/main/scala/eu/mulk/entity/CachedPage.java b/src/main/scala/eu/mulk/entity/CachedPage.java new file mode 100644 index 0000000..0ef1d73 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/CachedPage.java @@ -0,0 +1,82 @@ +package eu.mulk.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; +import javax.persistence.IdClass; +import javax.persistence.Table; + +@Entity +@Table(name = "cached_pages", schema = "public", catalog = "mulkcms") +@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; + } + + @Id + @Column(name = "characteristic_hash", nullable = false) + public int getCharacteristicHash() { + return 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; + } + + @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); + } +} diff --git a/src/main/scala/eu/mulk/entity/CachedPagePK.java b/src/main/scala/eu/mulk/entity/CachedPagePK.java new file mode 100644 index 0000000..43793bb --- /dev/null +++ b/src/main/scala/eu/mulk/entity/CachedPagePK.java @@ -0,0 +1,50 @@ +package eu.mulk.entity; + +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Id; + +public class CachedPagePK implements Serializable { + + private String alias; + private int characteristicHash; + + @Column(name = "alias", nullable = false, length = -1) + @Id + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + @Column(name = "characteristic_hash", nullable = false) + @Id + public int getCharacteristicHash() { + return characteristicHash; + } + + public void setCharacteristicHash(int characteristicHash) { + this.characteristicHash = characteristicHash; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CachedPagePK that = (CachedPagePK) o; + return characteristicHash == that.characteristicHash && + Objects.equals(alias, that.alias); + } + + @Override + public int hashCode() { + return Objects.hash(alias, characteristicHash); + } +} diff --git a/src/main/scala/eu/mulk/entity/Category.java b/src/main/scala/eu/mulk/entity/Category.java new file mode 100644 index 0000000..d74ccfb --- /dev/null +++ b/src/main/scala/eu/mulk/entity/Category.java @@ -0,0 +1,77 @@ +package eu.mulk.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.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "categories", schema = "public", catalog = "mulkcms") +public class Category extends PanacheEntityBase { + + private int id; + private String name; + private Collection<CategoryInclusion> supercategories; + private Collection<CategoryInclusion> subcategories; + + @Id + @Column(name = "id", nullable = false) + public int getId() { + return id; + } + + public void setId(int id) { + this.id = 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); + } + + @OneToMany(mappedBy = "subcategory") + public Collection<CategoryInclusion> getSupercategories() { + return supercategories; + } + + public void setSupercategories(Collection<CategoryInclusion> supercategories) { + this.supercategories = supercategories; + } + + @OneToMany(mappedBy = "supercategory") + public Collection<CategoryInclusion> getSubcategories() { + return subcategories; + } + + public void setSubcategories(Collection<CategoryInclusion> subcategories) { + this.subcategories = subcategories; + } +} diff --git a/src/main/scala/eu/mulk/entity/CategoryInclusion.java b/src/main/scala/eu/mulk/entity/CategoryInclusion.java new file mode 100644 index 0000000..387615f --- /dev/null +++ b/src/main/scala/eu/mulk/entity/CategoryInclusion.java @@ -0,0 +1,80 @@ +package eu.mulk.entity; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "category_inclusions", schema = "public", catalog = "mulkcms") +@IdClass(CategoryInclusionPK.class) +public class CategoryInclusion extends PanacheEntityBase { + + private int subcategoryId; + private int supercategoryId; + private Category subcategory; + private Category supercategory; + + @Id + @Column(name = "category", nullable = false) + public int getSubcategoryId() { + return subcategoryId; + } + + public void setSubcategoryId(int subcategoryId) { + this.subcategoryId = subcategoryId; + } + + @Id + @Column(name = "supercategory", nullable = false) + public int getSupercategoryId() { + return supercategoryId; + } + + public void setSupercategoryId(int supercategoryId) { + this.supercategoryId = supercategoryId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryInclusion that = (CategoryInclusion) o; + return subcategoryId == that.subcategoryId && + supercategoryId == that.supercategoryId; + } + + @Override + public int hashCode() { + return Objects.hash(subcategoryId, supercategoryId); + } + + @ManyToOne + @JoinColumn(name = "category", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) + public Category getSubcategory() { + return subcategory; + } + + public void setSubcategory(Category subcategory) { + this.subcategory = subcategory; + } + + @ManyToOne + @JoinColumn(name = "supercategory", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) + public Category getSupercategory() { + return supercategory; + } + + public void setSupercategory(Category supercategory) { + this.supercategory = supercategory; + } +} diff --git a/src/main/scala/eu/mulk/entity/CategoryInclusionPK.java b/src/main/scala/eu/mulk/entity/CategoryInclusionPK.java new file mode 100644 index 0000000..6ca2e03 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/CategoryInclusionPK.java @@ -0,0 +1,50 @@ +package eu.mulk.entity; + +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Id; + +public class CategoryInclusionPK implements Serializable { + + private int subcategoryId; + private int supercategoryId; + + @Column(name = "category", nullable = false) + @Id + public int getSubcategoryId() { + return subcategoryId; + } + + public void setSubcategoryId(int subcategoryId) { + this.subcategoryId = subcategoryId; + } + + @Column(name = "supercategory", nullable = false) + @Id + public int getSupercategoryId() { + return supercategoryId; + } + + public void setSupercategoryId(int supercategoryId) { + this.supercategoryId = supercategoryId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryInclusionPK that = (CategoryInclusionPK) o; + return subcategoryId == that.subcategoryId && + supercategoryId == that.supercategoryId; + } + + @Override + public int hashCode() { + return Objects.hash(subcategoryId, supercategoryId); + } +} diff --git a/src/main/scala/eu/mulk/entity/Comment.java b/src/main/scala/eu/mulk/entity/Comment.java new file mode 100644 index 0000000..4a32706 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/Comment.java @@ -0,0 +1,80 @@ +package eu.mulk.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.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@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; + } + + @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); + } + + @OneToMany(mappedBy = "comment") + public Collection<CommentRevision> getRevisions() { + return revisions; + } + + public void setRevisions(Collection<CommentRevision> revisions) { + this.revisions = revisions; + } + + @ManyToOne + @JoinColumn(name = "article", referencedColumnName = "id", nullable = false) + public Article getArticle() { + return article; + } + + public void setArticle(Article article) { + this.article = article; + } +} diff --git a/src/main/scala/eu/mulk/entity/CommentRevision.java b/src/main/scala/eu/mulk/entity/CommentRevision.java new file mode 100644 index 0000000..c5b7bcd --- /dev/null +++ b/src/main/scala/eu/mulk/entity/CommentRevision.java @@ -0,0 +1,160 @@ +package eu.mulk.entity; + +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.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import org.hibernate.annotations.TypeDef; + +@Entity +@Table(name = "comment_revisions", schema = "public", catalog = "mulkcms") +@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; + } + + @Basic + @Column(name = "date", nullable = true) + public Timestamp getDate() { + return 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; + } + + @Basic + @Column(name = "format", nullable = false, length = -1) + public String getFormat() { + return 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; + } + + @Basic + @Column(name = "article_revision", nullable = true) + public Integer getArticleRevision() { + return articleRevision; + } + + public void setArticleRevision(Integer articleRevision) { + this.articleRevision = articleRevision; + } + + @Column(name = "submitter_ip", nullable = true, columnDefinition = "inet") + public Inet getSubmitterIp() { + return 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); + } + + @ManyToOne + @JoinColumn(name = "comment", referencedColumnName = "id", nullable = false) + public Comment getComment() { + return comment; + } + + public void setComment(Comment comment) { + this.comment = comment; + } + + @ManyToOne + @JoinColumn(name = "author", referencedColumnName = "id") + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } +} diff --git a/src/main/scala/eu/mulk/entity/Journal.java b/src/main/scala/eu/mulk/entity/Journal.java new file mode 100644 index 0000000..63447df --- /dev/null +++ b/src/main/scala/eu/mulk/entity/Journal.java @@ -0,0 +1,67 @@ +package eu.mulk.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.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@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; + } + + @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); + } + + @OneToMany(mappedBy = "journal") + public Collection<JournalEntry> getEntries() { + return entries; + } + + public void setEntries(Collection<JournalEntry> entries) { + this.entries = entries; + } +} diff --git a/src/main/scala/eu/mulk/entity/JournalEntry.java b/src/main/scala/eu/mulk/entity/JournalEntry.java new file mode 100644 index 0000000..1c4040e --- /dev/null +++ b/src/main/scala/eu/mulk/entity/JournalEntry.java @@ -0,0 +1,80 @@ +package eu.mulk.entity; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "journal_entries", schema = "public", catalog = "mulkcms") +@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; + } + + @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); + } + + @ManyToOne + @JoinColumn(name = "journal", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) + public Journal getJournal() { + return journal; + } + + public void setJournal(Journal journal) { + this.journal = journal; + } + + @ManyToOne + @JoinColumn(name = "article", referencedColumnName = "id", nullable = false) + public Article getArticle() { + return article; + } + + public void setArticle(Article article) { + this.article = article; + } +} diff --git a/src/main/scala/eu/mulk/entity/JournalEntryPK.java b/src/main/scala/eu/mulk/entity/JournalEntryPK.java new file mode 100644 index 0000000..189d94f --- /dev/null +++ b/src/main/scala/eu/mulk/entity/JournalEntryPK.java @@ -0,0 +1,50 @@ +package eu.mulk.entity; + +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Id; + +public class JournalEntryPK implements Serializable { + + private int journalId; + private int index; + + @Column(name = "journal", nullable = false) + @Id + public int getJournalId() { + return journalId; + } + + public void setJournalId(int journalId) { + this.journalId = journalId; + } + + @Column(name = "index", nullable = false) + @Id + 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; + } + JournalEntryPK that = (JournalEntryPK) o; + return journalId == that.journalId && + index == that.index; + } + + @Override + public int hashCode() { + return Objects.hash(journalId, index); + } +} diff --git a/src/main/scala/eu/mulk/entity/LegacyJournalCategory.java b/src/main/scala/eu/mulk/entity/LegacyJournalCategory.java new file mode 100644 index 0000000..35b0587 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/LegacyJournalCategory.java @@ -0,0 +1,55 @@ +package eu.mulk.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; +import javax.persistence.Table; + +@Entity +@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; + } + + @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); + } +} diff --git a/src/main/scala/eu/mulk/entity/LegacyJournalComment.java b/src/main/scala/eu/mulk/entity/LegacyJournalComment.java new file mode 100644 index 0000000..8e6cc25 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/LegacyJournalComment.java @@ -0,0 +1,165 @@ +package eu.mulk.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; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@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; + } + + @Basic + @Column(name = "uuid", nullable = false, length = 36) + public String getUuid() { + return 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; + } + + @Basic + @Column(name = "body", nullable = false, length = -1) + public String getBody() { + return 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; + } + + @Basic + @Column(name = "email", nullable = true, length = -1) + public String getEmail() { + return 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; + } + + @Basic + @Column(name = "spam_p", nullable = true) + public Boolean getSpamP() { + return spamP; + } + + public void setSpamP(Boolean spamP) { + this.spamP = spamP; + } + + @Basic + @Column(name = "submitter_ip", nullable = false, length = -1) + public String getSubmitterIp() { + return 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); + } + + @ManyToOne + @JoinColumn(name = "entry_id", referencedColumnName = "id", nullable = false) + public LegacyJournalEntry getJournalEntry() { + return journalEntry; + } + + public void setJournalEntry(LegacyJournalEntry journalEntry) { + this.journalEntry = journalEntry; + } +} diff --git a/src/main/scala/eu/mulk/entity/LegacyJournalEntry.java b/src/main/scala/eu/mulk/entity/LegacyJournalEntry.java new file mode 100644 index 0000000..341fdc0 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/LegacyJournalEntry.java @@ -0,0 +1,147 @@ +package eu.mulk.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.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@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; + } + + @Basic + @Column(name = "uuid", nullable = false, length = 36) + public String getUuid() { + return 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; + } + + @Basic + @Column(name = "date", nullable = false) + public long getDate() { + return 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; + } + + @Basic + @Column(name = "body", nullable = false, length = -1) + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = 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); + } + + @OneToMany(mappedBy = "journalEntry") + public Collection<LegacyJournalComment> getComments() { + return comments; + } + + public void setComments(Collection<LegacyJournalComment> comments) { + this.comments = comments; + } + + @OneToMany(mappedBy = "journalEntry") + public Collection<LegacyJournalPingback> getPingbacks() { + return pingbacks; + } + + public void setPingbacks(Collection<LegacyJournalPingback> pingbacks) { + this.pingbacks = pingbacks; + } + + @OneToMany(mappedBy = "journalEntry") + public Collection<LegacyJournalTrackback> getTrackbacks() { + return trackbacks; + } + + public void setTrackbacks(Collection<LegacyJournalTrackback> trackbacks) { + this.trackbacks = trackbacks; + } +} diff --git a/src/main/scala/eu/mulk/entity/LegacyJournalPingback.java b/src/main/scala/eu/mulk/entity/LegacyJournalPingback.java new file mode 100644 index 0000000..430518c --- /dev/null +++ b/src/main/scala/eu/mulk/entity/LegacyJournalPingback.java @@ -0,0 +1,128 @@ +package eu.mulk.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; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@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; + } + + @Basic + @Column(name = "uuid", nullable = false, length = 36) + public String getUuid() { + return 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; + } + + @Basic + @Column(name = "url", nullable = true, length = -1) + public String getUrl() { + return 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; + } + + @Basic + @Column(name = "submitter_ip", nullable = false, length = -1) + public String getSubmitterIp() { + return 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); + } + + @ManyToOne + @JoinColumn(name = "entry_id", referencedColumnName = "id", nullable = false) + public LegacyJournalEntry getJournalEntry() { + return journalEntry; + } + + public void setJournalEntry(LegacyJournalEntry journalEntry) { + this.journalEntry = journalEntry; + } +} diff --git a/src/main/scala/eu/mulk/entity/LegacyJournalTrackback.java b/src/main/scala/eu/mulk/entity/LegacyJournalTrackback.java new file mode 100644 index 0000000..278909f --- /dev/null +++ b/src/main/scala/eu/mulk/entity/LegacyJournalTrackback.java @@ -0,0 +1,166 @@ +package eu.mulk.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; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@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; + } + + @Basic + @Column(name = "uuid", nullable = false, length = 36) + public String getUuid() { + return 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; + } + + @Basic + @Column(name = "excerpt", nullable = false, length = -1) + public String getExcerpt() { + return 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; + } + + @Basic + @Column(name = "blog_name", nullable = true, length = -1) + public String getBlogName() { + return blogName; + } + + public void setBlogName(String blogName) { + this.blogName = blogName; + } + + @Basic + @Column(name = "url", nullable = true, length = -1) + public String getUrl() { + return 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; + } + + @Basic + @Column(name = "submitter_ip", nullable = false, length = -1) + public String getSubmitterIp() { + return 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); + } + + @ManyToOne + @JoinColumn(name = "entry_id", referencedColumnName = "id", nullable = false) + public LegacyJournalEntry getJournalEntry() { + return journalEntry; + } + + public void setJournalEntry(LegacyJournalEntry journalEntry) { + this.journalEntry = journalEntry; + } +} diff --git a/src/main/scala/eu/mulk/entity/LoginCertificate.java b/src/main/scala/eu/mulk/entity/LoginCertificate.java new file mode 100644 index 0000000..556568e --- /dev/null +++ b/src/main/scala/eu/mulk/entity/LoginCertificate.java @@ -0,0 +1,72 @@ +package eu.mulk.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.Id; +import javax.persistence.IdClass; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "login_certificates", schema = "public", catalog = "mulkcms") +@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; + } + + @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; + } + + @ManyToOne + @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } +} diff --git a/src/main/scala/eu/mulk/entity/LoginCertificatePK.java b/src/main/scala/eu/mulk/entity/LoginCertificatePK.java new file mode 100644 index 0000000..b9035f5 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/LoginCertificatePK.java @@ -0,0 +1,53 @@ +package eu.mulk.entity; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Id; + +public class LoginCertificatePK implements Serializable { + + private int userId; + private byte[] certificate; + + @Column(name = "user", nullable = false) + @Id + public int getUserId() { + return userId; + } + + public void setUserId(int userId) { + this.userId = userId; + } + + @Column(name = "certificate", nullable = false) + @Id + 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; + } + LoginCertificatePK that = (LoginCertificatePK) 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; + } +} diff --git a/src/main/scala/eu/mulk/entity/OpenId.java b/src/main/scala/eu/mulk/entity/OpenId.java new file mode 100644 index 0000000..2708640 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/OpenId.java @@ -0,0 +1,69 @@ +package eu.mulk.entity; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "openids", schema = "public", catalog = "mulkcms") +@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; + } + + @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); + } + + @ManyToOne + @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } +} diff --git a/src/main/scala/eu/mulk/entity/OpenIdPK.java b/src/main/scala/eu/mulk/entity/OpenIdPK.java new file mode 100644 index 0000000..776911b --- /dev/null +++ b/src/main/scala/eu/mulk/entity/OpenIdPK.java @@ -0,0 +1,50 @@ +package eu.mulk.entity; + +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Id; + +public class OpenIdPK implements Serializable { + + private int userId; + private String openid; + + @Column(name = "user", nullable = false) + @Id + public int getUserId() { + return userId; + } + + public void setUserId(int userId) { + this.userId = userId; + } + + @Column(name = "openid", nullable = false, length = -1) + @Id + 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; + } + OpenIdPK openIdPK = (OpenIdPK) o; + return userId == openIdPK.userId && + Objects.equals(openid, openIdPK.openid); + } + + @Override + public int hashCode() { + return Objects.hash(userId, openid); + } +} diff --git a/src/main/scala/eu/mulk/entity/Password.java b/src/main/scala/eu/mulk/entity/Password.java new file mode 100644 index 0000000..3e9d302 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/Password.java @@ -0,0 +1,69 @@ +package eu.mulk.entity; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "passwords", schema = "public", catalog = "mulkcms") +@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; + } + + @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); + } + + @ManyToOne + @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } +} diff --git a/src/main/scala/eu/mulk/entity/PasswordPK.java b/src/main/scala/eu/mulk/entity/PasswordPK.java new file mode 100644 index 0000000..72db872 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/PasswordPK.java @@ -0,0 +1,50 @@ +package eu.mulk.entity; + +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Id; + +public class PasswordPK implements Serializable { + + private int userId; + private String password; + + @Column(name = "user", nullable = false) + @Id + public int getUserId() { + return userId; + } + + public void setUserId(int userId) { + this.userId = userId; + } + + @Column(name = "password", nullable = false, length = -1) + @Id + 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; + } + PasswordPK that = (PasswordPK) o; + return userId == that.userId && + Objects.equals(password, that.password); + } + + @Override + public int hashCode() { + return Objects.hash(userId, password); + } +} diff --git a/src/main/scala/eu/mulk/entity/UsedTransactionKey.java b/src/main/scala/eu/mulk/entity/UsedTransactionKey.java new file mode 100644 index 0000000..8e69a4c --- /dev/null +++ b/src/main/scala/eu/mulk/entity/UsedTransactionKey.java @@ -0,0 +1,42 @@ +package eu.mulk.entity; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@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); + } +} diff --git a/src/main/scala/eu/mulk/entity/User.java b/src/main/scala/eu/mulk/entity/User.java new file mode 100644 index 0000000..c4bc27d --- /dev/null +++ b/src/main/scala/eu/mulk/entity/User.java @@ -0,0 +1,163 @@ +package eu.mulk.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.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@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; + } + + @Basic + @Column(name = "name", nullable = true, length = -1) + public String getName() { + return 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; + } + + @Basic + @Column(name = "email", nullable = true, length = -1) + public String getEmail() { + return 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); + } + + @OneToMany(mappedBy = "authors") + public Collection<ArticleRevision> getArticleRevisions() { + return articleRevisions; + } + + public void setArticleRevisions(Collection<ArticleRevision> articleRevisions) { + this.articleRevisions = articleRevisions; + } + + @OneToMany(mappedBy = "user") + public Collection<CommentRevision> getCommentRevisions() { + return commentRevisions; + } + + public void setCommentRevisions(Collection<CommentRevision> commentRevisions) { + this.commentRevisions = commentRevisions; + } + + @OneToMany(mappedBy = "user") + public Collection<LoginCertificate> getLoginCertificates() { + return loginCertificates; + } + + public void setLoginCertificates(Collection<LoginCertificate> loginCertificates) { + this.loginCertificates = loginCertificates; + } + + @OneToMany(mappedBy = "user") + public Collection<OpenId> getOpenids() { + return openids; + } + + public void setOpenids(Collection<OpenId> openids) { + this.openids = openids; + } + + @OneToMany(mappedBy = "user") + public Collection<Password> getPasswords() { + return passwords; + } + + public void setPasswords(Collection<Password> passwords) { + this.passwords = passwords; + } + + @OneToMany(mappedBy = "user") + public Collection<UserPermission> getUserPermissions() { + return userPermissions; + } + + public void setUserPermissions(Collection<UserPermission> userPermissions) { + this.userPermissions = userPermissions; + } + + @OneToMany(mappedBy = "user") + public Collection<UserSetting> getUserSettings() { + return userSettings; + } + + public void setUserSettings(Collection<UserSetting> userSettings) { + this.userSettings = userSettings; + } +} diff --git a/src/main/scala/eu/mulk/entity/UserPermission.java b/src/main/scala/eu/mulk/entity/UserPermission.java new file mode 100644 index 0000000..053d790 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/UserPermission.java @@ -0,0 +1,82 @@ +package eu.mulk.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; +import javax.persistence.IdClass; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "user_permissions", schema = "public", catalog = "mulkcms") +@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; + } + + @Id + @Column(name = "permission", nullable = false, length = -1) + public String getPermission() { + return 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); + } + + @ManyToOne + @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } +} diff --git a/src/main/scala/eu/mulk/entity/UserPermissionPK.java b/src/main/scala/eu/mulk/entity/UserPermissionPK.java new file mode 100644 index 0000000..ae3df66 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/UserPermissionPK.java @@ -0,0 +1,50 @@ +package eu.mulk.entity; + +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Id; + +public class UserPermissionPK implements Serializable { + + private int userId; + private String permission; + + @Column(name = "user", nullable = false) + @Id + public int getUserId() { + return userId; + } + + public void setUserId(int userId) { + this.userId = userId; + } + + @Column(name = "permission", nullable = false, length = -1) + @Id + public String getPermission() { + return permission; + } + + public void setPermission(String permission) { + this.permission = permission; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserPermissionPK that = (UserPermissionPK) o; + return userId == that.userId && + Objects.equals(permission, that.permission); + } + + @Override + public int hashCode() { + return Objects.hash(userId, permission); + } +} diff --git a/src/main/scala/eu/mulk/entity/UserSetting.java b/src/main/scala/eu/mulk/entity/UserSetting.java new file mode 100644 index 0000000..308c13e --- /dev/null +++ b/src/main/scala/eu/mulk/entity/UserSetting.java @@ -0,0 +1,82 @@ +package eu.mulk.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; +import javax.persistence.IdClass; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "user_settings", schema = "public", catalog = "mulkcms") +@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; + } + + @Id + @Column(name = "setting", nullable = false, length = -1) + public String getSetting() { + return 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); + } + + @ManyToOne + @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } +} diff --git a/src/main/scala/eu/mulk/entity/UserSettingPK.java b/src/main/scala/eu/mulk/entity/UserSettingPK.java new file mode 100644 index 0000000..64168c8 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/UserSettingPK.java @@ -0,0 +1,50 @@ +package eu.mulk.entity; + +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Id; + +public class UserSettingPK implements Serializable { + + private int userId; + private String setting; + + @Column(name = "user", nullable = false) + @Id + public int getUserId() { + return userId; + } + + public void setUserId(int userId) { + this.userId = userId; + } + + @Column(name = "setting", nullable = false, length = -1) + @Id + public String getSetting() { + return setting; + } + + public void setSetting(String setting) { + this.setting = setting; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserSettingPK that = (UserSettingPK) o; + return userId == that.userId && + Objects.equals(setting, that.setting); + } + + @Override + public int hashCode() { + return Objects.hash(userId, setting); + } +} |