Builds a new comment against a blog article or a content resource, optionally as a reply to an existing comment and with extra request parameters attached. Obtained from either overload of ForumManager.newCommentPostBuilder, which binds it to the article or resource being commented on. Set the comment text and any attachments with the inherited methods, then pass the builder to ForumManager.createPost to save it.

Group: Builders

Extends: PostBuilder


Inherited from PostBuilder

Properties

PropertyReturnsDescription
attachmentsList<PostAttachmentBuilder>Files attached to this post so far, built up by repeated calls to addAttachment or attach.

Methods

getAttachments() · addAttachment() · attachments(Map<String,FileItem> files) · attach(FileItem fileItem) · attach(String name, InputStream in) · attach(String name, String contentSpec, String contentType, Long size) · websiteBranch(Branch b) · comment(String s) · postedByUser(Profile s) · postedDate(Date s)

getAttachments()

Returns: List<PostAttachmentBuilder>

Files attached to this post so far, built up by repeated calls to addAttachment or attach.

addAttachment()

Returns: PostAttachmentBuilder

Creates a new file attachment, adds it to this post's list of attachments, and returns it so its properties can be set. Note that attachments must already be initialised (for example via attach or attachments) before calling this directly, as it does not lazily create the list.

attachments(Map<String,FileItem> files)

Returns: T

Attaches every file in the given map, saving each one's content to content storage, and returns this builder for chaining.

ParameterDescription
filesthe uploaded files to attach, keyed by form field name

attach(FileItem fileItem)

Returns: T

Attaches an uploaded file, saving its content to content storage and detecting its content type from the file item, and returns this builder for chaining.

ParameterDescription
fileItemthe uploaded file to attach

attach(String name, InputStream in)

Returns: T

Attaches a file from a name and content stream, saving its content to content storage and detecting its content type from the file name, and returns this builder for chaining.

ParameterDescription
namethe file name, used to detect content type and build the storage key
inthe file's content

attach(String name, String contentSpec, String contentType, Long size)

Returns: T

Attaches a file whose content has already been saved to content storage, and returns this builder for chaining.

ParameterDescription
namethe file name
contentSpeca hash-like value identifying the saved content, either an actual SHA1 file hash or a content spec returned from content storage
contentTypethe MIME type of the file
sizethe size of the file in bytes

websiteBranch(Branch b)

Returns: T

Sets the website branch (and derives the website from it) that the post is created against, and returns this builder for chaining.

ParameterDescription
bthe website branch the post is created against

comment(String s)

Returns: T

Sets the comment text and returns this builder for chaining.

ParameterDescription
sthe text of the post

postedByUser(Profile s)

Returns: T

Sets the profile the post is attributed to and returns this builder for chaining. Defaults to the current user.

ParameterDescription
sthe profile posting

postedDate(Date s)

Returns: T

Sets the date the post is recorded as being made and returns this builder for chaining. Defaults to the time the builder was created.

ParameterDescription
sthe date the post was made

Methods

parentComment(Comment s)

Returns: CommentPostBuilder

Sets the comment this builder creates a reply to, and returns this builder for chaining. Leave unset to create a new top-level comment instead.

ParameterDescription
sthe parent comment to reply to

params(Map<String,String> s)

Returns: CommentPostBuilder

Sets extra parameters to store against the comment, and returns this builder for chaining.

ParameterDescription
sthe parameters to store against the comment

paramsFromRequest()

Returns: CommentPostBuilder

Sets the comment's parameters from the current request's cleaned form parameters, and returns this builder for chaining.

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