From 35cb159dcb78b6b14523dca5c041ef7dc1740906 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Fri, 24 Jan 2020 11:05:20 +0100 Subject: Benki: Simplify with Panache. Change-Id: I341a9d0ded3ee20e84841bf8494ef4d4eba55b74 --- src/main/java/eu/mulk/mulkcms2/benki/Bookmark.java | 113 ++------------------- .../java/eu/mulk/mulkcms2/benki/BookmarkTag.java | 59 +---------- .../mulk/mulkcms2/benki/EffectiveRoleSubrole.java | 53 +--------- .../eu/mulk/mulkcms2/benki/EffectiveUserRole.java | 53 +--------- .../eu/mulk/mulkcms2/benki/LazychatMessage.java | 98 ++---------------- .../eu/mulk/mulkcms2/benki/LazychatReference.java | 61 ++--------- src/main/java/eu/mulk/mulkcms2/benki/Openids.java | 45 +------- src/main/java/eu/mulk/mulkcms2/benki/PageKey.java | 59 +---------- src/main/java/eu/mulk/mulkcms2/benki/Post.java | 61 +---------- .../java/eu/mulk/mulkcms2/benki/PostTarget.java | 59 +---------- src/main/java/eu/mulk/mulkcms2/benki/Role.java | 107 ++----------------- .../java/eu/mulk/mulkcms2/benki/RoleSubrole.java | 68 ++----------- src/main/java/eu/mulk/mulkcms2/benki/RoleTag.java | 50 +-------- src/main/java/eu/mulk/mulkcms2/benki/RsaKey.java | 59 +---------- src/main/java/eu/mulk/mulkcms2/benki/User.java | 66 +++++------- .../eu/mulk/mulkcms2/benki/UserDefaultTarget.java | 68 ++----------- .../eu/mulk/mulkcms2/benki/UserEmailAddress.java | 45 +------- src/main/java/eu/mulk/mulkcms2/benki/UserJid.java | 59 +---------- .../java/eu/mulk/mulkcms2/benki/UserNickname.java | 45 +------- src/main/java/eu/mulk/mulkcms2/benki/UserRole.java | 68 ++----------- .../java/eu/mulk/mulkcms2/benki/UserRsaKey.java | 86 ++-------------- .../mulk/mulkcms2/benki/UserVisibleBookmark.java | 53 +--------- .../mulkcms2/benki/UserVisibleLazychatMessage.java | 53 +--------- .../eu/mulk/mulkcms2/benki/UserVisiblePost.java | 53 +--------- src/main/java/eu/mulk/mulkcms2/benki/WebId.java | 45 +------- src/main/java/eu/mulk/mulkcms2/benki/WikiPage.java | 45 +------- .../eu/mulk/mulkcms2/benki/WikiPageRevision.java | 112 ++------------------ 27 files changed, 174 insertions(+), 1569 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/mulk/mulkcms2/benki/Bookmark.java b/src/main/java/eu/mulk/mulkcms2/benki/Bookmark.java index efb81cb..220ebfa 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/Bookmark.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/Bookmark.java @@ -1,7 +1,7 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -12,123 +12,28 @@ import javax.persistence.Table; @Entity @Table(name = "bookmarks", schema = "public", catalog = "benki") -public class Bookmark { - - private int id; - private Object date; - private String uri; - private String title; - private String description; - private Collection tags; - private User owner; +public class Bookmark extends PanacheEntityBase { @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "date", nullable = true) - public Object getDate() { - return date; - } + public Object date; - public void setDate(Object date) { - this.date = date; - } - - @Basic @Column(name = "uri", nullable = false, length = -1) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } + public String uri; - @Basic @Column(name = "title", nullable = true, length = -1) - public String getTitle() { - return title; - } + public String title; - public void setTitle(String title) { - this.title = title; - } - - @Basic @Column(name = "description", nullable = true, length = -1) - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Bookmark bookmark = (Bookmark) o; - - if (id != bookmark.id) { - return false; - } - if (date != null ? !date.equals(bookmark.date) : bookmark.date != null) { - return false; - } - if (uri != null ? !uri.equals(bookmark.uri) : bookmark.uri != null) { - return false; - } - if (title != null ? !title.equals(bookmark.title) : bookmark.title != null) { - return false; - } - if (description != null ? !description.equals(bookmark.description) - : bookmark.description != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + (date != null ? date.hashCode() : 0); - result = 31 * result + (uri != null ? uri.hashCode() : 0); - result = 31 * result + (title != null ? title.hashCode() : 0); - result = 31 * result + (description != null ? description.hashCode() : 0); - return result; - } + public String description; @OneToMany(mappedBy = "bookmark") - public Collection getTags() { - return tags; - } - - public void setTags(Collection tags) { - this.tags = tags; - } + public Collection tags; @ManyToOne @JoinColumn(name = "owner", referencedColumnName = "id") - public User getOwner() { - return owner; - } - - public void setOwner(User owner) { - this.owner = owner; - } + 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 index 1de1f36..6efa87e 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/BookmarkTag.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/BookmarkTag.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -11,67 +12,17 @@ import javax.persistence.Table; @Entity @Table(name = "bookmark_tags", schema = "public", catalog = "benki") @IdClass(BookmarkTagPK.class) -public class BookmarkTag { - - private int bookmarkId; - private String tag; - private Bookmark bookmark; +public class BookmarkTag extends PanacheEntityBase { @Id @Column(name = "bookmark", nullable = false) - public int getBookmarkId() { - return bookmarkId; - } - - public void setBookmarkId(int bookmarkId) { - this.bookmarkId = bookmarkId; - } + public int bookmarkId; @Id @Column(name = "tag", nullable = false, length = -1) - 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; - } - - BookmarkTag that = (BookmarkTag) 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; - } + public String tag; @ManyToOne @JoinColumn(name = "bookmark", referencedColumnName = "id", nullable = false) - public Bookmark getBookmark() { - return bookmark; - } - - public void setBookmark(Bookmark bookmark) { - this.bookmark = bookmark; - } + public Bookmark bookmark; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/EffectiveRoleSubrole.java b/src/main/java/eu/mulk/mulkcms2/benki/EffectiveRoleSubrole.java index a72c9db..adc2a50 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/EffectiveRoleSubrole.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/EffectiveRoleSubrole.java @@ -1,62 +1,17 @@ package eu.mulk.mulkcms2.benki; -import javax.persistence.Basic; +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 { +public class EffectiveRoleSubrole extends PanacheEntityBase { - private Integer superroleId; - private Integer subroleId; - - @Basic @Column(name = "superrole", nullable = true) - public Integer getSuperroleId() { - return superroleId; - } - - public void setSuperroleId(Integer superroleId) { - this.superroleId = superroleId; - } + public Integer superroleId; - @Basic @Column(name = "subrole", nullable = true) - public Integer getSubroleId() { - return subroleId; - } - - public void setSubroleId(Integer subroleId) { - this.subroleId = subroleId; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - EffectiveRoleSubrole that = (EffectiveRoleSubrole) o; - - if (superroleId != null ? !superroleId.equals(that.superroleId) : that.superroleId != null) { - return false; - } - if (subroleId != null ? !subroleId.equals(that.subroleId) : that.subroleId != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = superroleId != null ? superroleId.hashCode() : 0; - result = 31 * result + (subroleId != null ? subroleId.hashCode() : 0); - return result; - } + 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 index 00c5738..fc2e453 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/EffectiveUserRole.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/EffectiveUserRole.java @@ -1,62 +1,17 @@ package eu.mulk.mulkcms2.benki; -import javax.persistence.Basic; +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 { +public class EffectiveUserRole extends PanacheEntityBase { - private Integer userId; - private Integer roleId; - - @Basic @Column(name = "user", nullable = true) - public Integer getUserId() { - return userId; - } - - public void setUserId(Integer userId) { - this.userId = userId; - } + public Integer userId; - @Basic @Column(name = "role", nullable = true) - public Integer getRoleId() { - return roleId; - } - - public void setRoleId(Integer roleId) { - this.roleId = roleId; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - EffectiveUserRole that = (EffectiveUserRole) o; - - if (userId != null ? !userId.equals(that.userId) : that.userId != null) { - return false; - } - if (roleId != null ? !roleId.equals(that.roleId) : that.roleId != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = userId != null ? userId.hashCode() : 0; - result = 31 * result + (roleId != null ? roleId.hashCode() : 0); - return result; - } + 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 index 97d3365..43363d2 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/LazychatMessage.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/LazychatMessage.java @@ -1,7 +1,7 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -12,107 +12,25 @@ import javax.persistence.Table; @Entity @Table(name = "lazychat_messages", schema = "public", catalog = "benki") -public class LazychatMessage { - - private int id; - private Object date; - private String content; - private String format; - private User owner; - private Collection references; +public class LazychatMessage extends PanacheEntityBase { @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "date", nullable = true) - public Object getDate() { - return date; - } - - public void setDate(Object date) { - this.date = date; - } + public Object date; - @Basic @Column(name = "content", nullable = true, length = -1) - public String getContent() { - return content; - } + public String content; - public void setContent(String content) { - this.content = content; - } - - @Basic @Column(name = "format", nullable = false, length = -1) - public String getFormat() { - return format; - } - - public void setFormat(String format) { - this.format = format; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - LazychatMessage that = (LazychatMessage) o; - - if (id != that.id) { - return false; - } - if (date != null ? !date.equals(that.date) : that.date != null) { - return false; - } - if (content != null ? !content.equals(that.content) : that.content != null) { - return false; - } - if (format != null ? !format.equals(that.format) : that.format != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + (date != null ? date.hashCode() : 0); - result = 31 * result + (content != null ? content.hashCode() : 0); - result = 31 * result + (format != null ? format.hashCode() : 0); - return result; - } + public String format; @ManyToOne @JoinColumn(name = "owner", referencedColumnName = "id") - public User getOwner() { - return owner; - } - - public void setOwner(User owner) { - this.owner = owner; - } + public User owner; @OneToMany(mappedBy = "referrer") - public Collection getReferences() { - return references; - } - - public void setReferences(Collection references) { - this.references = references; - } + 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 index 330e607..19803ba 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/LazychatReference.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/LazychatReference.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -11,67 +12,21 @@ import javax.persistence.Table; @Entity @Table(name = "lazychat_references", schema = "public", catalog = "benki") @IdClass(LazychatReferencePK.class) -public class LazychatReference { - - private int referrerId; - private int refereeId; - private LazychatMessage referrer; +public class LazychatReference extends PanacheEntityBase { @Id @Column(name = "referrer", nullable = false) - public int getReferrerId() { - return referrerId; - } - - public void setReferrerId(int referrerId) { - this.referrerId = referrerId; - } + public int referrerId; @Id @Column(name = "referee", nullable = false) - 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; - } - - LazychatReference that = (LazychatReference) 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; - } + public int refereeId; @ManyToOne @JoinColumn(name = "referrer", referencedColumnName = "id", nullable = false) - public LazychatMessage getReferrer() { - return referrer; - } + public LazychatMessage referrer; - public void setReferrer(LazychatMessage referrer) { - this.referrer = referrer; - } + @ManyToOne + @JoinColumn(name = "referee", referencedColumnName = "id", nullable = false) + public LazychatMessage referee; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/Openids.java b/src/main/java/eu/mulk/mulkcms2/benki/Openids.java index c56fe4c..d0551e4 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/Openids.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/Openids.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -7,51 +8,13 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @Entity -public class Openids { - - private String openid; - private User user; +public class Openids extends PanacheEntityBase { @Id @Column(name = "openid", nullable = false, length = -1) - public String getOpenid() { - return openid; - } - - public void setOpenid(String openid) { - this.openid = openid; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Openids openids = (Openids) o; - - if (openid != null ? !openid.equals(openids.openid) : openids.openid != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - return openid != null ? openid.hashCode() : 0; - } + public String openid; @ManyToOne @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/PageKey.java b/src/main/java/eu/mulk/mulkcms2/benki/PageKey.java index 1423e00..26c1d57 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/PageKey.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/PageKey.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.math.BigInteger; import javax.persistence.Column; import javax.persistence.Entity; @@ -12,67 +13,17 @@ import javax.persistence.Table; @Entity @Table(name = "page_keys", schema = "public", catalog = "benki") @IdClass(PageKeyPK.class) -public class PageKey { - - private String page; - private BigInteger key; - private User user; +public class PageKey extends PanacheEntityBase { @Id @Column(name = "page", nullable = false, length = -1) - public String getPage() { - return page; - } - - public void setPage(String page) { - this.page = page; - } + public String page; @Id @Column(name = "key", nullable = false, precision = 0) - 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; - } - - PageKey pageKey = (PageKey) o; - - if (page != null ? !page.equals(pageKey.page) : pageKey.page != null) { - return false; - } - if (key != null ? !key.equals(pageKey.key) : pageKey.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; - } + public BigInteger key; @ManyToOne @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/Post.java b/src/main/java/eu/mulk/mulkcms2/benki/Post.java index ba448c6..2fc6b05 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/Post.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/Post.java @@ -1,6 +1,6 @@ package eu.mulk.mulkcms2.benki; -import javax.persistence.Basic; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -10,67 +10,16 @@ import javax.persistence.Table; @Entity @Table(name = "posts", schema = "public", catalog = "benki") -public class Post { - - private int id; - private Object date; - private User owner; +public class Post extends PanacheEntityBase { @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "date", nullable = true) - public Object getDate() { - return date; - } - - public void setDate(Object date) { - this.date = date; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Post post = (Post) o; - - if (id != post.id) { - return false; - } - if (date != null ? !date.equals(post.date) : post.date != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + (date != null ? date.hashCode() : 0); - return result; - } + public Object date; @ManyToOne @JoinColumn(name = "owner", referencedColumnName = "id") - public User getOwner() { - return owner; - } - - public void setOwner(User owner) { - this.owner = owner; - } + 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 index 5a01cfa..d785d78 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/PostTarget.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/PostTarget.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -11,67 +12,17 @@ import javax.persistence.Table; @Entity @Table(name = "post_targets", schema = "public", catalog = "benki") @IdClass(PostTargetPK.class) -public class PostTarget { - - private int message; - private int targetId; - private Role target; +public class PostTarget extends PanacheEntityBase { @Id @Column(name = "message", nullable = false) - public int getMessage() { - return message; - } - - public void setMessage(int message) { - this.message = message; - } + public int message; @Id @Column(name = "target", nullable = false) - 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; - } - - PostTarget that = (PostTarget) 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; - } + public int targetId; @ManyToOne @JoinColumn(name = "target", referencedColumnName = "id", nullable = false) - public Role getTarget() { - return target; - } - - public void setTarget(Role target) { - this.target = target; - } + public Role target; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/Role.java b/src/main/java/eu/mulk/mulkcms2/benki/Role.java index ea1c388..48bd042 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/Role.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/Role.java @@ -1,7 +1,7 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -10,117 +10,30 @@ import javax.persistence.Table; @Entity @Table(name = "roles", schema = "public", catalog = "benki") -public class Role { - - private int id; - private String name; - private Collection targetedPosts; - private Collection subroles; - private Collection superroles; - private Collection usersUsedByAsDefaultTarget; - private Collection users; - private Collection owningUsers; +public class Role extends PanacheEntityBase { @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "name", nullable = true, length = -1) - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Role role = (Role) o; - - if (id != role.id) { - return false; - } - if (name != null ? !name.equals(role.name) : role.name != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + (name != null ? name.hashCode() : 0); - return result; - } + public String name; @OneToMany(mappedBy = "target") - public Collection getTargetedPosts() { - return targetedPosts; - } - - public void setTargetedPosts(Collection targetedPosts) { - this.targetedPosts = targetedPosts; - } + public Collection targetedPosts; @OneToMany(mappedBy = "superrole") - public Collection getSubroles() { - return subroles; - } - - public void setSubroles(Collection subroles) { - this.subroles = subroles; - } + public Collection subroles; @OneToMany(mappedBy = "subrole") - public Collection getSuperroles() { - return superroles; - } - - public void setSuperroles(Collection superroles) { - this.superroles = superroles; - } + public Collection superroles; @OneToMany(mappedBy = "target") - public Collection getUsersUsedByAsDefaultTarget() { - return usersUsedByAsDefaultTarget; - } - - public void setUsersUsedByAsDefaultTarget( - Collection usersUsedByAsDefaultTarget) { - this.usersUsedByAsDefaultTarget = usersUsedByAsDefaultTarget; - } + public Collection usersUsedByAsDefaultTarget; @OneToMany(mappedBy = "role") - public Collection getUsers() { - return users; - } - - public void setUsers(Collection users) { - this.users = users; - } + public Collection users; @OneToMany(mappedBy = "ownedRole") - public Collection getOwningUsers() { - return owningUsers; - } - - public void setOwningUsers(Collection owningUsers) { - this.owningUsers = owningUsers; - } + 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 index 12c68ca..0be5493 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/RoleSubrole.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/RoleSubrole.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -11,78 +12,21 @@ import javax.persistence.Table; @Entity @Table(name = "role_subroles", schema = "public", catalog = "benki") @IdClass(RoleSubrolePK.class) -public class RoleSubrole { - - private int superroleId; - private int subroleId; - private Role superrole; - private Role subrole; +public class RoleSubrole extends PanacheEntityBase { @Id @Column(name = "superrole", nullable = false) - public int getSuperroleId() { - return superroleId; - } - - public void setSuperroleId(int superroleId) { - this.superroleId = superroleId; - } + public int superroleId; @Id @Column(name = "subrole", nullable = false) - 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; - } - - RoleSubrole that = (RoleSubrole) 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; - } + public int subroleId; @ManyToOne @JoinColumn(name = "superrole", referencedColumnName = "id", nullable = false) - public Role getSuperrole() { - return superrole; - } - - public void setSuperrole(Role superrole) { - this.superrole = superrole; - } + public Role superrole; @ManyToOne @JoinColumn(name = "subrole", referencedColumnName = "id", nullable = false) - public Role getSubrole() { - return subrole; - } - - public void setSubrole(Role subrole) { - this.subrole = subrole; - } + public Role subrole; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/RoleTag.java b/src/main/java/eu/mulk/mulkcms2/benki/RoleTag.java index a51bf9c..9bc72c4 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/RoleTag.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/RoleTag.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -9,56 +10,13 @@ import javax.persistence.Table; @Entity @Table(name = "role_tags", schema = "public", catalog = "benki") @IdClass(RoleTagPK.class) -public class RoleTag { - - private int roleId; - private String tag; +public class RoleTag extends PanacheEntityBase { @Id @Column(name = "role", nullable = false) - public int getRoleId() { - return roleId; - } - - public void setRoleId(int roleId) { - this.roleId = roleId; - } + public int roleId; @Id @Column(name = "tag", nullable = false, length = -1) - 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; - } - - RoleTag roleTag = (RoleTag) o; - - if (roleId != roleTag.roleId) { - return false; - } - if (tag != null ? !tag.equals(roleTag.tag) : roleTag.tag != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = roleId; - result = 31 * result + (tag != null ? tag.hashCode() : 0); - return result; - } + public String tag; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/RsaKey.java b/src/main/java/eu/mulk/mulkcms2/benki/RsaKey.java index f2bbb8a..d3da90e 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/RsaKey.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/RsaKey.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.math.BigInteger; import java.util.Collection; import javax.persistence.Column; @@ -12,66 +13,16 @@ import javax.persistence.Table; @Entity @Table(name = "rsa_keys", schema = "public", catalog = "benki") @IdClass(RsaKeyPK.class) -public class RsaKey { - - private BigInteger modulus; - private BigInteger exponent; - private Collection users; +public class RsaKey extends PanacheEntityBase { @Id @Column(name = "modulus", nullable = false, precision = 0) - public BigInteger getModulus() { - return modulus; - } - - public void setModulus(BigInteger modulus) { - this.modulus = modulus; - } + public BigInteger modulus; @Id @Column(name = "exponent", nullable = false, precision = 0) - 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; - } - - RsaKey rsaKey = (RsaKey) o; - - if (modulus != null ? !modulus.equals(rsaKey.modulus) : rsaKey.modulus != null) { - return false; - } - if (exponent != null ? !exponent.equals(rsaKey.exponent) : rsaKey.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; - } + public BigInteger exponent; @OneToMany(mappedBy = "rsaKey") - public Collection getUsers() { - return users; - } - - public void setUsers(Collection users) { - this.users = users; - } + public Collection users; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/User.java b/src/main/java/eu/mulk/mulkcms2/benki/User.java index c1160f5..cabd91f 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/User.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/User.java @@ -1,7 +1,7 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; -import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -12,29 +12,29 @@ import javax.persistence.Table; @Entity @Table(name = "users", schema = "public", catalog = "benki") -public class User { - - private int id; - private String firstName; - private String middleNames; - private String lastName; - private String email; - private String website; - private String status; - private Collection bookmarks; - private Collection lazychatMessages; - private Collection openids; - private Collection pageKeys; - private Collection posts; - private Collection defaultTargets; - private Collection emailAddresses; - private Collection jids; - private Collection nicknames; - private Collection roles; - private Collection rsaKeys; - private Role ownedRole; - private Collection webids; - private Collection wikiPageRevisions; +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) @@ -46,7 +46,6 @@ public class User { this.id = id; } - @Basic @Column(name = "first_name", nullable = true, length = -1) public String getFirstName() { return firstName; @@ -56,7 +55,6 @@ public class User { this.firstName = firstName; } - @Basic @Column(name = "middle_names", nullable = true, length = -1) public String getMiddleNames() { return middleNames; @@ -66,7 +64,6 @@ public class User { this.middleNames = middleNames; } - @Basic @Column(name = "last_name", nullable = true, length = -1) public String getLastName() { return lastName; @@ -76,7 +73,6 @@ public class User { this.lastName = lastName; } - @Basic @Column(name = "email", nullable = true, length = -1) public String getEmail() { return email; @@ -86,7 +82,6 @@ public class User { this.email = email; } - @Basic @Column(name = "website", nullable = true, length = -1) public String getWebsite() { return website; @@ -96,7 +91,6 @@ public class User { this.website = website; } - @Basic @Column(name = "status", nullable = true, length = -1) public String getStatus() { return status; @@ -168,8 +162,7 @@ public class User { return lazychatMessages; } - public void setLazychatMessages( - Collection lazychatMessages) { + public void setLazychatMessages(Collection lazychatMessages) { this.lazychatMessages = lazychatMessages; } @@ -205,8 +198,7 @@ public class User { return defaultTargets; } - public void setDefaultTargets( - Collection defaultTargets) { + public void setDefaultTargets(Collection defaultTargets) { this.defaultTargets = defaultTargets; } @@ -215,8 +207,7 @@ public class User { return emailAddresses; } - public void setEmailAddresses( - Collection emailAddresses) { + public void setEmailAddresses(Collection emailAddresses) { this.emailAddresses = emailAddresses; } @@ -280,8 +271,7 @@ public class User { return wikiPageRevisions; } - public void setWikiPageRevisions( - Collection 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 index 40c0082..4989023 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserDefaultTarget.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/UserDefaultTarget.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -11,78 +12,21 @@ import javax.persistence.Table; @Entity @Table(name = "user_default_target", schema = "public", catalog = "benki") @IdClass(UserDefaultTargetPK.class) -public class UserDefaultTarget { - - private int userId; - private int targetId; - private User user; - private Role target; +public class UserDefaultTarget extends PanacheEntityBase { @Id @Column(name = "user", nullable = false) - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } + public int userId; @Id @Column(name = "target", nullable = false) - 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; - } - - UserDefaultTarget that = (UserDefaultTarget) 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; - } + public int targetId; @ManyToOne @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + public User user; @ManyToOne @JoinColumn(name = "target", referencedColumnName = "id", nullable = false) - public Role getTarget() { - return target; - } - - public void setTarget(Role target) { - this.target = target; - } + public Role target; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserEmailAddress.java b/src/main/java/eu/mulk/mulkcms2/benki/UserEmailAddress.java index 03f2a0f..3341687 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserEmailAddress.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/UserEmailAddress.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -9,51 +10,13 @@ import javax.persistence.Table; @Entity @Table(name = "user_email_addresses", schema = "public", catalog = "benki") -public class UserEmailAddress { - - private String email; - private User user; +public class UserEmailAddress extends PanacheEntityBase { @Id @Column(name = "email", nullable = false, length = -1) - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - UserEmailAddress that = (UserEmailAddress) o; - - if (email != null ? !email.equals(that.email) : that.email != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - return email != null ? email.hashCode() : 0; - } + public String email; @ManyToOne @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserJid.java b/src/main/java/eu/mulk/mulkcms2/benki/UserJid.java index 468b95a..c32d547 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserJid.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/UserJid.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -11,67 +12,17 @@ import javax.persistence.Table; @Entity @Table(name = "user_jids", schema = "public", catalog = "benki") @IdClass(UserJidPK.class) -public class UserJid { - - private int userId; - private String jid; - private User user; +public class UserJid extends PanacheEntityBase { @Id @Column(name = "user", nullable = false) - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } + public int userId; @Id @Column(name = "jid", nullable = false, length = -1) - 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; - } - - UserJid userJid = (UserJid) o; - - if (userId != userJid.userId) { - return false; - } - if (jid != null ? !jid.equals(userJid.jid) : userJid.jid != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = userId; - result = 31 * result + (jid != null ? jid.hashCode() : 0); - return result; - } + public String jid; @ManyToOne @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserNickname.java b/src/main/java/eu/mulk/mulkcms2/benki/UserNickname.java index a6161cc..7bfed4e 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserNickname.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/UserNickname.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -9,51 +10,13 @@ import javax.persistence.Table; @Entity @Table(name = "user_nicknames", schema = "public", catalog = "benki") -public class UserNickname { - - private String nickname; - private User user; +public class UserNickname extends PanacheEntityBase { @Id @Column(name = "nickname", nullable = false, length = -1) - public String getNickname() { - return nickname; - } - - public void setNickname(String nickname) { - this.nickname = nickname; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - UserNickname that = (UserNickname) o; - - if (nickname != null ? !nickname.equals(that.nickname) : that.nickname != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - return nickname != null ? nickname.hashCode() : 0; - } + public String nickname; @ManyToOne @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserRole.java b/src/main/java/eu/mulk/mulkcms2/benki/UserRole.java index f87b9e4..f735d6c 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserRole.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/UserRole.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -11,78 +12,21 @@ import javax.persistence.Table; @Entity @Table(name = "user_roles", schema = "public", catalog = "benki") @IdClass(UserRolePK.class) -public class UserRole { - - private int userId; - private int roleId; - private User user; - private Role role; +public class UserRole extends PanacheEntityBase { @Id @Column(name = "user", nullable = false) - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } + public int userId; @Id @Column(name = "role", nullable = false) - 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; - } - - UserRole userRole = (UserRole) o; - - if (userId != userRole.userId) { - return false; - } - if (roleId != userRole.roleId) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = userId; - result = 31 * result + roleId; - return result; - } + public int roleId; @ManyToOne @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + public User user; @ManyToOne @JoinColumn(name = "role", referencedColumnName = "id", nullable = false) - public Role getRole() { - return role; - } - - public void setRole(Role role) { - this.role = role; - } + public Role role; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/UserRsaKey.java b/src/main/java/eu/mulk/mulkcms2/benki/UserRsaKey.java index 24aff81..f35afdd 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserRsaKey.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/UserRsaKey.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.math.BigInteger; import javax.persistence.Column; import javax.persistence.Entity; @@ -13,95 +14,28 @@ import javax.persistence.Table; @Entity @Table(name = "user_rsa_keys", schema = "public", catalog = "benki") @IdClass(UserRsaKeyPK.class) -public class UserRsaKey { - - private int userId; - private BigInteger modulus; - private BigInteger exponent; - private User user; - private RsaKey rsaKey; +public class UserRsaKey extends PanacheEntityBase { @Id @Column(name = "user", nullable = false) - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } + public int userId; @Id @Column(name = "modulus", nullable = false, precision = 0) - public BigInteger getModulus() { - return modulus; - } - - public void setModulus(BigInteger modulus) { - this.modulus = modulus; - } + public BigInteger modulus; @Id @Column(name = "exponent", nullable = false, precision = 0) - 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; - } - - UserRsaKey that = (UserRsaKey) 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; - } + public BigInteger exponent; @ManyToOne @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + public User user; @ManyToOne @JoinColumns({ - @JoinColumn(name = "modulus", referencedColumnName = "modulus", nullable = false), - @JoinColumn(name = "exponent", referencedColumnName = "exponent", nullable = false)}) - public RsaKey getRsaKey() { - return rsaKey; - } - - public void setRsaKey(RsaKey rsaKey) { - this.rsaKey = rsaKey; - } + @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/UserVisibleBookmark.java b/src/main/java/eu/mulk/mulkcms2/benki/UserVisibleBookmark.java index 5d5cada..ae5d52e 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserVisibleBookmark.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/UserVisibleBookmark.java @@ -1,62 +1,17 @@ package eu.mulk.mulkcms2.benki; -import javax.persistence.Basic; +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 { +public class UserVisibleBookmark extends PanacheEntityBase { - private Integer userId; - private Integer messageId; - - @Basic @Column(name = "user", nullable = true) - public Integer getUserId() { - return userId; - } - - public void setUserId(Integer userId) { - this.userId = userId; - } + public Integer userId; - @Basic @Column(name = "message", nullable = true) - public Integer getMessageId() { - return messageId; - } - - public void setMessageId(Integer messageId) { - this.messageId = messageId; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - UserVisibleBookmark that = (UserVisibleBookmark) o; - - if (userId != null ? !userId.equals(that.userId) : that.userId != null) { - return false; - } - if (messageId != null ? !messageId.equals(that.messageId) : that.messageId != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = userId != null ? userId.hashCode() : 0; - result = 31 * result + (messageId != null ? messageId.hashCode() : 0); - return result; - } + 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 index 8f5f2ac..d57dca5 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserVisibleLazychatMessage.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/UserVisibleLazychatMessage.java @@ -1,62 +1,17 @@ package eu.mulk.mulkcms2.benki; -import javax.persistence.Basic; +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 { +public class UserVisibleLazychatMessage extends PanacheEntityBase { - private Integer userId; - private Integer messageId; - - @Basic @Column(name = "user", nullable = true) - public Integer getUserId() { - return userId; - } - - public void setUserId(Integer userId) { - this.userId = userId; - } + public Integer userId; - @Basic @Column(name = "message", nullable = true) - public Integer getMessageId() { - return messageId; - } - - public void setMessageId(Integer messageId) { - this.messageId = messageId; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - UserVisibleLazychatMessage that = (UserVisibleLazychatMessage) o; - - if (userId != null ? !userId.equals(that.userId) : that.userId != null) { - return false; - } - if (messageId != null ? !messageId.equals(that.messageId) : that.messageId != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = userId != null ? userId.hashCode() : 0; - result = 31 * result + (messageId != null ? messageId.hashCode() : 0); - return result; - } + 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 index 06862c5..62833e6 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/UserVisiblePost.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/UserVisiblePost.java @@ -1,62 +1,17 @@ package eu.mulk.mulkcms2.benki; -import javax.persistence.Basic; +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 { +public class UserVisiblePost extends PanacheEntityBase { - private Integer userId; - private Integer messageId; - - @Basic @Column(name = "user", nullable = true) - public Integer getUserId() { - return userId; - } - - public void setUserId(Integer userId) { - this.userId = userId; - } + public Integer userId; - @Basic @Column(name = "message", nullable = true) - public Integer getMessageId() { - return messageId; - } - - public void setMessageId(Integer messageId) { - this.messageId = messageId; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - UserVisiblePost that = (UserVisiblePost) o; - - if (userId != null ? !userId.equals(that.userId) : that.userId != null) { - return false; - } - if (messageId != null ? !messageId.equals(that.messageId) : that.messageId != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = userId != null ? userId.hashCode() : 0; - result = 31 * result + (messageId != null ? messageId.hashCode() : 0); - return result; - } + 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 index a1a1cf2..476d91f 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/WebId.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/WebId.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -9,51 +10,13 @@ import javax.persistence.Table; @Entity @Table(name = "webids", schema = "public", catalog = "benki") -public class WebId { - - private String webid; - private User user; +public class WebId extends PanacheEntityBase { @Id @Column(name = "webid", nullable = false, length = -1) - public String getWebid() { - return webid; - } - - public void setWebid(String webid) { - this.webid = webid; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - WebId webId = (WebId) o; - - if (webid != null ? !webid.equals(webId.webid) : webId.webid != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - return webid != null ? webid.hashCode() : 0; - } + public String webid; @ManyToOne @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/WikiPage.java b/src/main/java/eu/mulk/mulkcms2/benki/WikiPage.java index 4b8c3ad..169c70a 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/WikiPage.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/WikiPage.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; @@ -9,50 +10,12 @@ import javax.persistence.Table; @Entity @Table(name = "wiki_pages", schema = "public", catalog = "benki") -public class WikiPage { - - private int id; - private Collection revisions; +public class WikiPage extends PanacheEntityBase { @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - WikiPage wikiPage = (WikiPage) o; - - if (id != wikiPage.id) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - return id; - } + public int id; @OneToMany(mappedBy = "page") - public Collection getRevisions() { - return revisions; - } - - public void setRevisions(Collection revisions) { - this.revisions = revisions; - } + 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 index 58bf520..c0e8cfc 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/WikiPageRevision.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/WikiPageRevision.java @@ -1,6 +1,6 @@ package eu.mulk.mulkcms2.benki; -import javax.persistence.Basic; +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -10,123 +10,29 @@ import javax.persistence.Table; @Entity @Table(name = "wiki_page_revisions", schema = "public", catalog = "benki") -public class WikiPageRevision { - - private int id; - private Object date; - private String title; - private String content; - private String format; - private WikiPage page; - private User author; +public class WikiPageRevision extends PanacheEntityBase { @Id @Column(name = "id", nullable = false) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } + public int id; - @Basic @Column(name = "date", nullable = true) - public Object getDate() { - return date; - } + public Object date; - public void setDate(Object date) { - this.date = date; - } - - @Basic @Column(name = "title", nullable = true, length = -1) - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } + public String title; - @Basic @Column(name = "content", nullable = true, length = -1) - public String getContent() { - return content; - } + public String content; - public void setContent(String content) { - this.content = content; - } - - @Basic @Column(name = "format", nullable = true, length = -1) - public String getFormat() { - return format; - } - - public void setFormat(String format) { - this.format = format; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - WikiPageRevision that = (WikiPageRevision) o; - - if (id != that.id) { - return false; - } - if (date != null ? !date.equals(that.date) : that.date != null) { - return false; - } - if (title != null ? !title.equals(that.title) : that.title != null) { - return false; - } - if (content != null ? !content.equals(that.content) : that.content != null) { - return false; - } - if (format != null ? !format.equals(that.format) : that.format != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + (date != null ? date.hashCode() : 0); - result = 31 * result + (title != null ? title.hashCode() : 0); - result = 31 * result + (content != null ? content.hashCode() : 0); - result = 31 * result + (format != null ? format.hashCode() : 0); - return result; - } + public String format; @ManyToOne @JoinColumn(name = "page", referencedColumnName = "id", nullable = false) - public WikiPage getPage() { - return page; - } - - public void setPage(WikiPage page) { - this.page = page; - } + public WikiPage page; @ManyToOne @JoinColumn(name = "author", referencedColumnName = "id") - public User getAuthor() { - return author; - } - - public void setAuthor(User author) { - this.author = author; - } + public User author; } -- cgit v1.2.3