diff options
Diffstat (limited to 'src/main/java/eu')
35 files changed, 2886 insertions, 0 deletions
diff --git a/src/main/java/eu/mulk/mulkcms2/entity/Article.java b/src/main/java/eu/mulk/mulkcms2/entity/Article.java new file mode 100644 index 0000000..abd6036 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/Article.java @@ -0,0 +1,114 @@ +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; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +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 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); + } + + @OneToMany(mappedBy = "article") + public Collection<ArticleAlias> getAliases() { + return aliases; + } + + public void setAliases(Collection<ArticleAlias> aliases) { + this.aliases = aliases; + } + + @ManyToMany + @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; + } + + @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/java/eu/mulk/mulkcms2/entity/ArticleAlias.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleAlias.java new file mode 100644 index 0000000..a7c4924 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleAlias.java @@ -0,0 +1,55 @@ +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; +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/java/eu/mulk/mulkcms2/entity/ArticleBranchTip.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleBranchTip.java new file mode 100644 index 0000000..c061ed9 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleBranchTip.java @@ -0,0 +1,59 @@ +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; +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/java/eu/mulk/mulkcms2/entity/ArticleBranchTipPK.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleBranchTipPK.java new file mode 100644 index 0000000..2508f87 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleBranchTipPK.java @@ -0,0 +1,31 @@ +package eu.mulk.mulkcms2.entity; + +import java.io.Serializable; +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/java/eu/mulk/mulkcms2/entity/ArticleCommentCount.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleCommentCount.java new file mode 100644 index 0000000..a12cb66 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleCommentCount.java @@ -0,0 +1,56 @@ +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; +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/java/eu/mulk/mulkcms2/entity/ArticlePublishingDate.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticlePublishingDate.java new file mode 100644 index 0000000..d3a8073 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticlePublishingDate.java @@ -0,0 +1,57 @@ +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; +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/java/eu/mulk/mulkcms2/entity/ArticleRevision.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevision.java new file mode 100644 index 0000000..9235c4c --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevision.java @@ -0,0 +1,180 @@ +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.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +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 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; + } + + @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; + } + + @ManyToMany + @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; + } + + @ManyToMany(mappedBy = "children") + public Set<ArticleRevision> getParents() { + return parents; + } + + public void setParents(Set<ArticleRevision> 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/java/eu/mulk/mulkcms2/entity/ArticleRevisionCharacteristic.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevisionCharacteristic.java new file mode 100644 index 0000000..e619c1f --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevisionCharacteristic.java @@ -0,0 +1,83 @@ +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; +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/java/eu/mulk/mulkcms2/entity/ArticleRevisionCharacteristicPK.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevisionCharacteristicPK.java new file mode 100644 index 0000000..2da588e --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevisionCharacteristicPK.java @@ -0,0 +1,27 @@ +package eu.mulk.mulkcms2.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/java/eu/mulk/mulkcms2/entity/ArticleType.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleType.java new file mode 100644 index 0000000..e9b1b84 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleType.java @@ -0,0 +1,79 @@ +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.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/java/eu/mulk/mulkcms2/entity/CachedPage.java b/src/main/java/eu/mulk/mulkcms2/entity/CachedPage.java new file mode 100644 index 0000000..ac8a438 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/CachedPage.java @@ -0,0 +1,82 @@ +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; +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/java/eu/mulk/mulkcms2/entity/CachedPagePK.java b/src/main/java/eu/mulk/mulkcms2/entity/CachedPagePK.java new file mode 100644 index 0000000..d22b3f7 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/CachedPagePK.java @@ -0,0 +1,50 @@ +package eu.mulk.mulkcms2.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/java/eu/mulk/mulkcms2/entity/Category.java b/src/main/java/eu/mulk/mulkcms2/entity/Category.java new file mode 100644 index 0000000..177081c --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/Category.java @@ -0,0 +1,83 @@ +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.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.Table; + +@Entity +@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; + } + + @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); + } + + @ManyToMany + @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; + } + + @ManyToMany(mappedBy = "supercategories") + public Set<Category> getSubcategories() { + return subcategories; + } + + public void setSubcategories(Set<Category> subcategories) { + this.subcategories = subcategories; + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/entity/Comment.java b/src/main/java/eu/mulk/mulkcms2/entity/Comment.java new file mode 100644 index 0000000..502c8b9 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/Comment.java @@ -0,0 +1,80 @@ +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.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/java/eu/mulk/mulkcms2/entity/CommentRevision.java b/src/main/java/eu/mulk/mulkcms2/entity/CommentRevision.java new file mode 100644 index 0000000..a984b35 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/CommentRevision.java @@ -0,0 +1,160 @@ +package eu.mulk.mulkcms2.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/java/eu/mulk/mulkcms2/entity/Journal.java b/src/main/java/eu/mulk/mulkcms2/entity/Journal.java new file mode 100644 index 0000000..471ec46 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/Journal.java @@ -0,0 +1,67 @@ +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.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/java/eu/mulk/mulkcms2/entity/JournalEntry.java b/src/main/java/eu/mulk/mulkcms2/entity/JournalEntry.java new file mode 100644 index 0000000..86ea6ba --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/JournalEntry.java @@ -0,0 +1,80 @@ +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; +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/java/eu/mulk/mulkcms2/entity/JournalEntryPK.java b/src/main/java/eu/mulk/mulkcms2/entity/JournalEntryPK.java new file mode 100644 index 0000000..f867d31 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/JournalEntryPK.java @@ -0,0 +1,50 @@ +package eu.mulk.mulkcms2.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/java/eu/mulk/mulkcms2/entity/LegacyJournalCategory.java b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalCategory.java new file mode 100644 index 0000000..88a5ed4 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalCategory.java @@ -0,0 +1,55 @@ +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; +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/java/eu/mulk/mulkcms2/entity/LegacyJournalComment.java b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalComment.java new file mode 100644 index 0000000..8516b14 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalComment.java @@ -0,0 +1,165 @@ +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; +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/java/eu/mulk/mulkcms2/entity/LegacyJournalEntry.java b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalEntry.java new file mode 100644 index 0000000..6b7e21a --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalEntry.java @@ -0,0 +1,147 @@ +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.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/java/eu/mulk/mulkcms2/entity/LegacyJournalPingback.java b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalPingback.java new file mode 100644 index 0000000..ef35dec --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalPingback.java @@ -0,0 +1,128 @@ +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; +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/java/eu/mulk/mulkcms2/entity/LegacyJournalTrackback.java b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalTrackback.java new file mode 100644 index 0000000..6c46bf0 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalTrackback.java @@ -0,0 +1,166 @@ +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; +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/java/eu/mulk/mulkcms2/entity/LoginCertificate.java b/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificate.java new file mode 100644 index 0000000..61b7185 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificate.java @@ -0,0 +1,72 @@ +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.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/java/eu/mulk/mulkcms2/entity/LoginCertificatePK.java b/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificatePK.java new file mode 100644 index 0000000..bb74971 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificatePK.java @@ -0,0 +1,53 @@ +package eu.mulk.mulkcms2.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/java/eu/mulk/mulkcms2/entity/OpenId.java b/src/main/java/eu/mulk/mulkcms2/entity/OpenId.java new file mode 100644 index 0000000..6060712 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/OpenId.java @@ -0,0 +1,69 @@ +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; +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/java/eu/mulk/mulkcms2/entity/OpenIdPK.java b/src/main/java/eu/mulk/mulkcms2/entity/OpenIdPK.java new file mode 100644 index 0000000..22b72c0 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/OpenIdPK.java @@ -0,0 +1,50 @@ +package eu.mulk.mulkcms2.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/java/eu/mulk/mulkcms2/entity/Password.java b/src/main/java/eu/mulk/mulkcms2/entity/Password.java new file mode 100644 index 0000000..7a785b0 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/Password.java @@ -0,0 +1,69 @@ +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; +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/java/eu/mulk/mulkcms2/entity/PasswordPK.java b/src/main/java/eu/mulk/mulkcms2/entity/PasswordPK.java new file mode 100644 index 0000000..3c7c0bb --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/PasswordPK.java @@ -0,0 +1,50 @@ +package eu.mulk.mulkcms2.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/java/eu/mulk/mulkcms2/entity/UsedTransactionKey.java b/src/main/java/eu/mulk/mulkcms2/entity/UsedTransactionKey.java new file mode 100644 index 0000000..7d562a6 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/UsedTransactionKey.java @@ -0,0 +1,42 @@ +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; +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/java/eu/mulk/mulkcms2/entity/User.java b/src/main/java/eu/mulk/mulkcms2/entity/User.java new file mode 100644 index 0000000..1c9e425 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/User.java @@ -0,0 +1,163 @@ +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.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/java/eu/mulk/mulkcms2/entity/UserPermission.java b/src/main/java/eu/mulk/mulkcms2/entity/UserPermission.java new file mode 100644 index 0000000..cde34e6 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/UserPermission.java @@ -0,0 +1,82 @@ +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; +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/java/eu/mulk/mulkcms2/entity/UserPermissionPK.java b/src/main/java/eu/mulk/mulkcms2/entity/UserPermissionPK.java new file mode 100644 index 0000000..085aae2 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/UserPermissionPK.java @@ -0,0 +1,50 @@ +package eu.mulk.mulkcms2.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/java/eu/mulk/mulkcms2/entity/UserSetting.java b/src/main/java/eu/mulk/mulkcms2/entity/UserSetting.java new file mode 100644 index 0000000..5459562 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/UserSetting.java @@ -0,0 +1,82 @@ +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; +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/java/eu/mulk/mulkcms2/entity/UserSettingPK.java b/src/main/java/eu/mulk/mulkcms2/entity/UserSettingPK.java new file mode 100644 index 0000000..3b77247 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/entity/UserSettingPK.java @@ -0,0 +1,50 @@ +package eu.mulk.mulkcms2.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); + } +} |