Represents a blog article. The content is authored into the repository, and when ready the author submits for approval. Only when approved the content fields are copied from the source content in the repository into fields on this table - title - brief - body - images After approval the approved fields are set, and the waitingForApproval flag is turned off. If the author needs to edit they may do so but this only affects the verssioned content in the repository. When ready they submit for approval again and when approved updated content is copied into the table fields
Group: Database Entities
Implements: Serializable, Auditable
Properties
| Property | Returns | Description |
|---|---|---|
| approvedAt | Date | When the article was approved, and from when it is publicly viewable. Null means it has never been approved. It may be set to a future date, in which case the article is approved but not yet live; isLive is the check for that. |
| approvedBy | Profile | The approver who made the last decision on this article. Despite the name it holds whoever approved or rejected it, so read it together with the approved and rejected dates to tell which decision it refers to. |
| articleDate | Date | The date the article is presented as having been written on, which is what article listings are sorted by. It is set by the author and is independent of when the article was approved. |
| auditOrg | Organisation | The organisation this article's audit entries are recorded against, being the organisation which owns the blog. |
| blog | Blog | The blog this article belongs to. Never null, and an article cannot be moved between blogs; copyTo makes a copy in another blog instead. |
| body | String | The full article content as approved, up to 100000 characters. It is a copy taken from the versioned source content in the repository at the time of approval, so edits made since then are not reflected here until the article is approved again. |
| brief | String | The short summary shown in article listings and teasers, up to 10000 characters, copied from the authored content on approval. |
| category | BlogCategory | The category the article is filed under, used to group and filter articles within the blog. Optional, so null for an uncategorised article. |
| deleted | boolean | Whether the article has been soft deleted. Deleted articles stay in the table but are skipped by lookups by name, so the name can be reused. |
| externalUrl | String | Where the article should link to when it points at something hosted elsewhere, such as a press release on another site. Null for a normal article whose body is held here. |
| featured | boolean | Whether the article has been marked as featured, which themes use to promote it, typically at the top of the blog or on a home page. |
| files | List<BlogFile> | The file attachments on this article, each holding the file name it is addressed by, the content hash of the file data, and an optional tag for grouping. Null if no files have been added. |
| groupFilterIds | String | Comma separated group IDs which, when present, limit who can see this article to members of those groups. Blank or null means the article is visible to everyone who can see the blog. Call groupFilter to read it as a set of groups. |
| id | long | Unique identifier for this article, assigned by the database when the row is first saved. |
| images | List<BlogImage> | The images attached to this article, each holding the file name it is addressed by and the content hash of the image data. Null if no images have been added. |
| name | String | Path safe identifier for the article, unique within its blog among articles which are not deleted, and used as the URL segment and the lookup key. Use the title for anything shown to a reader. |
| rejectedAt | Date | When the article was rejected by an approver. Null if it has never been rejected. |
| rejectedReason | String | The explanation the approver gave when rejecting the article, up to 4048 characters, shown back to the author so they know what to change. |
| submittedForApprovalAt | Date | When the article was last submitted for approval. Null if it has never been submitted. |
| submittedForApprovalBy | Profile | The author who last submitted the article for approval. Null if it has never been submitted. |
| title | String | The article's display heading, up to 500 characters, copied from the authored content when the article is approved. Free text with no uniqueness guarantee, so never use it as an identifier; the name is the identifier. |
| waitingApproval | boolean | Whether the article has been submitted for approval and is waiting on a decision. Turned off once it is approved or rejected, and turned on again each time the author resubmits. |
Methods
getId() · getBlog() · getTitle() · getExternalUrl() · isDeleted() · getArticleDate() · getName() · getCategory() · getBrief() · getBody() · isFeatured() · isWaitingApproval() · getSubmittedForApprovalAt() · getSubmittedForApprovalBy() · getApprovedAt() · getApprovedBy() · getImages() · getFiles() · getRejectedReason() · getRejectedAt() · getGroupFilterIds() · image(String childName) · file(String childName) · isLive(Date now) · groupFilter() · updateGroupFilter(Iterable<Group> groups) · getAuditOrg()
getId()
Returns: long
Unique identifier for this article, assigned by the database when the row is first saved.
getBlog()
Returns: Blog
The blog this article belongs to. Never null, and an article cannot be moved between blogs; copyTo makes a copy in another blog instead.
getTitle()
Returns: String
The article's display heading, up to 500 characters, copied from the authored content when the article is approved. Free text with no uniqueness guarantee, so never use it as an identifier; the name is the identifier.
getExternalUrl()
Returns: String
Where the article should link to when it points at something hosted elsewhere, such as a press release on another site. Null for a normal article whose body is held here.
isDeleted()
Returns: boolean
Whether the article has been soft deleted. Deleted articles stay in the table but are skipped by lookups by name, so the name can be reused.
getArticleDate()
Returns: Date
The date the article is presented as having been written on, which is what article listings are sorted by. It is set by the author and is independent of when the article was approved.
getName()
Returns: String
Path safe identifier for the article, unique within its blog among articles which are not deleted, and used as the URL segment and the lookup key. Use the title for anything shown to a reader.
getCategory()
Returns: BlogCategory
The category the article is filed under, used to group and filter articles within the blog. Optional, so null for an uncategorised article.
getBrief()
Returns: String
The short summary shown in article listings and teasers, up to 10000 characters, copied from the authored content on approval.
getBody()
Returns: String
The full article content as approved, up to 100000 characters. It is a copy taken from the versioned source content in the repository at the time of approval, so edits made since then are not reflected here until the article is approved again.
isFeatured()
Returns: boolean
Whether the article has been marked as featured, which themes use to promote it, typically at the top of the blog or on a home page.
isWaitingApproval()
Returns: boolean
Whether the article has been submitted for approval and is waiting on a decision. Turned off once it is approved or rejected, and turned on again each time the author resubmits.
getSubmittedForApprovalAt()
Returns: Date
When the article was last submitted for approval. Null if it has never been submitted.
getSubmittedForApprovalBy()
Returns: Profile
The author who last submitted the article for approval. Null if it has never been submitted.
getApprovedAt()
Returns: Date
When the article was approved, and from when it is publicly viewable. Null means it has never been approved. It may be set to a future date, in which case the article is approved but not yet live; isLive is the check for that.
getApprovedBy()
Returns: Profile
The approver who made the last decision on this article. Despite the name it holds whoever approved or rejected it, so read it together with the approved and rejected dates to tell which decision it refers to.
getImages()
Returns: List<BlogImage>
The images attached to this article, each holding the file name it is addressed by and the content hash of the image data. Null if no images have been added.
getFiles()
Returns: List<BlogFile>
The file attachments on this article, each holding the file name it is addressed by, the content hash of the file data, and an optional tag for grouping. Null if no files have been added.
getRejectedReason()
Returns: String
The explanation the approver gave when rejecting the article, up to 4048 characters, shown back to the author so they know what to change.
getRejectedAt()
Returns: Date
When the article was rejected by an approver. Null if it has never been rejected.
getGroupFilterIds()
Returns: String
Comma separated group IDs which, when present, limit who can see this article to members of those groups. Blank or null means the article is visible to everyone who can see the blog. Call groupFilter to read it as a set of groups.
image(String childName)
Returns: BlogImage
Finds one of this article's images by the file name it was added under. Matching is exact and case sensitive.
| Parameter | Description |
|---|---|
childName | the file name of the image to find |
file(String childName)
Returns: BlogFile
Finds one of this article's file attachments by the file name it was added under. Matching is exact and case sensitive.
| Parameter | Description |
|---|---|
childName | the file name of the attachment to find |
isLive(Date now)
Returns: boolean
Says whether the article is live, ie approved with an approval date which has already passed at the given time. An article approved with a future date is not live until then, and an article which has never been approved is never live.
| Parameter | Description |
|---|---|
now | the time to test against, normally the current date |
groupFilter()
Returns: Set<Group>
Resolves the stored group filter IDs into the groups which have been given visibility of this article. Groups belonging to another organisation are dropped, so the result only ever contains groups of the organisation which owns the blog. An empty set means the article is not restricted to any group.
updateGroupFilter(Iterable<Group> groups)
Returns: void
Replaces the article's group filter with the given groups, writing their IDs into the stored CSV. Pass an empty collection to remove the restriction. The article itself is not saved, so save it afterwards for the change to persist.
| Parameter | Description |
|---|---|
groups | the groups which should be able to see this article |
getAuditOrg()
Returns: Organisation
The organisation this article's audit entries are recorded against, being the organisation which owns the blog.