diff options
Diffstat (limited to 'src/main')
45 files changed, 360 insertions, 432 deletions
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/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<Bookmark> bookmarks; - public Collection<LazychatMessage> lazychatMessages; - public Collection<Openids> openids; - public Collection<PageKey> pageKeys; - public Collection<Post> posts; - public Collection<UserDefaultTarget> defaultTargets; - public Collection<UserEmailAddress> emailAddresses; - public Collection<UserJid> jids; - public Collection<UserNickname> nicknames; - public Collection<UserRole> roles; - public Collection<UserRsaKey> rsaKeys; - public Role ownedRole; - public Collection<WebId> webids; - public Collection<WikiPageRevision> 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<Bookmark> getBookmarks() { - return bookmarks; - } - - public void setBookmarks(Collection<Bookmark> bookmarks) { - this.bookmarks = bookmarks; - } - - @OneToMany(mappedBy = "owner") - public Collection<LazychatMessage> getLazychatMessages() { - return lazychatMessages; - } - - public void setLazychatMessages(Collection<LazychatMessage> lazychatMessages) { - this.lazychatMessages = lazychatMessages; - } - - @OneToMany(mappedBy = "user") - public Collection<Openids> getOpenids() { - return openids; - } - - public void setOpenids(Collection<Openids> openids) { - this.openids = openids; - } - - @OneToMany(mappedBy = "user") - public Collection<PageKey> getPageKeys() { - return pageKeys; - } - - public void setPageKeys(Collection<PageKey> pageKeys) { - this.pageKeys = pageKeys; - } - - @OneToMany(mappedBy = "owner") - public Collection<Post> getPosts() { - return posts; - } - - public void setPosts(Collection<Post> posts) { - this.posts = posts; - } - - @OneToMany(mappedBy = "user") - public Collection<UserDefaultTarget> getDefaultTargets() { - return defaultTargets; - } - - public void setDefaultTargets(Collection<UserDefaultTarget> defaultTargets) { - this.defaultTargets = defaultTargets; - } - - @OneToMany(mappedBy = "user") - public Collection<UserEmailAddress> getEmailAddresses() { - return emailAddresses; - } - - public void setEmailAddresses(Collection<UserEmailAddress> emailAddresses) { - this.emailAddresses = emailAddresses; - } - - @OneToMany(mappedBy = "user") - public Collection<UserJid> getJids() { - return jids; - } - - public void setJids(Collection<UserJid> jids) { - this.jids = jids; - } - - @OneToMany(mappedBy = "user") - public Collection<UserNickname> getNicknames() { - return nicknames; - } - - public void setNicknames(Collection<UserNickname> nicknames) { - this.nicknames = nicknames; - } - - @OneToMany(mappedBy = "user") - public Collection<UserRole> getRoles() { - return roles; - } - - public void setRoles(Collection<UserRole> roles) { - this.roles = roles; - } - - @OneToMany(mappedBy = "user") - public Collection<UserRsaKey> getRsaKeys() { - return rsaKeys; - } - - public void setRsaKeys(Collection<UserRsaKey> 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<WebId> getWebids() { - return webids; - } - - public void setWebids(Collection<WebId> webids) { - this.webids = webids; - } - - @OneToMany(mappedBy = "author") - public Collection<WikiPageRevision> getWikiPageRevisions() { - return wikiPageRevisions; - } - - public void setWikiPageRevisions(Collection<WikiPageRevision> wikiPageRevisions) { - this.wikiPageRevisions = wikiPageRevisions; - } -} 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/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/PageKey.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKey.java index 26c1d57..679c25d 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/PageKey.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKey.java @@ -1,5 +1,6 @@ -package eu.mulk.mulkcms2.benki; +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; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/PageKeyPK.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKeyPK.java index dea94ed..e80cb5e 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/PageKeyPK.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKeyPK.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.accesscontrol; import java.io.Serializable; import java.math.BigInteger; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/Role.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/Role.java index 48bd042..090fb92 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/Role.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/Role.java @@ -1,5 +1,9 @@ -package eu.mulk.mulkcms2.benki; +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; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/RoleSubrole.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrole.java index 0be5493..5e7b237 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/RoleSubrole.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrole.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.accesscontrol; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/RoleSubrolePK.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrolePK.java index cf36115..f74d98b 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/RoleSubrolePK.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrolePK.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.accesscontrol; import java.io.Serializable; import javax.persistence.Column; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/RoleTag.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleTag.java index 9bc72c4..5dbda68 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/RoleTag.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleTag.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.accesscontrol; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/RoleTagPK.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleTagPK.java index e406e10..5b32f81 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/RoleTagPK.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleTagPK.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.accesscontrol; import java.io.Serializable; import javax.persistence.Column; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/Bookmark.java b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/Bookmark.java index 220ebfa..121e340 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/Bookmark.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/Bookmark.java @@ -1,25 +1,15 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.bookmarx; -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import eu.mulk.mulkcms2.benki.generic.Post; 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; +public class Bookmark extends Post { @Column(name = "uri", nullable = false, length = -1) public String uri; @@ -32,8 +22,4 @@ public class Bookmark extends PanacheEntityBase { @OneToMany(mappedBy = "bookmark") public Collection<BookmarkTag> 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/bookmarx/BookmarkTag.java index 6efa87e..cca5478 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/BookmarkTag.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTag.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.bookmarx; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/BookmarkTagPK.java b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTagPK.java index 89e7fb9..876648d 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/BookmarkTagPK.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTagPK.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.bookmarx; import java.io.Serializable; import javax.persistence.Column; 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/Post.java b/src/main/java/eu/mulk/mulkcms2/benki/generic/Post.java index 2fc6b05..050cdcb 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/Post.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/generic/Post.java @@ -1,23 +1,28 @@ -package eu.mulk.mulkcms2.benki; +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") -public class Post extends PanacheEntityBase { +@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 Object date; + public OffsetDateTime date; @ManyToOne @JoinColumn(name = "owner", referencedColumnName = "id") diff --git a/src/main/java/eu/mulk/mulkcms2/benki/PostTarget.java b/src/main/java/eu/mulk/mulkcms2/benki/generic/PostTarget.java index d785d78..3a3f6b2 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/PostTarget.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/generic/PostTarget.java @@ -1,5 +1,6 @@ -package eu.mulk.mulkcms2.benki; +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; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/PostTargetPK.java b/src/main/java/eu/mulk/mulkcms2/benki/generic/PostTargetPK.java index 0189837..13c660d 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/PostTargetPK.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/generic/PostTargetPK.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.generic; import java.io.Serializable; import javax.persistence.Column; 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/LazychatMessage.java b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatMessage.java index 43363d2..626f263 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/LazychatMessage.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatMessage.java @@ -1,25 +1,15 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.lafargue; -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import eu.mulk.mulkcms2.benki.generic.Post; 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; +public class LazychatMessage extends Post { @Column(name = "content", nullable = true, length = -1) public String content; @@ -27,10 +17,6 @@ public class LazychatMessage extends PanacheEntityBase { @Column(name = "format", nullable = false, length = -1) public String format; - @ManyToOne - @JoinColumn(name = "owner", referencedColumnName = "id") - public User owner; - @OneToMany(mappedBy = "referrer") public Collection<LazychatReference> references; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/LazychatReference.java b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReference.java index 19803ba..d1e8910 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/LazychatReference.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReference.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.lafargue; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/LazychatReferencePK.java b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReferencePK.java index c7eefc0..6e2d965 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/LazychatReferencePK.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReferencePK.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.lafargue; import java.io.Serializable; import javax.persistence.Column; 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/Openids.java b/src/main/java/eu/mulk/mulkcms2/benki/users/Openids.java index d0551e4..925584b 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/Openids.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/Openids.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.users; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/RsaKey.java b/src/main/java/eu/mulk/mulkcms2/benki/users/RsaKey.java index d3da90e..6e3db81 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/RsaKey.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/RsaKey.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.users; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.math.BigInteger; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/RsaKeyPK.java b/src/main/java/eu/mulk/mulkcms2/benki/users/RsaKeyPK.java index 41a332d..5b33ec8 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/RsaKeyPK.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/RsaKeyPK.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.users; import java.io.Serializable; import java.math.BigInteger; 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<Bookmark> bookmarks; + + @OneToMany(mappedBy = "owner") + public Collection<LazychatMessage> lazychatMessages; + + @OneToMany(mappedBy = "user") + public Collection<Openids> openids; + + @OneToMany(mappedBy = "user") + public Collection<PageKey> pageKeys; + + @OneToMany(mappedBy = "owner") + public Collection<Post> posts; + + @OneToMany(mappedBy = "user") + public Collection<UserDefaultTarget> defaultTargets; + + @OneToMany(mappedBy = "user") + public Collection<UserEmailAddress> emailAddresses; + + @OneToMany(mappedBy = "user") + public Collection<UserJid> jids; + + @OneToMany(mappedBy = "user") + public Collection<UserNickname> nicknames; + + @OneToMany(mappedBy = "user") + public Collection<UserRole> roles; + + @OneToMany(mappedBy = "user") + public Collection<UserRsaKey> rsaKeys; + + @ManyToOne + @JoinColumn(name = "role", referencedColumnName = "id", nullable = false) + public Role ownedRole; + + @OneToMany(mappedBy = "user") + public Collection<WebId> webids; + + @OneToMany(mappedBy = "author") + public Collection<WikiPageRevision> wikiPageRevisions; +} diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserDefaultTarget.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTarget.java index 4989023..ffa5ef7 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserDefaultTarget.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTarget.java @@ -1,5 +1,6 @@ -package eu.mulk.mulkcms2.benki; +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; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserDefaultTargetPK.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTargetPK.java index e7e080f..4a41e7b 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserDefaultTargetPK.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTargetPK.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.users; import java.io.Serializable; import javax.persistence.Column; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserEmailAddress.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserEmailAddress.java index 3341687..9706407 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserEmailAddress.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserEmailAddress.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.users; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserJid.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserJid.java index c32d547..1c17ca8 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserJid.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserJid.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.users; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserJidPK.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserJidPK.java index f033723..19eeaeb 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserJidPK.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserJidPK.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.users; import java.io.Serializable; import javax.persistence.Column; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserNickname.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserNickname.java index 7bfed4e..b664cb9 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserNickname.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserNickname.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.users; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserRole.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRole.java index f735d6c..d4c10bd 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserRole.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRole.java @@ -1,5 +1,6 @@ -package eu.mulk.mulkcms2.benki; +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; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserRolePK.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRolePK.java index 6181b8b..5649ff4 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserRolePK.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRolePK.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.users; import java.io.Serializable; import javax.persistence.Column; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserRsaKey.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKey.java index f35afdd..33552e5 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserRsaKey.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKey.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.users; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.math.BigInteger; @@ -34,8 +34,18 @@ public class UserRsaKey extends PanacheEntityBase { @ManyToOne @JoinColumns({ - @JoinColumn(name = "modulus", referencedColumnName = "modulus", nullable = false), - @JoinColumn(name = "exponent", referencedColumnName = "exponent", nullable = false) + @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/UserRsaKeyPK.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKeyPK.java index 4c146ae..adcaeb6 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserRsaKeyPK.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKeyPK.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.users; import java.io.Serializable; import java.math.BigInteger; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/WebId.java b/src/main/java/eu/mulk/mulkcms2/benki/users/WebId.java index 476d91f..0a30ff1 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/WebId.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/WebId.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.users; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/WikiPage.java b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPage.java index 169c70a..e2e5b13 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/WikiPage.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPage.java @@ -1,4 +1,4 @@ -package eu.mulk.mulkcms2.benki; +package eu.mulk.mulkcms2.benki.wiki; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/WikiPageRevision.java b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPageRevision.java index c0e8cfc..aa7dd4d 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/WikiPageRevision.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPageRevision.java @@ -1,6 +1,8 @@ -package eu.mulk.mulkcms2.benki; +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; @@ -17,7 +19,7 @@ public class WikiPageRevision extends PanacheEntityBase { public int id; @Column(name = "date", nullable = true) - public Object date; + public OffsetDateTime date; @Column(name = "title", nullable = true, length = -1) public String title; 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 { |