A comment left on a content item, such as a page, an article or a profile wall. It is a kind of Post, so it carries the poster, the date, the comment text in notes and the vote total from there. What it adds is the link to the thing being commented on: the content id, which is the meta UUID of the content item, plus the content href and title captured at the time so the comment can still be listed if the content moves. Comments nest by setting the parent to another comment. Deletion is soft, using the inherited deleted flag, and the finders skip flagged rows. The first name, surname, email and source IP fields hold the details of an anonymous commenter who has no profile.

Group: Database Entities

Extends: Post


Properties

PropertyReturnsDescription
contentHrefStringURL path of the content item as it was when the comment was made, used for linking back to it and for listing comments under a section of a site by path prefix. It is not updated if the content later moves. Never null.
contentIdStringIdentifier of the content item being commented on, normally the meta UUID of that content. Profile and entity walls use a prefixed synthetic id instead of a UUID. Never null.
contentTitleStringTitle of the content item captured when the comment was made, so comment lists can be labelled without loading the content. It can be a single full stop for content that had no title; use the contentTitle method instead for a display label that falls back sensibly.
emailStringEmail address given by an anonymous commenter. It is not verified, so do not treat it as identifying anyone. Normally null for comments made by a logged in member.
firstNameStringFirst name given by an anonymous commenter who has no profile. Normally null for comments made by a logged in member, whose name comes from the poster profile.
sourceIpStringIP address the comment was submitted from, recorded for moderation and abuse handling. May be null for comments created server side rather than through a web request.
surNameStringSurname given by an anonymous commenter who has no profile. Normally null for comments made by a logged in member.

Inherited from Post

Properties

PropertyReturnsDescription
adminDomainOrganisationAdministering 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.
deletedBooleanSoft-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.
idlongUnique database identifier for this post, shared across the whole post hierarchy.
notesStringThe body of the post, ie what the member actually wrote, up to 20000 characters. May be null.
numReportsintNumber 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.
parentPostPost this one is a reply to, which is what makes comment and forum threads nest. Null for a top level post.
postDateDateExact time the post was made. Listings order by this, most recent first. Never null.
postDayDateThe 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.
posterProfileProfile of the member who wrote the post. Null for an anonymous comment, in which case the commenter's details are on the comment itself.
postReportsList<PostReport>Abuse reports raised against this post by members. Lazily loaded, and may be null or empty when nobody has reported it.
relatedAppNameStringName 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.
relatedIdStringIdentifier, 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.
votesTotalIntegerCached 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.
websiteWebsiteWebsite 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

getId() · getAdminDomain() · getDeleted() · getWebsite() · getPoster() · getParent() · getPostDate() · getPostDay() · getNotes() · getPostReports() · getVotesTotal() · getRelatedAppName() · getRelatedId() · getNumReports() · findFiles() · isDeleted() · asForumPost() · asForumReply()

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.

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.


Methods

getContentId() · getContentHref() · getContentTitle() · getFirstName() · getSurName() · getEmail() · getSourceIp() · postType() · contentTitle() · asComment()

getContentId()

Returns: String

Identifier of the content item being commented on, normally the meta UUID of that content. Profile and entity walls use a prefixed synthetic id instead of a UUID. Never null.

getContentHref()

Returns: String

URL path of the content item as it was when the comment was made, used for linking back to it and for listing comments under a section of a site by path prefix. It is not updated if the content later moves. Never null.

getContentTitle()

Returns: String

Title of the content item captured when the comment was made, so comment lists can be labelled without loading the content. It can be a single full stop for content that had no title; use the contentTitle method instead for a display label that falls back sensibly.

getFirstName()

Returns: String

First name given by an anonymous commenter who has no profile. Normally null for comments made by a logged in member, whose name comes from the poster profile.

getSurName()

Returns: String

Surname given by an anonymous commenter who has no profile. Normally null for comments made by a logged in member.

getEmail()

Returns: String

Email address given by an anonymous commenter. It is not verified, so do not treat it as identifying anyone. Normally null for comments made by a logged in member.

getSourceIp()

Returns: String

IP address the comment was submitted from, recorded for moderation and abuse handling. May be null for comments created server side rather than through a web request.

postType()

Returns: String

Type code identifying this post as a comment, always the letter C.

contentTitle()

Returns: String

Display label for the thing this comment is on. Returns the stored content title where there is a real one, otherwise builds a label for a profile wall or an entity wall from the content id, and failing that falls back to the content id or the content href.

asComment()

Returns: Comment

Returns this post as a comment. Useful from script when working with a list of posts, since the same method on other post types returns null.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.