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().
| Parameter | Description |
|---|---|
blog | the 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.
| Parameter | Description |
|---|---|
name | the path-safe article name |
category(BlogCategory category)
Returns: ArticleBuilder
Sets the category to assign the new article to.
| Parameter | Description |
|---|---|
category | the 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.
| Parameter | Description |
|---|---|
tags | the tags to link, or null to add none |
title(String title)
Returns: ArticleBuilder
Overrides the article's display title set on newArticleBuilder().
| Parameter | Description |
|---|---|
title | the display title, must not be blank |
brief(String brief)
Returns: ArticleBuilder
Sets the article's brief/summary text.
| Parameter | Description |
|---|---|
brief | the 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().
| Parameter | Description |
|---|---|
body | the article body, must not exceed BODY_MAX_LENGTH |
featured(Boolean featured)
Returns: ArticleBuilder
Sets whether the new article is flagged as featured. Defaults to false if never called.
| Parameter | Description |
|---|---|
featured | true 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.
| Parameter | Description |
|---|---|
images | the 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.
| Parameter | Description |
|---|---|
files | the 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.
| Parameter | Description |
|---|---|
includedGroups | the 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.
| Parameter | Description |
|---|---|
excludedGroups | the 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.
| Parameter | Description |
|---|---|
includedOrgs | the 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.
| Parameter | Description |
|---|---|
excludedOrgs | the 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.
| Parameter | Description |
|---|---|
externalUrl | the 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().
| Parameter | Description |
|---|---|
createdBy | the 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.
| Parameter | Description |
|---|---|
publishedBy | the profile to record as having approved and published the article |
publishedDate | the 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.