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

PropertyReturnsDescription
allGroupsList<Group>All groups defined by the organisation that owns this article, regardless of whether they are selected for visibility filtering.
allowAnonCommentsbooleanTrue if anonymous (unauthenticated) comments are allowed on this article, as configured by the forums app if it is active.
articleBlogArticleThe persisted BlogArticle entity that this resource wraps.
articleDateStringThe article's date, formatted for display using the current date/time format.
articleDateDateDateThe article's date as a raw Date value.
availableServicesList<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.
bestDefaultImageHrefStringThe best matching image href for no particular orientation, falling back to any assigned image.
bestHorizontalImageHrefStringThe best matching image href for the horizontal orientation, falling back to an unoriented or any assigned image.
bestSquareImageHrefStringThe best matching image href for the square orientation, falling back to an unoriented or any assigned image.
bestVerticalImageHrefStringThe best matching image href for the vertical orientation, falling back to an unoriented or any assigned image.
blogFilesList<BlogFileResource>The non-image files attached to this article, wrapped as resources so they can be downloaded.
blogSiteWebsiteThe website that owns the blog this article belongs to.
bodyStringThe 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.
breadCrumbsMap<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.
briefStringA 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.
canAuthorbooleanTrue 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.
canPublishbooleanTrue if the current user can publish or reject this article, which requires the admin role or the content author role.
categoryStringThe title of the category that the article is in.
categoryTitleStringThe display title of the category assigned to this article.
commentsList<CommentBean>The comments posted on this article.
directoryNameStringThe name of the underlying WebDAV directory node backing this article, or null if the article has no directory node.
draftbooleanTrue if the article is in draft mode, which happens when it is being viewed on a versioned (non-live) site.
externalUrlStringThe article's external URL, if one has been explicitly set on the article entity.
featuredbooleanTrue if this article is selected as a featured article, in which case it should be displayed prominently.
groupsSet<Group>The groups to filter visibility by. Returns an empty set if none are selected, which implies visibility to all groups.
horizontalImageHrefStringThe href of the image assigned the horizontal orientation.
imagesList<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.
nameStringThe article's path-safe name, used as the last segment of its URL and as the WebDAV directory name.
paramNamesList<String>The names of the editable template parameters available on the article's body template.
publishedByProfileBeanThe profile who approved and published this article.
publishedDateDateWhen the article was published, or null if not currently published.
rejectedAtDateWhen the article was last rejected or unpublished.
rejectedByProfileBeanThe 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.
rejectedReasonStringThe reason given when the article was last rejected or unpublished.
selectedTagsList<String>The tag titles that are currently selected on this article.
selectorsList<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.
seoContentSeoContentBeanBuilds 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.
squareImageHrefStringThe href of the image assigned the square orientation.
submittedByProfileBeanThe profile who submitted the article for approval.
submittedDateDateWhen the article was submitted for approval.
tagsList<String>All tag titles defined on the blog that this article belongs to, not just the ones selected on this article.
themeThemeThe theme applied to the blog site's trunk branch.
titleStringThe 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.
verticalImageHrefStringThe 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

PropertyReturnsDescription
branchBranchThe branch this directory belongs to, delegated to from its parent resource.
childrenResourceList<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.
contentManagedPermissionsbooleanWhether this directory's permissions are managed as content, rather than through the standard role system. Always true for a directory resource.
dirbooleanWhether this resource is a directory. Always true.
directoryNodeDirectoryNodeThe underlying directory node for this resource in the versioned content repository, creating it from the parent node if it does not yet exist.
filesList<ContentResource>Files (not folders) that are direct children of this directory.
hashStringContent hash of this directory's underlying directory node, or null if the node has not been created.
indexRenderFileResourceThe index.html page of this directory, if one has already been created, otherwise null.
itemTypeStringThe "itemType" template parameter of this directory's index page, used to classify the folder for search.
pathFromBranchPathThis directory's path relative to the root of its branch, built from its parent's path plus its own name.
searchCategoryStringThe "category" template parameter of this directory's index page, used to classify the folder for search.
searchTagsStringThe "tags" template parameter of this directory's index page, used to tag the folder for search.
subFoldersList<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.

ParameterDescription
newNamethe 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.

ParameterDescription
namethe name of the HTML page to find or create
autocreateif 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.

ParameterDescription
namethe 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.

ParameterDescription
pthe 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.

ParameterDescription
pthe 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.

ParameterDescription
tagsthe 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.

ParameterDescription
tagsthe tag titles to match against, may be null or empty to ignore tag matching
categoriesthe 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.

ParameterDescription
tagthe 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.

ParameterDescription
typethe 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.

ParameterDescription
preferredOrientationthe 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.

ParameterDescription
preferredOrientationthe 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.

ParameterDescription
preferredOrientationthe 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.

ParameterDescription
gthe group to check

isSelected(String groupName)

Returns: boolean

Is the group with the given name selected for visibility of this article.

ParameterDescription
groupNamethe 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.

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