Fluent builder for creating a new blog article with optional category, tags, images, files and audience filtering set in one call. Obtained from BlogManager.newArticleBuilder(name, title); set blog() and any other properties needed, then call build() to create and save the article. By default the article is created as a draft; calling published() marks it as published immediately on build.

Group: Builders


Methods

blog(Blog blog) · name(String name) · category(BlogCategory category) · tags(List<BlogTag> tags) · title(String title) · brief(String brief) · body(String body) · featured(Boolean featured) · images(List<Map<String,String>> images) · files(List<Map<String,String>> files) · includedGroups(List<Group> includedGroups) · excludedGroups(List<Group> excludedGroups) · includedOrgs(List<Organisation> includedOrgs) · excludedOrgs(List<Organisation> excludedOrgs) · externalUrl(String externalUrl) · createdBy(Profile createdBy) · published(Profile publishedBy, Date publishedDate) · build()

blog(Blog blog)

Returns: ArticleBuilder

Sets the blog the new article will belong to. Required before calling build().

ParameterDescription
blogthe blog to add the article to

name(String name)

Returns: ArticleBuilder

Overrides the article's path-safe name, used as its repository directory. If not set, one is generated from the title.

ParameterDescription
namethe path-safe article name

category(BlogCategory category)

Returns: ArticleBuilder

Sets the category to assign the new article to.

ParameterDescription
categorythe category to assign, or null to leave the article uncategorised

tags(List<BlogTag> tags)

Returns: ArticleBuilder

Sets the tags to link to the new article.

ParameterDescription
tagsthe tags to link, or null to add none

title(String title)

Returns: ArticleBuilder

Overrides the article's display title set on newArticleBuilder().

ParameterDescription
titlethe display title, must not be blank

brief(String brief)

Returns: ArticleBuilder

Sets the article's brief/summary text.

ParameterDescription
briefthe brief text, or null to leave it unset

body(String body)

Returns: ArticleBuilder

Sets the article body. When set, it is also written to the article's repository index.html on build().

ParameterDescription
bodythe article body, must not exceed BODY_MAX_LENGTH

Returns: ArticleBuilder

Sets whether the new article is flagged as featured. Defaults to false if never called.

ParameterDescription
featuredtrue to flag the article as featured

images(List<Map<String,String>> images)

Returns: ArticleBuilder

Sets the images to attach to the new article. Each map must contain "name", "hash" and "orientation" entries.

ParameterDescription
imagesthe images to attach, or null to add none

files(List<Map<String,String>> files)

Returns: ArticleBuilder

Sets the files to attach to the new article. Each map must contain "name", "hash" and "tag" entries.

ParameterDescription
filesthe files to attach, or null to add none

includedGroups(List<Group> includedGroups)

Returns: ArticleBuilder

Adds these groups to the article's audience filter as included groups: members of any of them may view the article.

ParameterDescription
includedGroupsthe groups to include, or null to add none

excludedGroups(List<Group> excludedGroups)

Returns: ArticleBuilder

Adds these groups to the article's audience filter as excluded groups: members of any of them may not view the article.

ParameterDescription
excludedGroupsthe groups to exclude, or null to add none

includedOrgs(List<Organisation> includedOrgs)

Returns: ArticleBuilder

Adds these organisations to the article's audience filter as included organisations: members of any of them may view the article.

ParameterDescription
includedOrgsthe organisations to include, or null to add none

excludedOrgs(List<Organisation> excludedOrgs)

Returns: ArticleBuilder

Adds these organisations to the article's audience filter as excluded organisations: members of any of them may not view the article.

ParameterDescription
excludedOrgsthe organisations to exclude, or null to add none

externalUrl(String externalUrl)

Returns: ArticleBuilder

Sets an external URL for the article, for an article that links out to content hosted elsewhere.

ParameterDescription
externalUrlthe external URL, or null to leave it unset

createdBy(Profile createdBy)

Returns: ArticleBuilder

Sets the profile to record as having created the article. Required before calling build().

ParameterDescription
createdBythe creating profile

published(Profile publishedBy, Date publishedDate)

Returns: ArticleBuilder

Marks the article as published immediately on build. Without calling this, the article is created as a draft (not approved) and must go through the normal publish workflow.

ParameterDescription
publishedBythe profile to record as having approved and published the article
publishedDatethe date to record as the approval and publish date, or null to use the current time

build()

Returns: void

Creates and saves the article with the properties set on this builder: validates that a blog, title and creator are set, generates a unique name if none was given, writes the body to the repository if one was set, resolves the audience filter from any included/excluded groups and organisations, links the given tags, images and files, and marks the article as published if published() was called.

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