Adds the dashboard alerts feature: banner messages shown at the top or bottom of the admin dashboard or a website, targeted by organisation, group and time window. Registers the "manageAlerts" admin page and the per-alert DashboardAlertPage under a website branch, contributes the alerts KEditor component and a journey-builder node for activating an alert from a journey, and renders the dashboard alert portlets by delegating to AlertsManager for lookup. createAdminAlert and createAlert are called from server-side scripts (kcode) to raise alerts programmatically. Also backs up and restores an organisation's alerts as part of account configuration export/import.

Implements: MenuApplication, ChildPageApplication, PortletApplication, ComponentApplication, JourneyBuilderApplication, FieldProviderApplication, DependentApplication, TemplatingApplication, BackupableApplication


Properties

PropertyReturnsDescription
bottomMessagesList<AlertBean>The alerts positioned at the bottom of the dashboard for the current user and root folder.
instanceIdStringThe app's registration id, "alerts", used to key its config and stored data in account backup/restore.
rolesList<Role>The roles this app contributes. Always null; the alerts app does not register any of its own roles.
topMessagesList<AlertBean>The alerts positioned at the top of the dashboard for the current user and root folder.

Methods

getInstanceId() · getTopMessages() · getBottomMessages() · getMessages(RootFolder rootFolder, Profile p, String forPosition) · getAcknowledgedMessages(RootFolder rootFolder, Profile p, String forPosition) · getAlertAckDateForProfile(Alert alert, Profile profile) · getAlertActivationDateForProfile(Alert alert, Profile profile) · createAdminAlert(String title, String message) · createAdminAlert(String title, String message, int days) · createAdminAlert(String title, String message, String type, int days) · createAlert(OrgData org, String websiteName, String title, String message, String type, String groupName) · createAlert(OrgData org, String websiteName, String title, String message, String groupName, String type, Date start, Date end) · getRoles()

getInstanceId()

Returns: String

The app's registration id, "alerts", used to key its config and stored data in account backup/restore.

getTopMessages()

Returns: List<AlertBean>

The alerts positioned at the top of the dashboard for the current user and root folder.

getBottomMessages()

Returns: List<AlertBean>

The alerts positioned at the bottom of the dashboard for the current user and root folder.

getMessages(RootFolder rootFolder, Profile p, String forPosition)

Returns: List<AlertBean>

Finds the alerts, current and legacy, that apply to the given profile at the given dashboard position. Merges alerts found through AlertsManager with any matching legacy dashboard messages read from group properties.

ParameterDescription
rootFolderthe root folder whose website and organisation scope the search
pthe profile the alerts are targeted at; if null, an empty list is returned
forPositionthe dashboard position to filter by, Alert.POS_TOP or Alert.POS_BOTTOM

getAcknowledgedMessages(RootFolder rootFolder, Profile p, String forPosition)

Returns: List<AlertBean>

The alerts the given profile has already acknowledged at the given dashboard position.

ParameterDescription
rootFolderunused; the search is scoped by the profile alone
pthe profile whose acknowledged alerts are looked up
forPositionthe dashboard position to filter by, Alert.POS_TOP or Alert.POS_BOTTOM

getAlertAckDateForProfile(Alert alert, Profile profile)

Returns: Date

The date the given profile acknowledged the given alert, or null if they have not acknowledged it.

ParameterDescription
alertthe alert to check
profilethe profile whose acknowledgement is looked up

getAlertActivationDateForProfile(Alert alert, Profile profile)

Returns: Date

The date the given alert became active for the given profile: their acknowledgement date if they have acknowledged it, otherwise the alert's start date.

ParameterDescription
alertthe alert to check
profilethe profile the activation date is calculated for

createAdminAlert(String title, String message)

Returns: String

Creates an info-type alert for the current organisation's admin dashboard, active for 30 days from now.

ParameterDescription
titlethe alert's title
messagethe alert body

createAdminAlert(String title, String message, int days)

Returns: String

Creates an info-type alert for the current organisation's admin dashboard, active for the given number of days from now.

ParameterDescription
titlethe alert's title
messagethe alert body
dayshow many days from now the alert stays active

createAdminAlert(String title, String message, String type, int days)

Returns: String

Creates a dismissable, enabled alert for the current organisation's admin dashboard, active for the given number of days from now, authored by the current user.

ParameterDescription
titlethe alert's title
messagethe alert body
typethe display type, one of the Alert.TYPE constants
dayshow many days from now the alert stays active

createAlert(OrgData org, String websiteName, String title, String message, String type, String groupName)

Returns: String

Creates a dismissable, enabled alert targeted at the given group, with no start or end date, either on a website (if websiteName is given) or on the organisation's admin dashboard.

ParameterDescription
orgthe organisation the alert is created in
websiteNamethe name of the website to target, or null to target the admin dashboard
titlethe alert's title
messagethe alert body
typethe display type, one of the Alert.TYPE constants
groupNamethe name of the group the alert is targeted at

createAlert(OrgData org, String websiteName, String title, String message, String groupName, String type, Date start, Date end)

Returns: String

Creates a dismissable, enabled alert targeted at the given group, either on a website (if websiteName is given) or on the organisation's admin dashboard, active over the given date range.

ParameterDescription
orgthe organisation the alert is created in
websiteNamethe name of the website to target, or null to target the admin dashboard
titlethe alert's title
messagethe alert body
groupNamethe name of the group the alert is targeted at
typethe display type, one of the Alert.TYPE constants
startthe date the alert becomes active, may be null
endthe date the alert stops being active, may be null

getRoles()

Returns: List<Role>

The roles this app contributes. Always null; the alerts app does not register any of its own roles.

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