From d9b9588f03ec77d05e5651a88d672184c8b351a5 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Fri, 24 Jan 2020 11:42:49 +0100 Subject: Benki: Sort into a sane folder structure, fix mapping bugs. Change-Id: I55f5c0349dc580a24506648284ce6483dd952d8a --- src/main/java/eu/mulk/mulkcms2/benki/Bookmark.java | 39 --- .../java/eu/mulk/mulkcms2/benki/BookmarkTag.java | 28 --- .../java/eu/mulk/mulkcms2/benki/BookmarkTagPK.java | 59 ----- .../mulk/mulkcms2/benki/EffectiveRoleSubrole.java | 17 -- .../eu/mulk/mulkcms2/benki/EffectiveUserRole.java | 17 -- .../eu/mulk/mulkcms2/benki/LazychatMessage.java | 36 --- .../eu/mulk/mulkcms2/benki/LazychatReference.java | 32 --- .../mulk/mulkcms2/benki/LazychatReferencePK.java | 59 ----- src/main/java/eu/mulk/mulkcms2/benki/Openids.java | 20 -- src/main/java/eu/mulk/mulkcms2/benki/PageKey.java | 29 --- .../java/eu/mulk/mulkcms2/benki/PageKeyPK.java | 60 ----- src/main/java/eu/mulk/mulkcms2/benki/Post.java | 25 -- .../java/eu/mulk/mulkcms2/benki/PostTarget.java | 28 --- .../java/eu/mulk/mulkcms2/benki/PostTargetPK.java | 59 ----- src/main/java/eu/mulk/mulkcms2/benki/Role.java | 39 --- .../java/eu/mulk/mulkcms2/benki/RoleSubrole.java | 32 --- .../java/eu/mulk/mulkcms2/benki/RoleSubrolePK.java | 59 ----- src/main/java/eu/mulk/mulkcms2/benki/RoleTag.java | 22 -- .../java/eu/mulk/mulkcms2/benki/RoleTagPK.java | 59 ----- src/main/java/eu/mulk/mulkcms2/benki/RsaKey.java | 28 --- src/main/java/eu/mulk/mulkcms2/benki/RsaKeyPK.java | 60 ----- src/main/java/eu/mulk/mulkcms2/benki/User.java | 277 --------------------- .../eu/mulk/mulkcms2/benki/UserDefaultTarget.java | 32 --- .../mulk/mulkcms2/benki/UserDefaultTargetPK.java | 59 ----- .../eu/mulk/mulkcms2/benki/UserEmailAddress.java | 22 -- src/main/java/eu/mulk/mulkcms2/benki/UserJid.java | 28 --- .../java/eu/mulk/mulkcms2/benki/UserJidPK.java | 59 ----- .../java/eu/mulk/mulkcms2/benki/UserNickname.java | 22 -- src/main/java/eu/mulk/mulkcms2/benki/UserRole.java | 32 --- .../java/eu/mulk/mulkcms2/benki/UserRolePK.java | 59 ----- .../java/eu/mulk/mulkcms2/benki/UserRsaKey.java | 41 --- .../java/eu/mulk/mulkcms2/benki/UserRsaKeyPK.java | 75 ------ .../mulk/mulkcms2/benki/UserVisibleBookmark.java | 17 -- .../mulkcms2/benki/UserVisibleLazychatMessage.java | 17 -- .../eu/mulk/mulkcms2/benki/UserVisiblePost.java | 17 -- src/main/java/eu/mulk/mulkcms2/benki/WebId.java | 22 -- src/main/java/eu/mulk/mulkcms2/benki/WikiPage.java | 21 -- .../eu/mulk/mulkcms2/benki/WikiPageRevision.java | 38 --- .../benki/accesscontrol/EffectiveRoleSubrole.java | 42 ++++ .../benki/accesscontrol/EffectiveUserRole.java | 41 +++ .../mulk/mulkcms2/benki/accesscontrol/PageKey.java | 30 +++ .../mulkcms2/benki/accesscontrol/PageKeyPK.java | 60 +++++ .../eu/mulk/mulkcms2/benki/accesscontrol/Role.java | 43 ++++ .../mulkcms2/benki/accesscontrol/RoleSubrole.java | 32 +++ .../benki/accesscontrol/RoleSubrolePK.java | 59 +++++ .../mulk/mulkcms2/benki/accesscontrol/RoleTag.java | 22 ++ .../mulkcms2/benki/accesscontrol/RoleTagPK.java | 59 +++++ .../eu/mulk/mulkcms2/benki/bookmarx/Bookmark.java | 25 ++ .../mulk/mulkcms2/benki/bookmarx/BookmarkTag.java | 28 +++ .../mulkcms2/benki/bookmarx/BookmarkTagPK.java | 59 +++++ .../benki/bookmarx/UserVisibleBookmark.java | 41 +++ .../java/eu/mulk/mulkcms2/benki/generic/Post.java | 30 +++ .../eu/mulk/mulkcms2/benki/generic/PostTarget.java | 29 +++ .../mulk/mulkcms2/benki/generic/PostTargetPK.java | 59 +++++ .../mulkcms2/benki/generic/UserVisiblePost.java | 41 +++ .../mulkcms2/benki/lafargue/LazychatMessage.java | 22 ++ .../mulkcms2/benki/lafargue/LazychatReference.java | 32 +++ .../benki/lafargue/LazychatReferencePK.java | 59 +++++ .../benki/lafargue/UserVisibleLazychatMessage.java | 41 +++ .../java/eu/mulk/mulkcms2/benki/users/Openids.java | 20 ++ .../java/eu/mulk/mulkcms2/benki/users/RsaKey.java | 28 +++ .../eu/mulk/mulkcms2/benki/users/RsaKeyPK.java | 60 +++++ .../java/eu/mulk/mulkcms2/benki/users/User.java | 87 +++++++ .../mulkcms2/benki/users/UserDefaultTarget.java | 33 +++ .../mulkcms2/benki/users/UserDefaultTargetPK.java | 59 +++++ .../mulkcms2/benki/users/UserEmailAddress.java | 22 ++ .../java/eu/mulk/mulkcms2/benki/users/UserJid.java | 28 +++ .../eu/mulk/mulkcms2/benki/users/UserJidPK.java | 59 +++++ .../eu/mulk/mulkcms2/benki/users/UserNickname.java | 22 ++ .../eu/mulk/mulkcms2/benki/users/UserRole.java | 33 +++ .../eu/mulk/mulkcms2/benki/users/UserRolePK.java | 59 +++++ .../eu/mulk/mulkcms2/benki/users/UserRsaKey.java | 51 ++++ .../eu/mulk/mulkcms2/benki/users/UserRsaKeyPK.java | 75 ++++++ .../java/eu/mulk/mulkcms2/benki/users/WebId.java | 22 ++ .../java/eu/mulk/mulkcms2/benki/wiki/WikiPage.java | 21 ++ .../mulk/mulkcms2/benki/wiki/WikiPageRevision.java | 40 +++ src/main/java/eu/mulk/mulkcms2/cms/users/User.java | 2 +- 77 files changed, 1574 insertions(+), 1646 deletions(-) delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/Bookmark.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/BookmarkTag.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/BookmarkTagPK.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/EffectiveRoleSubrole.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/EffectiveUserRole.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/LazychatMessage.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/LazychatReference.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/LazychatReferencePK.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/Openids.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/PageKey.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/PageKeyPK.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/Post.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/PostTarget.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/PostTargetPK.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/Role.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/RoleSubrole.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/RoleSubrolePK.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/RoleTag.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/RoleTagPK.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/RsaKey.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/RsaKeyPK.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/User.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/UserDefaultTarget.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/UserDefaultTargetPK.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/UserEmailAddress.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/UserJid.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/UserJidPK.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/UserNickname.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/UserRole.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/UserRolePK.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/UserRsaKey.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/UserRsaKeyPK.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/UserVisibleBookmark.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/UserVisibleLazychatMessage.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/UserVisiblePost.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/WebId.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/WikiPage.java delete mode 100644 src/main/java/eu/mulk/mulkcms2/benki/WikiPageRevision.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/EffectiveRoleSubrole.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/EffectiveUserRole.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKey.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKeyPK.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/Role.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrole.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrolePK.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleTag.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleTagPK.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/bookmarx/Bookmark.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTag.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTagPK.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/bookmarx/UserVisibleBookmark.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/generic/Post.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/generic/PostTarget.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/generic/PostTargetPK.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/generic/UserVisiblePost.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatMessage.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReference.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReferencePK.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/lafargue/UserVisibleLazychatMessage.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/Openids.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/RsaKey.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/RsaKeyPK.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/User.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTarget.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTargetPK.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/UserEmailAddress.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/UserJid.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/UserJidPK.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/UserNickname.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/UserRole.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/UserRolePK.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKey.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKeyPK.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/users/WebId.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPage.java create mode 100644 src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPageRevision.java (limited to 'src/main/java/eu') diff --git a/src/main/java/eu/mulk/mulkcms2/benki/Bookmark.java b/src/main/java/eu/mulk/mulkcms2/benki/Bookmark.java deleted file mode 100644 index 220ebfa..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/Bookmark.java +++ /dev/null @@ -1,39 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Collection; -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 = "bookmarks", schema = "public", catalog = "benki") -public class Bookmark extends PanacheEntityBase { - - @Id - @Column(name = "id", nullable = false) - public int id; - - @Column(name = "date", nullable = true) - public Object date; - - @Column(name = "uri", nullable = false, length = -1) - public String uri; - - @Column(name = "title", nullable = true, length = -1) - public String title; - - @Column(name = "description", nullable = true, length = -1) - public String description; - - @OneToMany(mappedBy = "bookmark") - public Collection tags; - - @ManyToOne - @JoinColumn(name = "owner", referencedColumnName = "id") - public User owner; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/BookmarkTag.java b/src/main/java/eu/mulk/mulkcms2/benki/BookmarkTag.java deleted file mode 100644 index 6efa87e..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/BookmarkTag.java +++ /dev/null @@ -1,28 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -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 = "bookmark_tags", schema = "public", catalog = "benki") -@IdClass(BookmarkTagPK.class) -public class BookmarkTag extends PanacheEntityBase { - - @Id - @Column(name = "bookmark", nullable = false) - public int bookmarkId; - - @Id - @Column(name = "tag", nullable = false, length = -1) - public String tag; - - @ManyToOne - @JoinColumn(name = "bookmark", referencedColumnName = "id", nullable = false) - public Bookmark bookmark; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/BookmarkTagPK.java b/src/main/java/eu/mulk/mulkcms2/benki/BookmarkTagPK.java deleted file mode 100644 index 89e7fb9..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/BookmarkTagPK.java +++ /dev/null @@ -1,59 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import java.io.Serializable; -import javax.persistence.Column; -import javax.persistence.Id; - -public class BookmarkTagPK implements Serializable { - - private int bookmarkId; - private String tag; - - @Column(name = "bookmark", nullable = false) - @Id - public int getBookmarkId() { - return bookmarkId; - } - - public void setBookmarkId(int bookmarkId) { - this.bookmarkId = bookmarkId; - } - - @Column(name = "tag", nullable = false, length = -1) - @Id - public String getTag() { - return tag; - } - - public void setTag(String tag) { - this.tag = tag; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - BookmarkTagPK that = (BookmarkTagPK) o; - - if (bookmarkId != that.bookmarkId) { - return false; - } - if (tag != null ? !tag.equals(that.tag) : that.tag != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = bookmarkId; - result = 31 * result + (tag != null ? tag.hashCode() : 0); - return result; - } -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/EffectiveRoleSubrole.java b/src/main/java/eu/mulk/mulkcms2/benki/EffectiveRoleSubrole.java deleted file mode 100644 index adc2a50..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/EffectiveRoleSubrole.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Table; - -@Entity -@Table(name = "effective_role_subroles", schema = "public", catalog = "benki") -public class EffectiveRoleSubrole extends PanacheEntityBase { - - @Column(name = "superrole", nullable = true) - public Integer superroleId; - - @Column(name = "subrole", nullable = true) - public Integer subroleId; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/EffectiveUserRole.java b/src/main/java/eu/mulk/mulkcms2/benki/EffectiveUserRole.java deleted file mode 100644 index fc2e453..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/EffectiveUserRole.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Table; - -@Entity -@Table(name = "effective_user_roles", schema = "public", catalog = "benki") -public class EffectiveUserRole extends PanacheEntityBase { - - @Column(name = "user", nullable = true) - public Integer userId; - - @Column(name = "role", nullable = true) - public Integer roleId; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/LazychatMessage.java b/src/main/java/eu/mulk/mulkcms2/benki/LazychatMessage.java deleted file mode 100644 index 43363d2..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/LazychatMessage.java +++ /dev/null @@ -1,36 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Collection; -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 = "lazychat_messages", schema = "public", catalog = "benki") -public class LazychatMessage extends PanacheEntityBase { - - @Id - @Column(name = "id", nullable = false) - public int id; - - @Column(name = "date", nullable = true) - public Object date; - - @Column(name = "content", nullable = true, length = -1) - public String content; - - @Column(name = "format", nullable = false, length = -1) - public String format; - - @ManyToOne - @JoinColumn(name = "owner", referencedColumnName = "id") - public User owner; - - @OneToMany(mappedBy = "referrer") - public Collection references; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/LazychatReference.java b/src/main/java/eu/mulk/mulkcms2/benki/LazychatReference.java deleted file mode 100644 index 19803ba..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/LazychatReference.java +++ /dev/null @@ -1,32 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -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 = "lazychat_references", schema = "public", catalog = "benki") -@IdClass(LazychatReferencePK.class) -public class LazychatReference extends PanacheEntityBase { - - @Id - @Column(name = "referrer", nullable = false) - public int referrerId; - - @Id - @Column(name = "referee", nullable = false) - public int refereeId; - - @ManyToOne - @JoinColumn(name = "referrer", referencedColumnName = "id", nullable = false) - public LazychatMessage referrer; - - @ManyToOne - @JoinColumn(name = "referee", referencedColumnName = "id", nullable = false) - public LazychatMessage referee; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/LazychatReferencePK.java b/src/main/java/eu/mulk/mulkcms2/benki/LazychatReferencePK.java deleted file mode 100644 index c7eefc0..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/LazychatReferencePK.java +++ /dev/null @@ -1,59 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import java.io.Serializable; -import javax.persistence.Column; -import javax.persistence.Id; - -public class LazychatReferencePK implements Serializable { - - private int referrerId; - private int refereeId; - - @Column(name = "referrer", nullable = false) - @Id - public int getReferrerId() { - return referrerId; - } - - public void setReferrerId(int referrerId) { - this.referrerId = referrerId; - } - - @Column(name = "referee", nullable = false) - @Id - public int getRefereeId() { - return refereeId; - } - - public void setRefereeId(int refereeId) { - this.refereeId = refereeId; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - LazychatReferencePK that = (LazychatReferencePK) o; - - if (referrerId != that.referrerId) { - return false; - } - if (refereeId != that.refereeId) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = referrerId; - result = 31 * result + refereeId; - return result; - } -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/Openids.java b/src/main/java/eu/mulk/mulkcms2/benki/Openids.java deleted file mode 100644 index d0551e4..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/Openids.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; - -@Entity -public class Openids extends PanacheEntityBase { - - @Id - @Column(name = "openid", nullable = false, length = -1) - public String openid; - - @ManyToOne - @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User user; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/PageKey.java b/src/main/java/eu/mulk/mulkcms2/benki/PageKey.java deleted file mode 100644 index 26c1d57..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/PageKey.java +++ /dev/null @@ -1,29 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.math.BigInteger; -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 = "page_keys", schema = "public", catalog = "benki") -@IdClass(PageKeyPK.class) -public class PageKey extends PanacheEntityBase { - - @Id - @Column(name = "page", nullable = false, length = -1) - public String page; - - @Id - @Column(name = "key", nullable = false, precision = 0) - public BigInteger key; - - @ManyToOne - @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User user; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/PageKeyPK.java b/src/main/java/eu/mulk/mulkcms2/benki/PageKeyPK.java deleted file mode 100644 index dea94ed..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/PageKeyPK.java +++ /dev/null @@ -1,60 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import java.io.Serializable; -import java.math.BigInteger; -import javax.persistence.Column; -import javax.persistence.Id; - -public class PageKeyPK implements Serializable { - - private String page; - private BigInteger key; - - @Column(name = "page", nullable = false, length = -1) - @Id - public String getPage() { - return page; - } - - public void setPage(String page) { - this.page = page; - } - - @Column(name = "key", nullable = false, precision = 0) - @Id - public BigInteger getKey() { - return key; - } - - public void setKey(BigInteger key) { - this.key = key; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - PageKeyPK pageKeyPK = (PageKeyPK) o; - - if (page != null ? !page.equals(pageKeyPK.page) : pageKeyPK.page != null) { - return false; - } - if (key != null ? !key.equals(pageKeyPK.key) : pageKeyPK.key != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = page != null ? page.hashCode() : 0; - result = 31 * result + (key != null ? key.hashCode() : 0); - return result; - } -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/Post.java b/src/main/java/eu/mulk/mulkcms2/benki/Post.java deleted file mode 100644 index 2fc6b05..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/Post.java +++ /dev/null @@ -1,25 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -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 = "posts", schema = "public", catalog = "benki") -public class Post extends PanacheEntityBase { - - @Id - @Column(name = "id", nullable = false) - public int id; - - @Column(name = "date", nullable = true) - public Object date; - - @ManyToOne - @JoinColumn(name = "owner", referencedColumnName = "id") - public User owner; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/PostTarget.java b/src/main/java/eu/mulk/mulkcms2/benki/PostTarget.java deleted file mode 100644 index d785d78..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/PostTarget.java +++ /dev/null @@ -1,28 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -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 = "post_targets", schema = "public", catalog = "benki") -@IdClass(PostTargetPK.class) -public class PostTarget extends PanacheEntityBase { - - @Id - @Column(name = "message", nullable = false) - public int message; - - @Id - @Column(name = "target", nullable = false) - public int targetId; - - @ManyToOne - @JoinColumn(name = "target", referencedColumnName = "id", nullable = false) - public Role target; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/PostTargetPK.java b/src/main/java/eu/mulk/mulkcms2/benki/PostTargetPK.java deleted file mode 100644 index 0189837..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/PostTargetPK.java +++ /dev/null @@ -1,59 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import java.io.Serializable; -import javax.persistence.Column; -import javax.persistence.Id; - -public class PostTargetPK implements Serializable { - - private int message; - private int targetId; - - @Column(name = "message", nullable = false) - @Id - public int getMessage() { - return message; - } - - public void setMessage(int message) { - this.message = message; - } - - @Column(name = "target", nullable = false) - @Id - public int getTargetId() { - return targetId; - } - - public void setTargetId(int targetId) { - this.targetId = targetId; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - PostTargetPK that = (PostTargetPK) o; - - if (message != that.message) { - return false; - } - if (targetId != that.targetId) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = message; - result = 31 * result + targetId; - return result; - } -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/Role.java b/src/main/java/eu/mulk/mulkcms2/benki/Role.java deleted file mode 100644 index 48bd042..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/Role.java +++ /dev/null @@ -1,39 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Collection; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.OneToMany; -import javax.persistence.Table; - -@Entity -@Table(name = "roles", schema = "public", catalog = "benki") -public class Role extends PanacheEntityBase { - - @Id - @Column(name = "id", nullable = false) - public int id; - - @Column(name = "name", nullable = true, length = -1) - public String name; - - @OneToMany(mappedBy = "target") - public Collection targetedPosts; - - @OneToMany(mappedBy = "superrole") - public Collection subroles; - - @OneToMany(mappedBy = "subrole") - public Collection superroles; - - @OneToMany(mappedBy = "target") - public Collection usersUsedByAsDefaultTarget; - - @OneToMany(mappedBy = "role") - public Collection users; - - @OneToMany(mappedBy = "ownedRole") - public Collection owningUsers; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/RoleSubrole.java b/src/main/java/eu/mulk/mulkcms2/benki/RoleSubrole.java deleted file mode 100644 index 0be5493..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/RoleSubrole.java +++ /dev/null @@ -1,32 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -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 = "role_subroles", schema = "public", catalog = "benki") -@IdClass(RoleSubrolePK.class) -public class RoleSubrole extends PanacheEntityBase { - - @Id - @Column(name = "superrole", nullable = false) - public int superroleId; - - @Id - @Column(name = "subrole", nullable = false) - public int subroleId; - - @ManyToOne - @JoinColumn(name = "superrole", referencedColumnName = "id", nullable = false) - public Role superrole; - - @ManyToOne - @JoinColumn(name = "subrole", referencedColumnName = "id", nullable = false) - public Role subrole; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/RoleSubrolePK.java b/src/main/java/eu/mulk/mulkcms2/benki/RoleSubrolePK.java deleted file mode 100644 index cf36115..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/RoleSubrolePK.java +++ /dev/null @@ -1,59 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import java.io.Serializable; -import javax.persistence.Column; -import javax.persistence.Id; - -public class RoleSubrolePK implements Serializable { - - private int superroleId; - private int subroleId; - - @Column(name = "superrole", nullable = false) - @Id - public int getSuperroleId() { - return superroleId; - } - - public void setSuperroleId(int superroleId) { - this.superroleId = superroleId; - } - - @Column(name = "subrole", nullable = false) - @Id - public int getSubroleId() { - return subroleId; - } - - public void setSubroleId(int subroleId) { - this.subroleId = subroleId; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - RoleSubrolePK that = (RoleSubrolePK) o; - - if (superroleId != that.superroleId) { - return false; - } - if (subroleId != that.subroleId) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = superroleId; - result = 31 * result + subroleId; - return result; - } -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/RoleTag.java b/src/main/java/eu/mulk/mulkcms2/benki/RoleTag.java deleted file mode 100644 index 9bc72c4..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/RoleTag.java +++ /dev/null @@ -1,22 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.IdClass; -import javax.persistence.Table; - -@Entity -@Table(name = "role_tags", schema = "public", catalog = "benki") -@IdClass(RoleTagPK.class) -public class RoleTag extends PanacheEntityBase { - - @Id - @Column(name = "role", nullable = false) - public int roleId; - - @Id - @Column(name = "tag", nullable = false, length = -1) - public String tag; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/RoleTagPK.java b/src/main/java/eu/mulk/mulkcms2/benki/RoleTagPK.java deleted file mode 100644 index e406e10..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/RoleTagPK.java +++ /dev/null @@ -1,59 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import java.io.Serializable; -import javax.persistence.Column; -import javax.persistence.Id; - -public class RoleTagPK implements Serializable { - - private int roleId; - private String tag; - - @Column(name = "role", nullable = false) - @Id - public int getRoleId() { - return roleId; - } - - public void setRoleId(int roleId) { - this.roleId = roleId; - } - - @Column(name = "tag", nullable = false, length = -1) - @Id - public String getTag() { - return tag; - } - - public void setTag(String tag) { - this.tag = tag; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - RoleTagPK roleTagPK = (RoleTagPK) o; - - if (roleId != roleTagPK.roleId) { - return false; - } - if (tag != null ? !tag.equals(roleTagPK.tag) : roleTagPK.tag != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = roleId; - result = 31 * result + (tag != null ? tag.hashCode() : 0); - return result; - } -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/RsaKey.java b/src/main/java/eu/mulk/mulkcms2/benki/RsaKey.java deleted file mode 100644 index d3da90e..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/RsaKey.java +++ /dev/null @@ -1,28 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.math.BigInteger; -import java.util.Collection; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.IdClass; -import javax.persistence.OneToMany; -import javax.persistence.Table; - -@Entity -@Table(name = "rsa_keys", schema = "public", catalog = "benki") -@IdClass(RsaKeyPK.class) -public class RsaKey extends PanacheEntityBase { - - @Id - @Column(name = "modulus", nullable = false, precision = 0) - public BigInteger modulus; - - @Id - @Column(name = "exponent", nullable = false, precision = 0) - public BigInteger exponent; - - @OneToMany(mappedBy = "rsaKey") - public Collection users; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/RsaKeyPK.java b/src/main/java/eu/mulk/mulkcms2/benki/RsaKeyPK.java deleted file mode 100644 index 41a332d..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/RsaKeyPK.java +++ /dev/null @@ -1,60 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import java.io.Serializable; -import java.math.BigInteger; -import javax.persistence.Column; -import javax.persistence.Id; - -public class RsaKeyPK implements Serializable { - - private BigInteger modulus; - private BigInteger exponent; - - @Column(name = "modulus", nullable = false, precision = 0) - @Id - public BigInteger getModulus() { - return modulus; - } - - public void setModulus(BigInteger modulus) { - this.modulus = modulus; - } - - @Column(name = "exponent", nullable = false, precision = 0) - @Id - public BigInteger getExponent() { - return exponent; - } - - public void setExponent(BigInteger exponent) { - this.exponent = exponent; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - RsaKeyPK rsaKeyPK = (RsaKeyPK) o; - - if (modulus != null ? !modulus.equals(rsaKeyPK.modulus) : rsaKeyPK.modulus != null) { - return false; - } - if (exponent != null ? !exponent.equals(rsaKeyPK.exponent) : rsaKeyPK.exponent != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = modulus != null ? modulus.hashCode() : 0; - result = 31 * result + (exponent != null ? exponent.hashCode() : 0); - return result; - } -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/User.java b/src/main/java/eu/mulk/mulkcms2/benki/User.java deleted file mode 100644 index cabd91f..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/User.java +++ /dev/null @@ -1,277 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Collection; -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 = "users", schema = "public", catalog = "benki") -public class User extends PanacheEntityBase { - - public int id; - public String firstName; - public String middleNames; - public String lastName; - public String email; - public String website; - public String status; - public Collection bookmarks; - public Collection lazychatMessages; - public Collection openids; - public Collection pageKeys; - public Collection posts; - public Collection defaultTargets; - public Collection emailAddresses; - public Collection jids; - public Collection nicknames; - public Collection roles; - public Collection rsaKeys; - public Role ownedRole; - public Collection webids; - public Collection wikiPageRevisions; - - @Id - @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - @Column(name = "first_name", nullable = true, length = -1) - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - @Column(name = "middle_names", nullable = true, length = -1) - public String getMiddleNames() { - return middleNames; - } - - public void setMiddleNames(String middleNames) { - this.middleNames = middleNames; - } - - @Column(name = "last_name", nullable = true, length = -1) - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - @Column(name = "email", nullable = true, length = -1) - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - @Column(name = "website", nullable = true, length = -1) - public String getWebsite() { - return website; - } - - public void setWebsite(String website) { - this.website = website; - } - - @Column(name = "status", nullable = true, length = -1) - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - User user = (User) o; - - if (id != user.id) { - return false; - } - if (firstName != null ? !firstName.equals(user.firstName) : user.firstName != null) { - return false; - } - if (middleNames != null ? !middleNames.equals(user.middleNames) : user.middleNames != null) { - return false; - } - if (lastName != null ? !lastName.equals(user.lastName) : user.lastName != null) { - return false; - } - if (email != null ? !email.equals(user.email) : user.email != null) { - return false; - } - if (website != null ? !website.equals(user.website) : user.website != null) { - return false; - } - if (status != null ? !status.equals(user.status) : user.status != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + (firstName != null ? firstName.hashCode() : 0); - result = 31 * result + (middleNames != null ? middleNames.hashCode() : 0); - result = 31 * result + (lastName != null ? lastName.hashCode() : 0); - result = 31 * result + (email != null ? email.hashCode() : 0); - result = 31 * result + (website != null ? website.hashCode() : 0); - result = 31 * result + (status != null ? status.hashCode() : 0); - return result; - } - - @OneToMany(mappedBy = "owner") - public Collection getBookmarks() { - return bookmarks; - } - - public void setBookmarks(Collection bookmarks) { - this.bookmarks = bookmarks; - } - - @OneToMany(mappedBy = "owner") - public Collection getLazychatMessages() { - return lazychatMessages; - } - - public void setLazychatMessages(Collection lazychatMessages) { - this.lazychatMessages = lazychatMessages; - } - - @OneToMany(mappedBy = "user") - public Collection getOpenids() { - return openids; - } - - public void setOpenids(Collection openids) { - this.openids = openids; - } - - @OneToMany(mappedBy = "user") - public Collection getPageKeys() { - return pageKeys; - } - - public void setPageKeys(Collection pageKeys) { - this.pageKeys = pageKeys; - } - - @OneToMany(mappedBy = "owner") - public Collection getPosts() { - return posts; - } - - public void setPosts(Collection posts) { - this.posts = posts; - } - - @OneToMany(mappedBy = "user") - public Collection getDefaultTargets() { - return defaultTargets; - } - - public void setDefaultTargets(Collection defaultTargets) { - this.defaultTargets = defaultTargets; - } - - @OneToMany(mappedBy = "user") - public Collection getEmailAddresses() { - return emailAddresses; - } - - public void setEmailAddresses(Collection emailAddresses) { - this.emailAddresses = emailAddresses; - } - - @OneToMany(mappedBy = "user") - public Collection getJids() { - return jids; - } - - public void setJids(Collection jids) { - this.jids = jids; - } - - @OneToMany(mappedBy = "user") - public Collection getNicknames() { - return nicknames; - } - - public void setNicknames(Collection nicknames) { - this.nicknames = nicknames; - } - - @OneToMany(mappedBy = "user") - public Collection getRoles() { - return roles; - } - - public void setRoles(Collection roles) { - this.roles = roles; - } - - @OneToMany(mappedBy = "user") - public Collection getRsaKeys() { - return rsaKeys; - } - - public void setRsaKeys(Collection rsaKeys) { - this.rsaKeys = rsaKeys; - } - - @ManyToOne - @JoinColumn(name = "role", referencedColumnName = "id", nullable = false) - public Role getOwnedRole() { - return ownedRole; - } - - public void setOwnedRole(Role ownedRole) { - this.ownedRole = ownedRole; - } - - @OneToMany(mappedBy = "user") - public Collection getWebids() { - return webids; - } - - public void setWebids(Collection webids) { - this.webids = webids; - } - - @OneToMany(mappedBy = "author") - public Collection getWikiPageRevisions() { - return wikiPageRevisions; - } - - public void setWikiPageRevisions(Collection wikiPageRevisions) { - this.wikiPageRevisions = wikiPageRevisions; - } -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserDefaultTarget.java b/src/main/java/eu/mulk/mulkcms2/benki/UserDefaultTarget.java deleted file mode 100644 index 4989023..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserDefaultTarget.java +++ /dev/null @@ -1,32 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -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_default_target", schema = "public", catalog = "benki") -@IdClass(UserDefaultTargetPK.class) -public class UserDefaultTarget extends PanacheEntityBase { - - @Id - @Column(name = "user", nullable = false) - public int userId; - - @Id - @Column(name = "target", nullable = false) - public int targetId; - - @ManyToOne - @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User user; - - @ManyToOne - @JoinColumn(name = "target", referencedColumnName = "id", nullable = false) - public Role target; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserDefaultTargetPK.java b/src/main/java/eu/mulk/mulkcms2/benki/UserDefaultTargetPK.java deleted file mode 100644 index e7e080f..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserDefaultTargetPK.java +++ /dev/null @@ -1,59 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import java.io.Serializable; -import javax.persistence.Column; -import javax.persistence.Id; - -public class UserDefaultTargetPK implements Serializable { - - private int userId; - private int targetId; - - @Column(name = "user", nullable = false) - @Id - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } - - @Column(name = "target", nullable = false) - @Id - public int getTargetId() { - return targetId; - } - - public void setTargetId(int targetId) { - this.targetId = targetId; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - UserDefaultTargetPK that = (UserDefaultTargetPK) o; - - if (userId != that.userId) { - return false; - } - if (targetId != that.targetId) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = userId; - result = 31 * result + targetId; - return result; - } -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserEmailAddress.java b/src/main/java/eu/mulk/mulkcms2/benki/UserEmailAddress.java deleted file mode 100644 index 3341687..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserEmailAddress.java +++ /dev/null @@ -1,22 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -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 = "user_email_addresses", schema = "public", catalog = "benki") -public class UserEmailAddress extends PanacheEntityBase { - - @Id - @Column(name = "email", nullable = false, length = -1) - public String email; - - @ManyToOne - @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User user; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserJid.java b/src/main/java/eu/mulk/mulkcms2/benki/UserJid.java deleted file mode 100644 index c32d547..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserJid.java +++ /dev/null @@ -1,28 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -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_jids", schema = "public", catalog = "benki") -@IdClass(UserJidPK.class) -public class UserJid extends PanacheEntityBase { - - @Id - @Column(name = "user", nullable = false) - public int userId; - - @Id - @Column(name = "jid", nullable = false, length = -1) - public String jid; - - @ManyToOne - @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User user; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserJidPK.java b/src/main/java/eu/mulk/mulkcms2/benki/UserJidPK.java deleted file mode 100644 index f033723..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserJidPK.java +++ /dev/null @@ -1,59 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import java.io.Serializable; -import javax.persistence.Column; -import javax.persistence.Id; - -public class UserJidPK implements Serializable { - - private int userId; - private String jid; - - @Column(name = "user", nullable = false) - @Id - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } - - @Column(name = "jid", nullable = false, length = -1) - @Id - public String getJid() { - return jid; - } - - public void setJid(String jid) { - this.jid = jid; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - UserJidPK userJidPK = (UserJidPK) o; - - if (userId != userJidPK.userId) { - return false; - } - if (jid != null ? !jid.equals(userJidPK.jid) : userJidPK.jid != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = userId; - result = 31 * result + (jid != null ? jid.hashCode() : 0); - return result; - } -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserNickname.java b/src/main/java/eu/mulk/mulkcms2/benki/UserNickname.java deleted file mode 100644 index 7bfed4e..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserNickname.java +++ /dev/null @@ -1,22 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -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 = "user_nicknames", schema = "public", catalog = "benki") -public class UserNickname extends PanacheEntityBase { - - @Id - @Column(name = "nickname", nullable = false, length = -1) - public String nickname; - - @ManyToOne - @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User user; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserRole.java b/src/main/java/eu/mulk/mulkcms2/benki/UserRole.java deleted file mode 100644 index f735d6c..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserRole.java +++ /dev/null @@ -1,32 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -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_roles", schema = "public", catalog = "benki") -@IdClass(UserRolePK.class) -public class UserRole extends PanacheEntityBase { - - @Id - @Column(name = "user", nullable = false) - public int userId; - - @Id - @Column(name = "role", nullable = false) - public int roleId; - - @ManyToOne - @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User user; - - @ManyToOne - @JoinColumn(name = "role", referencedColumnName = "id", nullable = false) - public Role role; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserRolePK.java b/src/main/java/eu/mulk/mulkcms2/benki/UserRolePK.java deleted file mode 100644 index 6181b8b..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserRolePK.java +++ /dev/null @@ -1,59 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import java.io.Serializable; -import javax.persistence.Column; -import javax.persistence.Id; - -public class UserRolePK implements Serializable { - - private int userId; - private int roleId; - - @Column(name = "user", nullable = false) - @Id - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } - - @Column(name = "role", nullable = false) - @Id - public int getRoleId() { - return roleId; - } - - public void setRoleId(int roleId) { - this.roleId = roleId; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - UserRolePK that = (UserRolePK) o; - - if (userId != that.userId) { - return false; - } - if (roleId != that.roleId) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = userId; - result = 31 * result + roleId; - return result; - } -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserRsaKey.java b/src/main/java/eu/mulk/mulkcms2/benki/UserRsaKey.java deleted file mode 100644 index f35afdd..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserRsaKey.java +++ /dev/null @@ -1,41 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.math.BigInteger; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.IdClass; -import javax.persistence.JoinColumn; -import javax.persistence.JoinColumns; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -@Entity -@Table(name = "user_rsa_keys", schema = "public", catalog = "benki") -@IdClass(UserRsaKeyPK.class) -public class UserRsaKey extends PanacheEntityBase { - - @Id - @Column(name = "user", nullable = false) - public int userId; - - @Id - @Column(name = "modulus", nullable = false, precision = 0) - public BigInteger modulus; - - @Id - @Column(name = "exponent", nullable = false, precision = 0) - public BigInteger exponent; - - @ManyToOne - @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User user; - - @ManyToOne - @JoinColumns({ - @JoinColumn(name = "modulus", referencedColumnName = "modulus", nullable = false), - @JoinColumn(name = "exponent", referencedColumnName = "exponent", nullable = false) - }) - public RsaKey rsaKey; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserRsaKeyPK.java b/src/main/java/eu/mulk/mulkcms2/benki/UserRsaKeyPK.java deleted file mode 100644 index 4c146ae..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserRsaKeyPK.java +++ /dev/null @@ -1,75 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import java.io.Serializable; -import java.math.BigInteger; -import javax.persistence.Column; -import javax.persistence.Id; - -public class UserRsaKeyPK implements Serializable { - - private int userId; - private BigInteger modulus; - private BigInteger exponent; - - @Column(name = "user", nullable = false) - @Id - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } - - @Column(name = "modulus", nullable = false, precision = 0) - @Id - public BigInteger getModulus() { - return modulus; - } - - public void setModulus(BigInteger modulus) { - this.modulus = modulus; - } - - @Column(name = "exponent", nullable = false, precision = 0) - @Id - public BigInteger getExponent() { - return exponent; - } - - public void setExponent(BigInteger exponent) { - this.exponent = exponent; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - UserRsaKeyPK that = (UserRsaKeyPK) o; - - if (userId != that.userId) { - return false; - } - if (modulus != null ? !modulus.equals(that.modulus) : that.modulus != null) { - return false; - } - if (exponent != null ? !exponent.equals(that.exponent) : that.exponent != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = userId; - result = 31 * result + (modulus != null ? modulus.hashCode() : 0); - result = 31 * result + (exponent != null ? exponent.hashCode() : 0); - return result; - } -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserVisibleBookmark.java b/src/main/java/eu/mulk/mulkcms2/benki/UserVisibleBookmark.java deleted file mode 100644 index ae5d52e..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserVisibleBookmark.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Table; - -@Entity -@Table(name = "user_visible_bookmarks", schema = "public", catalog = "benki") -public class UserVisibleBookmark extends PanacheEntityBase { - - @Column(name = "user", nullable = true) - public Integer userId; - - @Column(name = "message", nullable = true) - public Integer messageId; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserVisibleLazychatMessage.java b/src/main/java/eu/mulk/mulkcms2/benki/UserVisibleLazychatMessage.java deleted file mode 100644 index d57dca5..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserVisibleLazychatMessage.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Table; - -@Entity -@Table(name = "user_visible_lazychat_messages", schema = "public", catalog = "benki") -public class UserVisibleLazychatMessage extends PanacheEntityBase { - - @Column(name = "user", nullable = true) - public Integer userId; - - @Column(name = "message", nullable = true) - public Integer messageId; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserVisiblePost.java b/src/main/java/eu/mulk/mulkcms2/benki/UserVisiblePost.java deleted file mode 100644 index 62833e6..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserVisiblePost.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Table; - -@Entity -@Table(name = "user_visible_posts", schema = "public", catalog = "benki") -public class UserVisiblePost extends PanacheEntityBase { - - @Column(name = "user", nullable = true) - public Integer userId; - - @Column(name = "message", nullable = true) - public Integer messageId; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/WebId.java b/src/main/java/eu/mulk/mulkcms2/benki/WebId.java deleted file mode 100644 index 476d91f..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/WebId.java +++ /dev/null @@ -1,22 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -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 = "webids", schema = "public", catalog = "benki") -public class WebId extends PanacheEntityBase { - - @Id - @Column(name = "webid", nullable = false, length = -1) - public String webid; - - @ManyToOne - @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User user; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/WikiPage.java b/src/main/java/eu/mulk/mulkcms2/benki/WikiPage.java deleted file mode 100644 index 169c70a..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/WikiPage.java +++ /dev/null @@ -1,21 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Collection; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.OneToMany; -import javax.persistence.Table; - -@Entity -@Table(name = "wiki_pages", schema = "public", catalog = "benki") -public class WikiPage extends PanacheEntityBase { - - @Id - @Column(name = "id", nullable = false) - public int id; - - @OneToMany(mappedBy = "page") - public Collection revisions; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/WikiPageRevision.java b/src/main/java/eu/mulk/mulkcms2/benki/WikiPageRevision.java deleted file mode 100644 index c0e8cfc..0000000 --- a/src/main/java/eu/mulk/mulkcms2/benki/WikiPageRevision.java +++ /dev/null @@ -1,38 +0,0 @@ -package eu.mulk.mulkcms2.benki; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -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 = "wiki_page_revisions", schema = "public", catalog = "benki") -public class WikiPageRevision extends PanacheEntityBase { - - @Id - @Column(name = "id", nullable = false) - public int id; - - @Column(name = "date", nullable = true) - public Object date; - - @Column(name = "title", nullable = true, length = -1) - public String title; - - @Column(name = "content", nullable = true, length = -1) - public String content; - - @Column(name = "format", nullable = true, length = -1) - public String format; - - @ManyToOne - @JoinColumn(name = "page", referencedColumnName = "id", nullable = false) - public WikiPage page; - - @ManyToOne - @JoinColumn(name = "author", referencedColumnName = "id") - public User author; -} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/EffectiveRoleSubrole.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/EffectiveRoleSubrole.java new file mode 100644 index 0000000..4166752 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/EffectiveRoleSubrole.java @@ -0,0 +1,42 @@ +package eu.mulk.mulkcms2.benki.accesscontrol; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import org.hibernate.annotations.Immutable; + +@Entity +@Immutable +@Table(name = "effective_role_subroles", schema = "public", catalog = "benki") +public class EffectiveRoleSubrole extends PanacheEntityBase implements Serializable { + + @Id + @Column(name = "superrole", nullable = true) + public Integer superroleId; + + @Id + @Column(name = "subrole", nullable = true) + public Integer subroleId; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof EffectiveRoleSubrole)) { + return false; + } + EffectiveRoleSubrole that = (EffectiveRoleSubrole) o; + return Objects.equals(superroleId, that.superroleId) + && Objects.equals(subroleId, that.subroleId); + } + + @Override + public int hashCode() { + return Objects.hash(superroleId, subroleId); + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/EffectiveUserRole.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/EffectiveUserRole.java new file mode 100644 index 0000000..6b5c3ab --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/EffectiveUserRole.java @@ -0,0 +1,41 @@ +package eu.mulk.mulkcms2.benki.accesscontrol; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import org.hibernate.annotations.Immutable; + +@Entity +@Immutable +@Table(name = "effective_user_roles", schema = "public", catalog = "benki") +public class EffectiveUserRole extends PanacheEntityBase implements Serializable { + + @Id + @Column(name = "user", nullable = true) + public Integer userId; + + @Id + @Column(name = "role", nullable = true) + public Integer roleId; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof EffectiveUserRole)) { + return false; + } + EffectiveUserRole that = (EffectiveUserRole) o; + return Objects.equals(userId, that.userId) && Objects.equals(roleId, that.roleId); + } + + @Override + public int hashCode() { + return Objects.hash(userId, roleId); + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKey.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKey.java new file mode 100644 index 0000000..679c25d --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKey.java @@ -0,0 +1,30 @@ +package eu.mulk.mulkcms2.benki.accesscontrol; + +import eu.mulk.mulkcms2.benki.users.User; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.math.BigInteger; +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 = "page_keys", schema = "public", catalog = "benki") +@IdClass(PageKeyPK.class) +public class PageKey extends PanacheEntityBase { + + @Id + @Column(name = "page", nullable = false, length = -1) + public String page; + + @Id + @Column(name = "key", nullable = false, precision = 0) + public BigInteger key; + + @ManyToOne + @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) + public User user; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKeyPK.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKeyPK.java new file mode 100644 index 0000000..e80cb5e --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKeyPK.java @@ -0,0 +1,60 @@ +package eu.mulk.mulkcms2.benki.accesscontrol; + +import java.io.Serializable; +import java.math.BigInteger; +import javax.persistence.Column; +import javax.persistence.Id; + +public class PageKeyPK implements Serializable { + + private String page; + private BigInteger key; + + @Column(name = "page", nullable = false, length = -1) + @Id + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + @Column(name = "key", nullable = false, precision = 0) + @Id + public BigInteger getKey() { + return key; + } + + public void setKey(BigInteger key) { + this.key = key; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + PageKeyPK pageKeyPK = (PageKeyPK) o; + + if (page != null ? !page.equals(pageKeyPK.page) : pageKeyPK.page != null) { + return false; + } + if (key != null ? !key.equals(pageKeyPK.key) : pageKeyPK.key != null) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = page != null ? page.hashCode() : 0; + result = 31 * result + (key != null ? key.hashCode() : 0); + return result; + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/Role.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/Role.java new file mode 100644 index 0000000..090fb92 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/Role.java @@ -0,0 +1,43 @@ +package eu.mulk.mulkcms2.benki.accesscontrol; + +import eu.mulk.mulkcms2.benki.generic.PostTarget; +import eu.mulk.mulkcms2.benki.users.User; +import eu.mulk.mulkcms2.benki.users.UserDefaultTarget; +import eu.mulk.mulkcms2.benki.users.UserRole; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.util.Collection; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "roles", schema = "public", catalog = "benki") +public class Role extends PanacheEntityBase { + + @Id + @Column(name = "id", nullable = false) + public int id; + + @Column(name = "name", nullable = true, length = -1) + public String name; + + @OneToMany(mappedBy = "target") + public Collection targetedPosts; + + @OneToMany(mappedBy = "superrole") + public Collection subroles; + + @OneToMany(mappedBy = "subrole") + public Collection superroles; + + @OneToMany(mappedBy = "target") + public Collection usersUsedByAsDefaultTarget; + + @OneToMany(mappedBy = "role") + public Collection users; + + @OneToMany(mappedBy = "ownedRole") + public Collection owningUsers; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrole.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrole.java new file mode 100644 index 0000000..5e7b237 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrole.java @@ -0,0 +1,32 @@ +package eu.mulk.mulkcms2.benki.accesscontrol; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +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 = "role_subroles", schema = "public", catalog = "benki") +@IdClass(RoleSubrolePK.class) +public class RoleSubrole extends PanacheEntityBase { + + @Id + @Column(name = "superrole", nullable = false) + public int superroleId; + + @Id + @Column(name = "subrole", nullable = false) + public int subroleId; + + @ManyToOne + @JoinColumn(name = "superrole", referencedColumnName = "id", nullable = false) + public Role superrole; + + @ManyToOne + @JoinColumn(name = "subrole", referencedColumnName = "id", nullable = false) + public Role subrole; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrolePK.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrolePK.java new file mode 100644 index 0000000..f74d98b --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrolePK.java @@ -0,0 +1,59 @@ +package eu.mulk.mulkcms2.benki.accesscontrol; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Id; + +public class RoleSubrolePK implements Serializable { + + private int superroleId; + private int subroleId; + + @Column(name = "superrole", nullable = false) + @Id + public int getSuperroleId() { + return superroleId; + } + + public void setSuperroleId(int superroleId) { + this.superroleId = superroleId; + } + + @Column(name = "subrole", nullable = false) + @Id + public int getSubroleId() { + return subroleId; + } + + public void setSubroleId(int subroleId) { + this.subroleId = subroleId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + RoleSubrolePK that = (RoleSubrolePK) o; + + if (superroleId != that.superroleId) { + return false; + } + if (subroleId != that.subroleId) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = superroleId; + result = 31 * result + subroleId; + return result; + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleTag.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleTag.java new file mode 100644 index 0000000..5dbda68 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleTag.java @@ -0,0 +1,22 @@ +package eu.mulk.mulkcms2.benki.accesscontrol; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.Table; + +@Entity +@Table(name = "role_tags", schema = "public", catalog = "benki") +@IdClass(RoleTagPK.class) +public class RoleTag extends PanacheEntityBase { + + @Id + @Column(name = "role", nullable = false) + public int roleId; + + @Id + @Column(name = "tag", nullable = false, length = -1) + public String tag; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleTagPK.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleTagPK.java new file mode 100644 index 0000000..5b32f81 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleTagPK.java @@ -0,0 +1,59 @@ +package eu.mulk.mulkcms2.benki.accesscontrol; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Id; + +public class RoleTagPK implements Serializable { + + private int roleId; + private String tag; + + @Column(name = "role", nullable = false) + @Id + public int getRoleId() { + return roleId; + } + + public void setRoleId(int roleId) { + this.roleId = roleId; + } + + @Column(name = "tag", nullable = false, length = -1) + @Id + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + RoleTagPK roleTagPK = (RoleTagPK) o; + + if (roleId != roleTagPK.roleId) { + return false; + } + if (tag != null ? !tag.equals(roleTagPK.tag) : roleTagPK.tag != null) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = roleId; + result = 31 * result + (tag != null ? tag.hashCode() : 0); + return result; + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/Bookmark.java b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/Bookmark.java new file mode 100644 index 0000000..121e340 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/Bookmark.java @@ -0,0 +1,25 @@ +package eu.mulk.mulkcms2.benki.bookmarx; + +import eu.mulk.mulkcms2.benki.generic.Post; +import java.util.Collection; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "bookmarks", schema = "public", catalog = "benki") +public class Bookmark extends Post { + + @Column(name = "uri", nullable = false, length = -1) + public String uri; + + @Column(name = "title", nullable = true, length = -1) + public String title; + + @Column(name = "description", nullable = true, length = -1) + public String description; + + @OneToMany(mappedBy = "bookmark") + public Collection tags; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTag.java b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTag.java new file mode 100644 index 0000000..cca5478 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTag.java @@ -0,0 +1,28 @@ +package eu.mulk.mulkcms2.benki.bookmarx; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +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 = "bookmark_tags", schema = "public", catalog = "benki") +@IdClass(BookmarkTagPK.class) +public class BookmarkTag extends PanacheEntityBase { + + @Id + @Column(name = "bookmark", nullable = false) + public int bookmarkId; + + @Id + @Column(name = "tag", nullable = false, length = -1) + public String tag; + + @ManyToOne + @JoinColumn(name = "bookmark", referencedColumnName = "id", nullable = false) + public Bookmark bookmark; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTagPK.java b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTagPK.java new file mode 100644 index 0000000..876648d --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTagPK.java @@ -0,0 +1,59 @@ +package eu.mulk.mulkcms2.benki.bookmarx; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Id; + +public class BookmarkTagPK implements Serializable { + + private int bookmarkId; + private String tag; + + @Column(name = "bookmark", nullable = false) + @Id + public int getBookmarkId() { + return bookmarkId; + } + + public void setBookmarkId(int bookmarkId) { + this.bookmarkId = bookmarkId; + } + + @Column(name = "tag", nullable = false, length = -1) + @Id + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + BookmarkTagPK that = (BookmarkTagPK) o; + + if (bookmarkId != that.bookmarkId) { + return false; + } + if (tag != null ? !tag.equals(that.tag) : that.tag != null) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = bookmarkId; + result = 31 * result + (tag != null ? tag.hashCode() : 0); + return result; + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/UserVisibleBookmark.java b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/UserVisibleBookmark.java new file mode 100644 index 0000000..589e62a --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/UserVisibleBookmark.java @@ -0,0 +1,41 @@ +package eu.mulk.mulkcms2.benki.bookmarx; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import org.hibernate.annotations.Immutable; + +@Entity +@Immutable +@Table(name = "user_visible_bookmarks", schema = "public", catalog = "benki") +public class UserVisibleBookmark extends PanacheEntityBase implements Serializable { + + @Id + @Column(name = "user", nullable = true) + public Integer userId; + + @Id + @Column(name = "message", nullable = true) + public Integer messageId; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof UserVisibleBookmark)) { + return false; + } + UserVisibleBookmark that = (UserVisibleBookmark) o; + return Objects.equals(userId, that.userId) && Objects.equals(messageId, that.messageId); + } + + @Override + public int hashCode() { + return Objects.hash(userId, messageId); + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/generic/Post.java b/src/main/java/eu/mulk/mulkcms2/benki/generic/Post.java new file mode 100644 index 0000000..050cdcb --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/generic/Post.java @@ -0,0 +1,30 @@ +package eu.mulk.mulkcms2.benki.generic; + +import eu.mulk.mulkcms2.benki.users.User; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.time.OffsetDateTime; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "posts", schema = "public", catalog = "benki") +@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) +public abstract class Post extends PanacheEntityBase { + + @Id + @Column(name = "id", nullable = false) + public int id; + + @Column(name = "date", nullable = true) + public OffsetDateTime date; + + @ManyToOne + @JoinColumn(name = "owner", referencedColumnName = "id") + public User owner; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/generic/PostTarget.java b/src/main/java/eu/mulk/mulkcms2/benki/generic/PostTarget.java new file mode 100644 index 0000000..3a3f6b2 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/generic/PostTarget.java @@ -0,0 +1,29 @@ +package eu.mulk.mulkcms2.benki.generic; + +import eu.mulk.mulkcms2.benki.accesscontrol.Role; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +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 = "post_targets", schema = "public", catalog = "benki") +@IdClass(PostTargetPK.class) +public class PostTarget extends PanacheEntityBase { + + @Id + @Column(name = "message", nullable = false) + public int message; + + @Id + @Column(name = "target", nullable = false) + public int targetId; + + @ManyToOne + @JoinColumn(name = "target", referencedColumnName = "id", nullable = false) + public Role target; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/generic/PostTargetPK.java b/src/main/java/eu/mulk/mulkcms2/benki/generic/PostTargetPK.java new file mode 100644 index 0000000..13c660d --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/generic/PostTargetPK.java @@ -0,0 +1,59 @@ +package eu.mulk.mulkcms2.benki.generic; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Id; + +public class PostTargetPK implements Serializable { + + private int message; + private int targetId; + + @Column(name = "message", nullable = false) + @Id + public int getMessage() { + return message; + } + + public void setMessage(int message) { + this.message = message; + } + + @Column(name = "target", nullable = false) + @Id + public int getTargetId() { + return targetId; + } + + public void setTargetId(int targetId) { + this.targetId = targetId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + PostTargetPK that = (PostTargetPK) o; + + if (message != that.message) { + return false; + } + if (targetId != that.targetId) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = message; + result = 31 * result + targetId; + return result; + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/generic/UserVisiblePost.java b/src/main/java/eu/mulk/mulkcms2/benki/generic/UserVisiblePost.java new file mode 100644 index 0000000..2b09120 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/generic/UserVisiblePost.java @@ -0,0 +1,41 @@ +package eu.mulk.mulkcms2.benki.generic; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import org.hibernate.annotations.Immutable; + +@Entity +@Immutable +@Table(name = "user_visible_posts", schema = "public", catalog = "benki") +public class UserVisiblePost extends PanacheEntityBase implements Serializable { + + @Id + @Column(name = "user", nullable = true) + public Integer userId; + + @Id + @Column(name = "message", nullable = true) + public Integer messageId; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof UserVisiblePost)) { + return false; + } + UserVisiblePost that = (UserVisiblePost) o; + return Objects.equals(userId, that.userId) && Objects.equals(messageId, that.messageId); + } + + @Override + public int hashCode() { + return Objects.hash(userId, messageId); + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatMessage.java b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatMessage.java new file mode 100644 index 0000000..626f263 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatMessage.java @@ -0,0 +1,22 @@ +package eu.mulk.mulkcms2.benki.lafargue; + +import eu.mulk.mulkcms2.benki.generic.Post; +import java.util.Collection; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "lazychat_messages", schema = "public", catalog = "benki") +public class LazychatMessage extends Post { + + @Column(name = "content", nullable = true, length = -1) + public String content; + + @Column(name = "format", nullable = false, length = -1) + public String format; + + @OneToMany(mappedBy = "referrer") + public Collection references; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReference.java b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReference.java new file mode 100644 index 0000000..d1e8910 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReference.java @@ -0,0 +1,32 @@ +package eu.mulk.mulkcms2.benki.lafargue; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +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 = "lazychat_references", schema = "public", catalog = "benki") +@IdClass(LazychatReferencePK.class) +public class LazychatReference extends PanacheEntityBase { + + @Id + @Column(name = "referrer", nullable = false) + public int referrerId; + + @Id + @Column(name = "referee", nullable = false) + public int refereeId; + + @ManyToOne + @JoinColumn(name = "referrer", referencedColumnName = "id", nullable = false) + public LazychatMessage referrer; + + @ManyToOne + @JoinColumn(name = "referee", referencedColumnName = "id", nullable = false) + public LazychatMessage referee; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReferencePK.java b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReferencePK.java new file mode 100644 index 0000000..6e2d965 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReferencePK.java @@ -0,0 +1,59 @@ +package eu.mulk.mulkcms2.benki.lafargue; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Id; + +public class LazychatReferencePK implements Serializable { + + private int referrerId; + private int refereeId; + + @Column(name = "referrer", nullable = false) + @Id + public int getReferrerId() { + return referrerId; + } + + public void setReferrerId(int referrerId) { + this.referrerId = referrerId; + } + + @Column(name = "referee", nullable = false) + @Id + public int getRefereeId() { + return refereeId; + } + + public void setRefereeId(int refereeId) { + this.refereeId = refereeId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + LazychatReferencePK that = (LazychatReferencePK) o; + + if (referrerId != that.referrerId) { + return false; + } + if (refereeId != that.refereeId) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = referrerId; + result = 31 * result + refereeId; + return result; + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/lafargue/UserVisibleLazychatMessage.java b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/UserVisibleLazychatMessage.java new file mode 100644 index 0000000..0570aae --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/UserVisibleLazychatMessage.java @@ -0,0 +1,41 @@ +package eu.mulk.mulkcms2.benki.lafargue; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import org.hibernate.annotations.Immutable; + +@Entity +@Immutable +@Table(name = "user_visible_lazychat_messages", schema = "public", catalog = "benki") +public class UserVisibleLazychatMessage extends PanacheEntityBase implements Serializable { + + @Id + @Column(name = "user", nullable = true) + public Integer userId; + + @Id + @Column(name = "message", nullable = true) + public Integer messageId; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof UserVisibleLazychatMessage)) { + return false; + } + UserVisibleLazychatMessage that = (UserVisibleLazychatMessage) o; + return Objects.equals(userId, that.userId) && Objects.equals(messageId, that.messageId); + } + + @Override + public int hashCode() { + return Objects.hash(userId, messageId); + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/Openids.java b/src/main/java/eu/mulk/mulkcms2/benki/users/Openids.java new file mode 100644 index 0000000..925584b --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/Openids.java @@ -0,0 +1,20 @@ +package eu.mulk.mulkcms2.benki.users; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; + +@Entity +public class Openids extends PanacheEntityBase { + + @Id + @Column(name = "openid", nullable = false, length = -1) + public String openid; + + @ManyToOne + @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) + public User user; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/RsaKey.java b/src/main/java/eu/mulk/mulkcms2/benki/users/RsaKey.java new file mode 100644 index 0000000..6e3db81 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/RsaKey.java @@ -0,0 +1,28 @@ +package eu.mulk.mulkcms2.benki.users; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.math.BigInteger; +import java.util.Collection; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "rsa_keys", schema = "public", catalog = "benki") +@IdClass(RsaKeyPK.class) +public class RsaKey extends PanacheEntityBase { + + @Id + @Column(name = "modulus", nullable = false, precision = 0) + public BigInteger modulus; + + @Id + @Column(name = "exponent", nullable = false, precision = 0) + public BigInteger exponent; + + @OneToMany(mappedBy = "rsaKey") + public Collection users; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/RsaKeyPK.java b/src/main/java/eu/mulk/mulkcms2/benki/users/RsaKeyPK.java new file mode 100644 index 0000000..5b33ec8 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/RsaKeyPK.java @@ -0,0 +1,60 @@ +package eu.mulk.mulkcms2.benki.users; + +import java.io.Serializable; +import java.math.BigInteger; +import javax.persistence.Column; +import javax.persistence.Id; + +public class RsaKeyPK implements Serializable { + + private BigInteger modulus; + private BigInteger exponent; + + @Column(name = "modulus", nullable = false, precision = 0) + @Id + public BigInteger getModulus() { + return modulus; + } + + public void setModulus(BigInteger modulus) { + this.modulus = modulus; + } + + @Column(name = "exponent", nullable = false, precision = 0) + @Id + public BigInteger getExponent() { + return exponent; + } + + public void setExponent(BigInteger exponent) { + this.exponent = exponent; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + RsaKeyPK rsaKeyPK = (RsaKeyPK) o; + + if (modulus != null ? !modulus.equals(rsaKeyPK.modulus) : rsaKeyPK.modulus != null) { + return false; + } + if (exponent != null ? !exponent.equals(rsaKeyPK.exponent) : rsaKeyPK.exponent != null) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = modulus != null ? modulus.hashCode() : 0; + result = 31 * result + (exponent != null ? exponent.hashCode() : 0); + return result; + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/User.java b/src/main/java/eu/mulk/mulkcms2/benki/users/User.java new file mode 100644 index 0000000..fb1ed3b --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/User.java @@ -0,0 +1,87 @@ +package eu.mulk.mulkcms2.benki.users; + +import eu.mulk.mulkcms2.benki.accesscontrol.PageKey; +import eu.mulk.mulkcms2.benki.accesscontrol.Role; +import eu.mulk.mulkcms2.benki.bookmarx.Bookmark; +import eu.mulk.mulkcms2.benki.generic.Post; +import eu.mulk.mulkcms2.benki.lafargue.LazychatMessage; +import eu.mulk.mulkcms2.benki.wiki.WikiPageRevision; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.util.Collection; +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(name = "BenkiUser") +@Table(name = "users", schema = "public", catalog = "benki") +public class User extends PanacheEntityBase { + + @Id + @Column(name = "id", nullable = false) + public int id; + + @Column(name = "first_name", nullable = true, length = -1) + public String firstName; + + @Column(name = "middle_names", nullable = true, length = -1) + public String middleNames; + + @Column(name = "last_name", nullable = true, length = -1) + public String lastName; + + @Column(name = "email", nullable = true, length = -1) + public String email; + + @Column(name = "website", nullable = true, length = -1) + public String website; + + @Column(name = "status", nullable = true, length = -1) + public String status; + + @OneToMany(mappedBy = "owner") + public Collection bookmarks; + + @OneToMany(mappedBy = "owner") + public Collection lazychatMessages; + + @OneToMany(mappedBy = "user") + public Collection openids; + + @OneToMany(mappedBy = "user") + public Collection pageKeys; + + @OneToMany(mappedBy = "owner") + public Collection posts; + + @OneToMany(mappedBy = "user") + public Collection defaultTargets; + + @OneToMany(mappedBy = "user") + public Collection emailAddresses; + + @OneToMany(mappedBy = "user") + public Collection jids; + + @OneToMany(mappedBy = "user") + public Collection nicknames; + + @OneToMany(mappedBy = "user") + public Collection roles; + + @OneToMany(mappedBy = "user") + public Collection rsaKeys; + + @ManyToOne + @JoinColumn(name = "role", referencedColumnName = "id", nullable = false) + public Role ownedRole; + + @OneToMany(mappedBy = "user") + public Collection webids; + + @OneToMany(mappedBy = "author") + public Collection wikiPageRevisions; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTarget.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTarget.java new file mode 100644 index 0000000..ffa5ef7 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTarget.java @@ -0,0 +1,33 @@ +package eu.mulk.mulkcms2.benki.users; + +import eu.mulk.mulkcms2.benki.accesscontrol.Role; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +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_default_target", schema = "public", catalog = "benki") +@IdClass(UserDefaultTargetPK.class) +public class UserDefaultTarget extends PanacheEntityBase { + + @Id + @Column(name = "user", nullable = false) + public int userId; + + @Id + @Column(name = "target", nullable = false) + public int targetId; + + @ManyToOne + @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) + public User user; + + @ManyToOne + @JoinColumn(name = "target", referencedColumnName = "id", nullable = false) + public Role target; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTargetPK.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTargetPK.java new file mode 100644 index 0000000..4a41e7b --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTargetPK.java @@ -0,0 +1,59 @@ +package eu.mulk.mulkcms2.benki.users; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Id; + +public class UserDefaultTargetPK implements Serializable { + + private int userId; + private int targetId; + + @Column(name = "user", nullable = false) + @Id + public int getUserId() { + return userId; + } + + public void setUserId(int userId) { + this.userId = userId; + } + + @Column(name = "target", nullable = false) + @Id + public int getTargetId() { + return targetId; + } + + public void setTargetId(int targetId) { + this.targetId = targetId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + UserDefaultTargetPK that = (UserDefaultTargetPK) o; + + if (userId != that.userId) { + return false; + } + if (targetId != that.targetId) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = userId; + result = 31 * result + targetId; + return result; + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserEmailAddress.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserEmailAddress.java new file mode 100644 index 0000000..9706407 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserEmailAddress.java @@ -0,0 +1,22 @@ +package eu.mulk.mulkcms2.benki.users; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +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 = "user_email_addresses", schema = "public", catalog = "benki") +public class UserEmailAddress extends PanacheEntityBase { + + @Id + @Column(name = "email", nullable = false, length = -1) + public String email; + + @ManyToOne + @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) + public User user; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserJid.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserJid.java new file mode 100644 index 0000000..1c17ca8 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserJid.java @@ -0,0 +1,28 @@ +package eu.mulk.mulkcms2.benki.users; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +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_jids", schema = "public", catalog = "benki") +@IdClass(UserJidPK.class) +public class UserJid extends PanacheEntityBase { + + @Id + @Column(name = "user", nullable = false) + public int userId; + + @Id + @Column(name = "jid", nullable = false, length = -1) + public String jid; + + @ManyToOne + @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) + public User user; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserJidPK.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserJidPK.java new file mode 100644 index 0000000..19eeaeb --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserJidPK.java @@ -0,0 +1,59 @@ +package eu.mulk.mulkcms2.benki.users; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Id; + +public class UserJidPK implements Serializable { + + private int userId; + private String jid; + + @Column(name = "user", nullable = false) + @Id + public int getUserId() { + return userId; + } + + public void setUserId(int userId) { + this.userId = userId; + } + + @Column(name = "jid", nullable = false, length = -1) + @Id + public String getJid() { + return jid; + } + + public void setJid(String jid) { + this.jid = jid; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + UserJidPK userJidPK = (UserJidPK) o; + + if (userId != userJidPK.userId) { + return false; + } + if (jid != null ? !jid.equals(userJidPK.jid) : userJidPK.jid != null) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = userId; + result = 31 * result + (jid != null ? jid.hashCode() : 0); + return result; + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserNickname.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserNickname.java new file mode 100644 index 0000000..b664cb9 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserNickname.java @@ -0,0 +1,22 @@ +package eu.mulk.mulkcms2.benki.users; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +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 = "user_nicknames", schema = "public", catalog = "benki") +public class UserNickname extends PanacheEntityBase { + + @Id + @Column(name = "nickname", nullable = false, length = -1) + public String nickname; + + @ManyToOne + @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) + public User user; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserRole.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRole.java new file mode 100644 index 0000000..d4c10bd --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRole.java @@ -0,0 +1,33 @@ +package eu.mulk.mulkcms2.benki.users; + +import eu.mulk.mulkcms2.benki.accesscontrol.Role; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +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_roles", schema = "public", catalog = "benki") +@IdClass(UserRolePK.class) +public class UserRole extends PanacheEntityBase { + + @Id + @Column(name = "user", nullable = false) + public int userId; + + @Id + @Column(name = "role", nullable = false) + public int roleId; + + @ManyToOne + @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) + public User user; + + @ManyToOne + @JoinColumn(name = "role", referencedColumnName = "id", nullable = false) + public Role role; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserRolePK.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRolePK.java new file mode 100644 index 0000000..5649ff4 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRolePK.java @@ -0,0 +1,59 @@ +package eu.mulk.mulkcms2.benki.users; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Id; + +public class UserRolePK implements Serializable { + + private int userId; + private int roleId; + + @Column(name = "user", nullable = false) + @Id + public int getUserId() { + return userId; + } + + public void setUserId(int userId) { + this.userId = userId; + } + + @Column(name = "role", nullable = false) + @Id + public int getRoleId() { + return roleId; + } + + public void setRoleId(int roleId) { + this.roleId = roleId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + UserRolePK that = (UserRolePK) o; + + if (userId != that.userId) { + return false; + } + if (roleId != that.roleId) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = userId; + result = 31 * result + roleId; + return result; + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKey.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKey.java new file mode 100644 index 0000000..33552e5 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKey.java @@ -0,0 +1,51 @@ +package eu.mulk.mulkcms2.benki.users; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.math.BigInteger; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "user_rsa_keys", schema = "public", catalog = "benki") +@IdClass(UserRsaKeyPK.class) +public class UserRsaKey extends PanacheEntityBase { + + @Id + @Column(name = "user", nullable = false) + public int userId; + + @Id + @Column(name = "modulus", nullable = false, precision = 0) + public BigInteger modulus; + + @Id + @Column(name = "exponent", nullable = false, precision = 0) + public BigInteger exponent; + + @ManyToOne + @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) + public User user; + + @ManyToOne + @JoinColumns({ + @JoinColumn( + name = "modulus", + referencedColumnName = "modulus", + nullable = false, + insertable = false, + updatable = false), + @JoinColumn( + name = "exponent", + referencedColumnName = "exponent", + nullable = false, + insertable = false, + updatable = false) + }) + public RsaKey rsaKey; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKeyPK.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKeyPK.java new file mode 100644 index 0000000..adcaeb6 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKeyPK.java @@ -0,0 +1,75 @@ +package eu.mulk.mulkcms2.benki.users; + +import java.io.Serializable; +import java.math.BigInteger; +import javax.persistence.Column; +import javax.persistence.Id; + +public class UserRsaKeyPK implements Serializable { + + private int userId; + private BigInteger modulus; + private BigInteger exponent; + + @Column(name = "user", nullable = false) + @Id + public int getUserId() { + return userId; + } + + public void setUserId(int userId) { + this.userId = userId; + } + + @Column(name = "modulus", nullable = false, precision = 0) + @Id + public BigInteger getModulus() { + return modulus; + } + + public void setModulus(BigInteger modulus) { + this.modulus = modulus; + } + + @Column(name = "exponent", nullable = false, precision = 0) + @Id + public BigInteger getExponent() { + return exponent; + } + + public void setExponent(BigInteger exponent) { + this.exponent = exponent; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + UserRsaKeyPK that = (UserRsaKeyPK) o; + + if (userId != that.userId) { + return false; + } + if (modulus != null ? !modulus.equals(that.modulus) : that.modulus != null) { + return false; + } + if (exponent != null ? !exponent.equals(that.exponent) : that.exponent != null) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = userId; + result = 31 * result + (modulus != null ? modulus.hashCode() : 0); + result = 31 * result + (exponent != null ? exponent.hashCode() : 0); + return result; + } +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/WebId.java b/src/main/java/eu/mulk/mulkcms2/benki/users/WebId.java new file mode 100644 index 0000000..0a30ff1 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/WebId.java @@ -0,0 +1,22 @@ +package eu.mulk.mulkcms2.benki.users; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +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 = "webids", schema = "public", catalog = "benki") +public class WebId extends PanacheEntityBase { + + @Id + @Column(name = "webid", nullable = false, length = -1) + public String webid; + + @ManyToOne + @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) + public User user; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPage.java b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPage.java new file mode 100644 index 0000000..e2e5b13 --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPage.java @@ -0,0 +1,21 @@ +package eu.mulk.mulkcms2.benki.wiki; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.util.Collection; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "wiki_pages", schema = "public", catalog = "benki") +public class WikiPage extends PanacheEntityBase { + + @Id + @Column(name = "id", nullable = false) + public int id; + + @OneToMany(mappedBy = "page") + public Collection revisions; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPageRevision.java b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPageRevision.java new file mode 100644 index 0000000..aa7dd4d --- /dev/null +++ b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPageRevision.java @@ -0,0 +1,40 @@ +package eu.mulk.mulkcms2.benki.wiki; + +import eu.mulk.mulkcms2.benki.users.User; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.time.OffsetDateTime; +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 = "wiki_page_revisions", schema = "public", catalog = "benki") +public class WikiPageRevision extends PanacheEntityBase { + + @Id + @Column(name = "id", nullable = false) + public int id; + + @Column(name = "date", nullable = true) + public OffsetDateTime date; + + @Column(name = "title", nullable = true, length = -1) + public String title; + + @Column(name = "content", nullable = true, length = -1) + public String content; + + @Column(name = "format", nullable = true, length = -1) + public String format; + + @ManyToOne + @JoinColumn(name = "page", referencedColumnName = "id", nullable = false) + public WikiPage page; + + @ManyToOne + @JoinColumn(name = "author", referencedColumnName = "id") + public User author; +} diff --git a/src/main/java/eu/mulk/mulkcms2/cms/users/User.java b/src/main/java/eu/mulk/mulkcms2/cms/users/User.java index a84462f..9ac5da0 100644 --- a/src/main/java/eu/mulk/mulkcms2/cms/users/User.java +++ b/src/main/java/eu/mulk/mulkcms2/cms/users/User.java @@ -11,7 +11,7 @@ import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; -@Entity +@Entity(name = "CmsUser") @Table(name = "users", schema = "public", catalog = "mulkcms") public class User extends PanacheEntityBase { -- cgit v1.2.3