Builds a new forum post or forum reply within a specific forum. When forumPost is left unset, createPost creates a new top-level forum question; when it is set, createPost creates a comment or reply against that question, optionally as a reply to an existing forumReply. Obtained from ForumManager.newForumPostBuilder, which binds it to the forum being posted into. 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

forumPost(ForumPost s)

Returns: ForumPostBuilder

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

ParameterDescription
sthe forum post to reply to

forumReply(ForumReply s)

Returns: ForumPostBuilder

Sets the forum reply this builder creates a nested reply against, and returns this builder for chaining. Only used when forumPost has also been set.

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