Represents a single article in a blog, exposed as both a webpage and a folder for the article's uploaded images and files. Wraps a persisted BlogArticle with its title, body, brief description and assigned images, and adds template helpers for filtering by tag, category and group. Supports an approval workflow so authors can submit an article for review before an editor publishes it live, and can be duplicated to start a new draft from an existing article.
Group: Resources
Extends: DirectoryResource
Implements: GetableResource, PostableResource, TitledPage, BlogResource, SeoResource
Properties
| Property | Returns | Description |
|---|---|---|
| allGroups | List<Group> | All groups defined by the organisation that owns this article, regardless of whether they are selected for visibility filtering. |
| allowAnonComments | boolean | True if anonymous (unauthenticated) comments are allowed on this article, as configured by the forums app if it is active. |
| article | BlogArticle | The persisted BlogArticle entity that this resource wraps. |
| articleDate | String | The article's date, formatted for display using the current date/time format. |
| articleDateDate | Date | The article's date as a raw Date value. |
| availableServices | List<SocialPosterBean> | The social media posting services currently configured for the organisation, if the social login app is active. See SocialLoginApp for how these services are configured. |
| bestDefaultImageHref | String | The best matching image href for no particular orientation, falling back to any assigned image. |
| bestHorizontalImageHref | String | The best matching image href for the horizontal orientation, falling back to an unoriented or any assigned image. |
| bestSquareImageHref | String | The best matching image href for the square orientation, falling back to an unoriented or any assigned image. |
| bestVerticalImageHref | String | The best matching image href for the vertical orientation, falling back to an unoriented or any assigned image. |
| blogFiles | List<BlogFileResource> | The non-image files attached to this article, wrapped as resources so they can be downloaded. |
| blogSite | Website | The website that owns the blog this article belongs to. |
| body | String | The article's body copy. While the article is in draft, this reads the body from the rendered content editor page rather than the persisted article. |
| breadCrumbs | Map<String,String> | The breadcrumb trail for this article, as an ordered map of href to display title, starting with the blogs index and then the owning blog. |
| brief | String | A brief description of the article, normally used on index pages. While the article is in draft, this reads the brief from the rendered content editor page rather than the persisted article. |
| canAuthor | boolean | True if the current user can author this article: it must not already be published or submitted for approval, and the current user must have write-content privilege on it. |
| canPublish | boolean | True if the current user can publish or reject this article, which requires the admin role or the content author role. |
| category | String | The title of the category that the article is in. |
| categoryTitle | String | The display title of the category assigned to this article. |
| comments | List<CommentBean> | The comments posted on this article. |
| directoryName | String | The name of the underlying WebDAV directory node backing this article, or null if the article has no directory node. |
| draft | boolean | True if the article is in draft mode, which happens when it is being viewed on a versioned (non-live) site. |
| externalUrl | String | The article's external URL, if one has been explicitly set on the article entity. |
| featured | boolean | True if this article is selected as a featured article, in which case it should be displayed prominently. |
| groups | Set<Group> | The groups to filter visibility by. Returns an empty set if none are selected, which implies visibility to all groups. |
| horizontalImageHref | String | The href of the image assigned the horizontal orientation. |
| images | List<Image> | All images assigned to this article. Does not include images which are simply present in the folder or referenced by body content, only images explicitly assigned with an orientation. Returns a list of Image items. |
| name | String | The article's path-safe name, used as the last segment of its URL and as the WebDAV directory name. |
| paramNames | List<String> | The names of the editable template parameters available on the article's body template. |
| publishedBy | ProfileBean | The profile who approved and published this article. |
| publishedDate | Date | When the article was published, or null if not currently published. |
| rejectedAt | Date | When the article was last rejected or unpublished. |
| rejectedBy | ProfileBean | The profile who made the last publish or reject decision on this article. Despite the name, this currently delegates to getPublishedBy rather than tracking a separate profile for rejections. |
| rejectedReason | String | The reason given when the article was last rejected or unpublished. |
| selectedTags | List<String> | The tag titles that are currently selected on this article. |
| selectors | List<KSelectorItem> | The group and category selector items configured as the article's visibility filter, parsed from the article's stored group filter JSON, or built from its group filter set for legacy (non-JSON) data. |
| seoContent | SeoContentBean | Builds the SEO metadata for this article: description, keywords, canonical URL and structured data, derived from the article's brief, tags, category and publish/modified dates. |
| squareImageHref | String | The href of the image assigned the square orientation. |
| submittedBy | ProfileBean | The profile who submitted the article for approval. |
| submittedDate | Date | When the article was submitted for approval. |
| tags | List<String> | All tag titles defined on the blog that this article belongs to, not just the ones selected on this article. |
| theme | Theme | The theme applied to the blog site's trunk branch. |
| title | String | The article's title. While the article is in draft, this prefers the title of the rendered content editor page over the persisted article title, falling back to the article's name if neither is set. |
| verticalImageHref | String | The href of the image assigned the vertical orientation. Note that this currently delegates to the square orientation constant, so it resolves the square-orientation image rather than a vertical one. |
Inherited from DirectoryResource
Properties
| Property | Returns | Description |
|---|---|---|
| branch | Branch | The branch this directory belongs to, delegated to from its parent resource. |
| children | ResourceList<CommonResource> | The child files and folders of this directory, including any browseable application pages registered by ApplicationManager. Built lazily on first access and cached for the lifetime of this resource. |
| contentManagedPermissions | boolean | Whether this directory's permissions are managed as content, rather than through the standard role system. Always true for a directory resource. |
| dir | boolean | Whether this resource is a directory. Always true. |
| directoryNode | DirectoryNode | The underlying directory node for this resource in the versioned content repository, creating it from the parent node if it does not yet exist. |
| files | List<ContentResource> | Files (not folders) that are direct children of this directory. |
| hash | String | Content hash of this directory's underlying directory node, or null if the node has not been created. |
| index | RenderFileResource | The index.html page of this directory, if one has already been created, otherwise null. |
| itemType | String | The "itemType" template parameter of this directory's index page, used to classify the folder for search. |
| pathFromBranch | Path | This directory's path relative to the root of its branch, built from its parent's path plus its own name. |
| searchCategory | String | The "category" template parameter of this directory's index page, used to classify the folder for search. |
| searchTags | String | The "tags" template parameter of this directory's index page, used to tag the folder for search. |
| subFolders | List<ContentDirectoryResource> | Subfolders of this directory, excluding the reserved ".mil" metadata folder. |
Methods
getChildren() · createDirectoryResource(String newName) · save() · isDir() · getDirectoryNode() · getIndex() · getHtmlPage(String name, boolean autocreate) · getParam(String name) · doSaveHtml() · getBranch() · getHash() · getSubFolders() · getFiles() · isContentManagedPermissions() · getItemType() · getSearchCategory() · getSearchTags() · getPathFromBranch()
getChildren()
Returns: ResourceList<CommonResource>
The child files and folders of this directory, including any browseable application pages registered by ApplicationManager. Built lazily on first access and cached for the lifetime of this resource.
createDirectoryResource(String newName)
Returns: DirectoryResource
Creates a new subdirectory of this directory with the given name and saves the change. Fails if a resource with that name already exists.
| Parameter | Description |
|---|---|
newName | the name of the subdirectory to create |
save()
Returns: void
Persists this directory by delegating to its parent's save method. Requires a logged-in user.
isDir()
Returns: boolean
Whether this resource is a directory. Always true.
getDirectoryNode()
Returns: DirectoryNode
The underlying directory node for this resource in the versioned content repository, creating it from the parent node if it does not yet exist.
getIndex()
Returns: RenderFileResource
The index.html page of this directory, if one has already been created, otherwise null.
getHtmlPage(String name, boolean autocreate)
Returns: RenderFileResource
Finds a named HTML page among this directory's children, parsing it for templating, or creates a new one if autocreate is true and no page with that name exists.
| Parameter | Description |
|---|---|
name | the name of the HTML page to find or create |
autocreate | if true, creates and returns a new page when none exists; otherwise returns null |
getParam(String name)
Returns: String
Reads a named template parameter from this directory's index page.
| Parameter | Description |
|---|---|
name | the name of the parameter to read |
doSaveHtml()
Returns: void
Saves the index page if any of its title, body or parameters have been changed via this resource. Does nothing if nothing has been changed, or if there is no index page to save.
getBranch()
Returns: Branch
The branch this directory belongs to, delegated to from its parent resource.
getHash()
Returns: String
Content hash of this directory's underlying directory node, or null if the node has not been created.
getSubFolders()
Returns: List<ContentDirectoryResource>
Subfolders of this directory, excluding the reserved ".mil" metadata folder.
getFiles()
Returns: List<ContentResource>
Files (not folders) that are direct children of this directory.
isContentManagedPermissions()
Returns: boolean
Whether this directory's permissions are managed as content, rather than through the standard role system. Always true for a directory resource.
getItemType()
Returns: String
The "itemType" template parameter of this directory's index page, used to classify the folder for search.
getSearchCategory()
Returns: String
The "category" template parameter of this directory's index page, used to classify the folder for search.
getSearchTags()
Returns: String
The "tags" template parameter of this directory's index page, used to tag the folder for search.
getPathFromBranch()
Returns: Path
This directory's path relative to the root of its branch, built from its parent's path plus its own name.
Methods
getTitle() · getDirectoryName() · getBlogSite() · getArticle() · isDraft() · isInTargetGroup(ProfileBean p) · isInTargetGroup(Profile p) · getAvailableServices() · getName() · isSelectedTag(List<String> tags) · isSelected(List<String> tags, List<String> categories) · isSelectedTag(String tag) · is(String type) · asJson() · getTags() · getSelectedTags() · getBrief() · getBody() · getCategoryTitle() · getCategory() · getBlogFiles() · getImages() · getImages(String preferredOrientation) · getImageHref(String preferredOrientation) · getSquareImageHref() · getVerticalImageHref() · getHorizontalImageHref() · getBestImageHref(String preferredOrientation) · getBestDefaultImageHref() · getBestSquareImageHref() · getBestVerticalImageHref() · getBestHorizontalImageHref() · getExternalUrl() · isFeatured() · getArticleDate() · getArticleDateDate() · getRejectedReason() · getRejectedAt() · getRejectedBy() · getSubmittedDate() · getSubmittedBy() · getPublishedDate() · getPublishedBy() · isCanAuthor() · isCanPublish() · getGroups() · getAllGroups() · isSelected(Group g) · isSelected(String groupName) · getParamNames() · isAllowAnonComments() · getComments() · getTheme() · getSeoContent() · getSelectors() · getBreadCrumbs()
getTitle()
Returns: String
The article's title. While the article is in draft, this prefers the title of the rendered content editor page over the persisted article title, falling back to the article's name if neither is set.
getDirectoryName()
Returns: String
The name of the underlying WebDAV directory node backing this article, or null if the article has no directory node.
getBlogSite()
Returns: Website
The website that owns the blog this article belongs to.
getArticle()
Returns: BlogArticle
The persisted BlogArticle entity that this resource wraps.
isDraft()
Returns: boolean
True if the article is in draft mode, which happens when it is being viewed on a versioned (non-live) site.
isInTargetGroup(ProfileBean p)
Returns: boolean
Checks whether the given profile is in the article's target group, if one has been configured. If this article has a group filter, this only returns true if the profile is in one of the selected groups. If no group filter has been applied it returns true for any profile.
| Parameter | Description |
|---|---|
p | the profile to check, wrapped as a bean |
isInTargetGroup(Profile p)
Returns: boolean
Checks whether the given profile is in the article's target group, if one has been configured. Behaves the same as the ProfileBean overload but takes the underlying entity directly.
| Parameter | Description |
|---|---|
p | the profile to check |
getAvailableServices()
Returns: List<SocialPosterBean>
The social media posting services currently configured for the organisation, if the social login app is active. See SocialLoginApp for how these services are configured.
getName()
Returns: String
The article's path-safe name, used as the last segment of its URL and as the WebDAV directory name.
isSelectedTag(List<String> tags)
Returns: boolean
Checks whether any of the given tags are selected for this article. If tags is null or empty this returns true.
| Parameter | Description |
|---|---|
tags | the tag titles to check, may be null or empty |
isSelected(List<String> tags, List<String> categories)
Returns: boolean
Checks whether the article's selected tags and category match the given filters. A null or empty list for either argument is ignored. Only returns true if there is a successful match on both the tags and the categories.
| Parameter | Description |
|---|---|
tags | the tag titles to match against, may be null or empty to ignore tag matching |
categories | the category names to match against, may be null or empty to ignore category matching |
isSelectedTag(String tag)
Returns: boolean
True if the given argument is the title of a tag selected on this article.
| Parameter | Description |
|---|---|
tag | the tag title to check |
is(String type)
Returns: boolean
Type check used by templates to test what this resource represents. Always true for the types "article", "blogArticle" and "html", true for "featured" if the article is featured, true if the type matches the article's category name or ID, and true if it matches a selected tag title. Otherwise delegates to the base class.
| Parameter | Description |
|---|---|
type | the type name to test |
asJson()
Returns: boolean
True if the current request has asked for the article as JSON, either because the request's content type header contains "json", or because the request parameters include "asJson" or "activity".
getTags()
Returns: List<String>
All tag titles defined on the blog that this article belongs to, not just the ones selected on this article.
getSelectedTags()
Returns: List<String>
The tag titles that are currently selected on this article.
getBrief()
Returns: String
A brief description of the article, normally used on index pages. While the article is in draft, this reads the brief from the rendered content editor page rather than the persisted article.
getBody()
Returns: String
The article's body copy. While the article is in draft, this reads the body from the rendered content editor page rather than the persisted article.
getCategoryTitle()
Returns: String
The display title of the category assigned to this article.
getCategory()
Returns: String
The title of the category that the article is in.
getBlogFiles()
Returns: List<BlogFileResource>
The non-image files attached to this article, wrapped as resources so they can be downloaded.
getImages()
Returns: List<Image>
All images assigned to this article. Does not include images which are simply present in the folder or referenced by body content, only images explicitly assigned with an orientation. Returns a list of Image items.
getImages(String preferredOrientation)
Returns: List<Image>
All images assigned to this article that have the given orientation.
| Parameter | Description |
|---|---|
preferredOrientation | the orientation to filter by, or null to match images with no orientation set |
getImageHref(String preferredOrientation)
Returns: String
The href of the first image assigned to this article with the given orientation.
| Parameter | Description |
|---|---|
preferredOrientation | the orientation to match, or null to match an image with no orientation set |
getSquareImageHref()
Returns: String
The href of the image assigned the square orientation.
getVerticalImageHref()
Returns: String
The href of the image assigned the vertical orientation. Note that this currently delegates to the square orientation constant, so it resolves the square-orientation image rather than a vertical one.
getHorizontalImageHref()
Returns: String
The href of the image assigned the horizontal orientation.
getBestImageHref(String preferredOrientation)
Returns: String
The href of the best matching image for the given orientation: the first image with that orientation if one exists, otherwise an image with no orientation set, otherwise any assigned image.
| Parameter | Description |
|---|---|
preferredOrientation | the preferred orientation, or null to prefer an image with no orientation set |
getBestDefaultImageHref()
Returns: String
The best matching image href for no particular orientation, falling back to any assigned image.
getBestSquareImageHref()
Returns: String
The best matching image href for the square orientation, falling back to an unoriented or any assigned image.
getBestVerticalImageHref()
Returns: String
The best matching image href for the vertical orientation, falling back to an unoriented or any assigned image.
getBestHorizontalImageHref()
Returns: String
The best matching image href for the horizontal orientation, falling back to an unoriented or any assigned image.
getExternalUrl()
Returns: String
The article's external URL, if one has been explicitly set on the article entity.
isFeatured()
Returns: boolean
True if this article is selected as a featured article, in which case it should be displayed prominently.
getArticleDate()
Returns: String
The article's date, formatted for display using the current date/time format.
getArticleDateDate()
Returns: Date
The article's date as a raw Date value.
getRejectedReason()
Returns: String
The reason given when the article was last rejected or unpublished.
getRejectedAt()
Returns: Date
When the article was last rejected or unpublished.
getRejectedBy()
Returns: ProfileBean
The profile who made the last publish or reject decision on this article. Despite the name, this currently delegates to getPublishedBy rather than tracking a separate profile for rejections.
getSubmittedDate()
Returns: Date
When the article was submitted for approval.
getSubmittedBy()
Returns: ProfileBean
The profile who submitted the article for approval.
getPublishedDate()
Returns: Date
When the article was published, or null if not currently published.
getPublishedBy()
Returns: ProfileBean
The profile who approved and published this article.
isCanAuthor()
Returns: boolean
True if the current user can author this article: it must not already be published or submitted for approval, and the current user must have write-content privilege on it.
isCanPublish()
Returns: boolean
True if the current user can publish or reject this article, which requires the admin role or the content author role.
getGroups()
Returns: Set<Group>
The groups to filter visibility by. Returns an empty set if none are selected, which implies visibility to all groups.
getAllGroups()
Returns: List<Group>
All groups defined by the organisation that owns this article, regardless of whether they are selected for visibility filtering.
isSelected(Group g)
Returns: boolean
Is the given group selected for visibility of this article.
| Parameter | Description |
|---|---|
g | the group to check |
isSelected(String groupName)
Returns: boolean
Is the group with the given name selected for visibility of this article.
| Parameter | Description |
|---|---|
groupName | the name of the group to check |
getParamNames()
Returns: List<String>
The names of the editable template parameters available on the article's body template.
isAllowAnonComments()
Returns: boolean
True if anonymous (unauthenticated) comments are allowed on this article, as configured by the forums app if it is active.
getComments()
Returns: List<CommentBean>
The comments posted on this article.
getTheme()
Returns: Theme
The theme applied to the blog site's trunk branch.
getSeoContent()
Returns: SeoContentBean
Builds the SEO metadata for this article: description, keywords, canonical URL and structured data, derived from the article's brief, tags, category and publish/modified dates.
getSelectors()
Returns: List<KSelectorItem>
The group and category selector items configured as the article's visibility filter, parsed from the article's stored group filter JSON, or built from its group filter set for legacy (non-JSON) data.
getBreadCrumbs()
Returns: Map<String,String>
The breadcrumb trail for this article, as an ordered map of href to display title, starting with the blogs index and then the owning blog.