Base builder for creating a post, comment or reply: holds the common comment text, poster, posted date, website and branch, and any file attachments, and is extended by ForumPostBuilder and CommentPostBuilder for their specific post types. Defaults the poster to the current user, the posted date to now, and the website and branch to those of the current website root folder, if there is one. Never obtained directly: use ForumManager.newForumPostBuilder or ForumManager.newCommentPostBuilder to get one of the concrete subclasses, then pass it to ForumManager.createPost.

Group: Builders


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
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.