Base of everything members write into the social features: comments, forum topics and forum replies. It is abstract and mapped as a joined inheritance hierarchy, so every row is really one of its subclasses and postType says which. It carries the common fields: who posted, when, the text in notes, the owning website and admin organisation, the running vote total, abuse reports, and an optional parent post for threading. Deletion is soft, so a deleted post keeps its row with the deleted flag set, and the finders skip flagged rows. A post can also be linked back to whatever produced it through the related app name and related id.
Group: Database Entities
Implements: Serializable, Relational
Properties
| Property | Returns | Description |
|---|---|---|
| adminDomain | Organisation | Administering organisation the post belongs to, used to scope moderation and reporting to one account. May be null on older rows created before it was recorded. |
| deleted | Boolean | Soft-delete flag. When true the post is hidden from listings but its row is kept. Null on posts that have never been deleted, so prefer isDeleted for a null-safe check. |
| deleted | boolean | Whether this post has been soft deleted, treating the null case as not deleted. Prefer this over getDeleted when all you want is a true or false answer. |
| id | long | Unique database identifier for this post, shared across the whole post hierarchy. |
| notes | String | The body of the post, ie what the member actually wrote, up to 20000 characters. May be null. |
| numReports | int | Number of abuse reports against this post, or zero if there are none. Reads the reports collection, so it will trigger a lazy load the first time it is called. |
| parent | Post | Post this one is a reply to, which is what makes comment and forum threads nest. Null for a top level post. |
| postDate | Date | Exact time the post was made. Listings order by this, most recent first. Never null. |
| postDay | Date | The post date truncated to a day, stored separately so posts can be grouped and counted by day without date arithmetic in the query. It is set by the code creating the post, not derived automatically. |
| poster | Profile | Profile of the member who wrote the post. Null for an anonymous comment, in which case the commenter's details are on the comment itself. |
| postReports | List<PostReport> | Abuse reports raised against this post by members. Lazily loaded, and may be null or empty when nobody has reported it. |
| relatedAppName | String | Name of the app that generated this post, when it was created by a feature rather than typed by a member. Null for an ordinary member post, and posts with it set are excluded from a member's post count by default. |
| relatedId | String | Identifier, meaningful to the related app, of the item this post was generated from. Read it together with the related app name. Null for an ordinary member post. |
| votesTotal | Integer | Cached sum of the counts of all votes on this post, so a score can be shown without counting the vote rows. Null on posts that have never been voted on. |
| website | Website | Website the post was made on, copied onto the post so that posts can be listed per website without joining through the content or the forum. May be null for posts not tied to a website. |
Methods
postType() · contentTitle() · getId() · getAdminDomain() · getDeleted() · getWebsite() · getPoster() · getParent() · getPostDate() · getPostDay() · getNotes() · getPostReports() · getVotesTotal() · getRelatedAppName() · getRelatedId() · getNumReports() · findFiles() · isDeleted() · asForumPost() · asComment() · asForumReply()
postType()
Returns: String
Short code saying which kind of post this is: C for a comment, FP for a forum topic and FR for a forum reply. Use it to branch when handling a mixed list of posts.
contentTitle()
Returns: String
Display label for whatever this post is attached to, for example the title of the commented-on page or of the forum topic. Each subclass works it out differently, so it is not a stored column.
getId()
Returns: long
Unique database identifier for this post, shared across the whole post hierarchy.
getAdminDomain()
Returns: Organisation
Administering organisation the post belongs to, used to scope moderation and reporting to one account. May be null on older rows created before it was recorded.
getDeleted()
Returns: Boolean
Soft-delete flag. When true the post is hidden from listings but its row is kept. Null on posts that have never been deleted, so prefer isDeleted for a null-safe check.
getWebsite()
Returns: Website
Website the post was made on, copied onto the post so that posts can be listed per website without joining through the content or the forum. May be null for posts not tied to a website.
getPoster()
Returns: Profile
Profile of the member who wrote the post. Null for an anonymous comment, in which case the commenter's details are on the comment itself.
getParent()
Returns: Post
Post this one is a reply to, which is what makes comment and forum threads nest. Null for a top level post.
getPostDate()
Returns: Date
Exact time the post was made. Listings order by this, most recent first. Never null.
getPostDay()
Returns: Date
The post date truncated to a day, stored separately so posts can be grouped and counted by day without date arithmetic in the query. It is set by the code creating the post, not derived automatically.
getNotes()
Returns: String
The body of the post, ie what the member actually wrote, up to 20000 characters. May be null.
getPostReports()
Returns: List<PostReport>
Abuse reports raised against this post by members. Lazily loaded, and may be null or empty when nobody has reported it.
getVotesTotal()
Returns: Integer
Cached sum of the counts of all votes on this post, so a score can be shown without counting the vote rows. Null on posts that have never been voted on.
getRelatedAppName()
Returns: String
Name of the app that generated this post, when it was created by a feature rather than typed by a member. Null for an ordinary member post, and posts with it set are excluded from a member's post count by default.
getRelatedId()
Returns: String
Identifier, meaningful to the related app, of the item this post was generated from. Read it together with the related app name. Null for an ordinary member post.
getNumReports()
Returns: int
Number of abuse reports against this post, or zero if there are none. Reads the reports collection, so it will trigger a lazy load the first time it is called.
findFiles()
Returns: List<FileAttachment>
Loads the files attached to this post, using the current session. This queries the database, so hold on to the result rather than calling it repeatedly in a loop.
isDeleted()
Returns: boolean
Whether this post has been soft deleted, treating the null case as not deleted. Prefer this over getDeleted when all you want is a true or false answer.
asForumPost()
Returns: ForumPost
Returns this post as a forum topic, or null if it is not one. Lets script narrow a post from a mixed list without checking the type code first.
asComment()
Returns: Comment
Returns this post as a comment, or null if it is not one. Lets script narrow a post from a mixed list without checking the type code first.
asForumReply()
Returns: ForumReply
Returns this post as a forum reply, or null if it is not one. Lets script narrow a post from a mixed list without checking the type code first.