A message shown on the dashboard of a website or of the admin console, optionally narrowed to a particular audience. An alert belongs to an organisation and, when it is a website alert rather than an admin alert, to a website. Its audience is narrowed by target group, target organisation and target org type, which are combined with AND, so a reader must match every filter that is set. The control field decides when it shows: always enabled, disabled, only once an event has activated it for a particular profile, or inherited down to child organisations and their websites. Start and end dates are recorded on the row but are not applied by the active checks; readers dismiss an alert by acknowledging it, which is stored as a separate AlertAck row rather than on the alert itself.
Group: Database Entities
Implements: Serializable, IAlert, Relational
Properties
| Property | Returns | Description |
|---|---|---|
| alert | Alert | The alert behind this record. An Alert is its own alert, so this returns itself; it exists so alerts and other alert-carrying beans can be handled through one interface. Not persisted. |
| allowDismiss | boolean | Whether a reader may dismiss the alert. When false it stays visible for as long as it is active. |
| author | Profile | The profile which created the alert, recorded when it is created. May be null for an alert created without a logged in author. |
| body | String | The message shown to the reader, as HTML, up to 4096 characters. May be null for an alert that only carries a title. |
| childOrgTargets | String | Which child organisations and websites a child-org-websites alert reaches, as a comma separated list. Each entry is either an account id on its own, or an account id and a website id joined by a hyphen to target one website. Blank or null means every child organisation website. |
| control | String | When this alert shows, as a code from the CONTROL enum: enabled to show it always, disabled to hide it, event to show it only to profiles an event has activated it for, child-orgs to show it in child organisations' admin consoles, or child-org-websites to show it on child organisations' websites. |
| deleted | boolean | Whether this alert has been soft deleted. Deleted alerts stay in the database but every lookup on this class filters them out. |
| endDate | Date | The date the alert is intended to stop showing. Recorded for display only; the active checks on this class go by the control field, not by these dates. May be null. |
| id | long | Database identifier for this alert, assigned when it is first saved. |
| name | String | Portable, path-safe identifier used to look the alert up within a website or organisation, as opposed to the free-text title. May be null for an alert created without one. |
| org | Organisation | The organisation which owns this alert. For a website alert this is the website's organisation; for an admin alert it is the account the alert was created in. |
| position | String | Where the alert is placed on the page, either top or bottom. |
| startDate | Date | The date the alert is intended to start showing from. Recorded for display and ordering only; the active checks on this class go by the control field, not by these dates. May be null. |
| targetGroup | Group | Optional audience filter naming a group: the reader must be a member of it. Combined with the target organisation and target org type filters using AND. Null means the filter is not applied. |
| targetOrg | Organisation | Optional audience filter naming a single organisation: the reader must have a membership in it. Combined with the target group and target org type filters using AND. Null means the filter is not applied. |
| targetOrgType | OrgType | Optional audience filter which is combined with the target group and target organisation using AND: the reader must belong to an organisation carrying this org type. Unlike the target organisation, which names one organisation, this targets every organisation of a kind, for example all distributors. Null means the filter is not applied. |
| title | String | Free-text heading displayed above the alert body. Has no uniqueness or path-safety guarantee, so never use it as an identifier. May be null. |
| type | String | The visual style the alert is rendered in: info, primary, warning, danger, success, or modal-popup for one that interrupts the reader rather than sitting in the page. |
| website | Website | The website whose dashboard shows this alert. Null for an admin alert, which shows in the admin console of the owning organisation instead. |
Methods
getId() · getName() · setName(String name) · getTitle() · setTitle(String title) · getType() · setType(String type) · getPosition() · setPosition(String position) · isAllowDismiss() · setAllowDismiss(boolean allowDismiss) · getStartDate() · setStartDate(Date startDate) · getEndDate() · setEndDate(Date endDate) · getOrg() · setOrg(Organisation org) · getWebsite() · setWebsite(Website website) · getTargetOrg() · setTargetOrg(Organisation targetOrg) · getTargetGroup() · setTargetGroup(Group targetGroup) · getTargetOrgType() · setTargetOrgType(OrgType targetOrgType) · getAuthor() · setAuthor(Profile author) · getBody() · setBody(String body) · getControl() · setControl(String control) · isDeleted() · setDeleted(boolean deleted) · getChildOrgTargets() · setChildOrgTargets(String childOrgTargets) · getAlert() · rowId()
getId()
Returns: long
Database identifier for this alert, assigned when it is first saved.
getName()
Returns: String
Portable, path-safe identifier used to look the alert up within a website or organisation, as opposed to the free-text title. May be null for an alert created without one.
setName(String name)
Returns: void
Sets the path-safe lookup name for this alert. Keep it unique within the owning website or organisation, since lookups by name expect a single match.
| Parameter | Description |
|---|---|
name | the name to set |
getTitle()
Returns: String
Free-text heading displayed above the alert body. Has no uniqueness or path-safety guarantee, so never use it as an identifier. May be null.
setTitle(String title)
Returns: void
Sets the free-text heading shown to readers. Up to 1000 characters.
| Parameter | Description |
|---|---|
title | the display title to set |
getType()
Returns: String
The visual style the alert is rendered in: info, primary, warning, danger, success, or modal-popup for one that interrupts the reader rather than sitting in the page.
setType(String type)
Returns: void
Sets the visual style, using one of the TYPE constants on this class.
| Parameter | Description |
|---|---|
type | the alert type to set |
getPosition()
Returns: String
Where the alert is placed on the page, either top or bottom.
setPosition(String position)
Returns: void
Sets where the alert is placed on the page, using one of the POS constants on this class.
| Parameter | Description |
|---|---|
position | the position to set |
isAllowDismiss()
Returns: boolean
Whether a reader may dismiss the alert. When false it stays visible for as long as it is active.
setAllowDismiss(boolean allowDismiss)
Returns: void
Sets whether readers may dismiss the alert.
| Parameter | Description |
|---|---|
allowDismiss | true to let readers dismiss it |
getStartDate()
Returns: Date
The date the alert is intended to start showing from. Recorded for display and ordering only; the active checks on this class go by the control field, not by these dates. May be null.
setStartDate(Date startDate)
Returns: void
Sets the intended start date.
| Parameter | Description |
|---|---|
startDate | the start date to set, or null for none |
getEndDate()
Returns: Date
The date the alert is intended to stop showing. Recorded for display only; the active checks on this class go by the control field, not by these dates. May be null.
setEndDate(Date endDate)
Returns: void
Sets the intended end date.
| Parameter | Description |
|---|---|
endDate | the end date to set, or null for none |
getOrg()
Returns: Organisation
The organisation which owns this alert. For a website alert this is the website's organisation; for an admin alert it is the account the alert was created in.
setOrg(Organisation org)
Returns: void
Sets the owning organisation.
| Parameter | Description |
|---|---|
org | the organisation to own this alert |
getWebsite()
Returns: Website
The website whose dashboard shows this alert. Null for an admin alert, which shows in the admin console of the owning organisation instead.
setWebsite(Website website)
Returns: void
Sets the website this alert belongs to, or null to make it an admin alert.
| Parameter | Description |
|---|---|
website | the website to show the alert on, or null for an admin alert |
getTargetOrg()
Returns: Organisation
Optional audience filter naming a single organisation: the reader must have a membership in it. Combined with the target group and target org type filters using AND. Null means the filter is not applied.
setTargetOrg(Organisation targetOrg)
Returns: void
Narrows the audience to members of one organisation, or clears that filter.
| Parameter | Description |
|---|---|
targetOrg | the organisation to narrow to, or null for no organisation filter |
getTargetGroup()
Returns: Group
Optional audience filter naming a group: the reader must be a member of it. Combined with the target organisation and target org type filters using AND. Null means the filter is not applied.
setTargetGroup(Group targetGroup)
Returns: void
Narrows the audience to members of one group, or clears that filter.
| Parameter | Description |
|---|---|
targetGroup | the group to narrow to, or null for no group filter |
getTargetOrgType()
Returns: OrgType
Optional audience filter which is combined with the target group and target organisation using AND: the reader must belong to an organisation carrying this org type. Unlike the target organisation, which names one organisation, this targets every organisation of a kind, for example all distributors. Null means the filter is not applied.
setTargetOrgType(OrgType targetOrgType)
Returns: void
Narrows the audience to members of organisations carrying one org type, or clears that filter.
| Parameter | Description |
|---|---|
targetOrgType | the org type to narrow to, or null for no org type filter |
getAuthor()
Returns: Profile
The profile which created the alert, recorded when it is created. May be null for an alert created without a logged in author.
setAuthor(Profile author)
Returns: void
Sets the profile recorded as the author of this alert.
| Parameter | Description |
|---|---|
author | the authoring profile, or null for none |
getBody()
Returns: String
The message shown to the reader, as HTML, up to 4096 characters. May be null for an alert that only carries a title.
setBody(String body)
Returns: void
Sets the message shown to the reader. Up to 4096 characters.
| Parameter | Description |
|---|---|
body | the alert body to set |
getControl()
Returns: String
When this alert shows, as a code from the CONTROL enum: enabled to show it always, disabled to hide it, event to show it only to profiles an event has activated it for, child-orgs to show it in child organisations' admin consoles, or child-org-websites to show it on child organisations' websites.
setControl(String control)
Returns: void
Sets when this alert shows, using a code from the CONTROL enum. New alerts start out disabled.
| Parameter | Description |
|---|---|
control | the control code to set |
isDeleted()
Returns: boolean
Whether this alert has been soft deleted. Deleted alerts stay in the database but every lookup on this class filters them out.
setDeleted(boolean deleted)
Returns: void
Soft deletes or restores this alert. Setting it true hides the alert from every lookup without removing the row.
| Parameter | Description |
|---|---|
deleted | true to delete the alert, false to restore it |
getChildOrgTargets()
Returns: String
Which child organisations and websites a child-org-websites alert reaches, as a comma separated list. Each entry is either an account id on its own, or an account id and a website id joined by a hyphen to target one website. Blank or null means every child organisation website.
setChildOrgTargets(String childOrgTargets)
Returns: void
Sets which child organisations and websites a child-org-websites alert reaches, as a comma separated list of account ids, optionally each followed by a hyphen and a website id. An invalid entry causes the alert to be rejected when the list is evaluated, so only ids may appear in it.
| Parameter | Description |
|---|---|
childOrgTargets | the child org target list to set, or null for every child organisation website |
getAlert()
Returns: Alert
The alert behind this record. An Alert is its own alert, so this returns itself; it exists so alerts and other alert-carrying beans can be handled through one interface. Not persisted.
rowId()
Returns: Long
The database identifier for this alert, as the generic row id used across Kademi entities. Same value as the id.