Wraps a persisted Alert as a read-only, display-ready view for rendering on the admin dashboard or a website page. Provides two constructors: one wraps a real Alert row (loaded by AlertsApp / AlertsManager), the other builds a synthetic bean for the legacy dashboard-message mechanism that predates the Alert entity, so both sources can be mixed into a single list of alerts for a template. Instances are throwaway view objects, not persisted themselves.

Implements: IAlert


Properties

PropertyReturnsDescription
alertAlertThe underlying persisted Alert entity this bean wraps, or null when this bean represents a legacy dashboard message that has no Alert row behind it.
allowDismissbooleanWhether a viewer is allowed to dismiss this alert from their dashboard.
bodyStringThe alert's message body, rendered as HTML on the dashboard.
controlStringThe alert's control state, one of the Alert.CONTROL codes (for example "enabled", "disabled" or "event"). Null for a legacy dashboard message.
descriptionStringA short HTML summary of the alert, combining its type label, target website, target group, start date and whether it is event-activated, for display in the manage-alerts list.
hrefStringThe link used to acknowledge this alert, built by appending the alert's page prefix and id to the base href that was passed to the constructor.
idStringThe wrapped alert's database id, as a string. Null for a legacy dashboard message.
nameStringThe alert's portable, URL-safe name, used as the alert's identifier when syncing account configuration. Null for a legacy dashboard message, which has no Alert entity behind it.
positionStringWhere on the dashboard the alert is rendered, either Alert.POS_TOP or Alert.POS_BOTTOM.
startDateDateThe date from which the wrapped alert becomes active. Requires the wrapped Alert entity, so this throws for a legacy dashboard message bean built from the string constructor.
textDescriptionStringA plain-text equivalent of getDescription, combining the alert's type, target website, target group, start date and control state, for contexts that cannot render the HTML version.
titleStringThe alert's title. Falls back to the literal text "[No title]" when the wrapped alert has no title set.
typeStringThe alert's display type, one of the Alert.TYPE constants (for example "info" or "danger"), used to pick the Bootstrap alert style when rendering.
websiteNameStringThe name of the website the alert belongs to, or null if the alert is not scoped to a website (for example an admin dashboard alert).

Methods

getControl() · getName() · getId() · getType() · getWebsiteName() · getHref() · getPosition() · getBody() · getTitle() · getAlert() · getStartDate() · activationDate(Profile profile) · getDescription() · getTextDescription() · isAllowDismiss()

getControl()

Returns: String

The alert's control state, one of the Alert.CONTROL codes (for example "enabled", "disabled" or "event"). Null for a legacy dashboard message.

getName()

Returns: String

The alert's portable, URL-safe name, used as the alert's identifier when syncing account configuration. Null for a legacy dashboard message, which has no Alert entity behind it.

getId()

Returns: String

The wrapped alert's database id, as a string. Null for a legacy dashboard message.

getType()

Returns: String

The alert's display type, one of the Alert.TYPE constants (for example "info" or "danger"), used to pick the Bootstrap alert style when rendering.

getWebsiteName()

Returns: String

The name of the website the alert belongs to, or null if the alert is not scoped to a website (for example an admin dashboard alert).

getHref()

Returns: String

The link used to acknowledge this alert, built by appending the alert's page prefix and id to the base href that was passed to the constructor.

getPosition()

Returns: String

Where on the dashboard the alert is rendered, either Alert.POS_TOP or Alert.POS_BOTTOM.

getBody()

Returns: String

The alert's message body, rendered as HTML on the dashboard.

getTitle()

Returns: String

The alert's title. Falls back to the literal text "[No title]" when the wrapped alert has no title set.

getAlert()

Returns: Alert

The underlying persisted Alert entity this bean wraps, or null when this bean represents a legacy dashboard message that has no Alert row behind it.

getStartDate()

Returns: Date

The date from which the wrapped alert becomes active. Requires the wrapped Alert entity, so this throws for a legacy dashboard message bean built from the string constructor.

activationDate(Profile profile)

Returns: Date

When the given profile first saw this alert become active: the date of their most recent acknowledgement of it, or the alert's start date if they have never acknowledged it.

ParameterDescription
profilethe profile whose acknowledgement history is checked

getDescription()

Returns: String

A short HTML summary of the alert, combining its type label, target website, target group, start date and whether it is event-activated, for display in the manage-alerts list.

getTextDescription()

Returns: String

A plain-text equivalent of getDescription, combining the alert's type, target website, target group, start date and control state, for contexts that cannot render the HTML version.

isAllowDismiss()

Returns: boolean

Whether a viewer is allowed to dismiss this alert from their dashboard.

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