Represents a single dashboard alert as a web resource, at "alert-{id}" under an organisation or website folder, and serves both the manage-alert admin page and the JSON endpoint used to post edits or acknowledge the alert. A GET renders the manage-alert admin template (or nothing, on a website root folder); a POST either records an acknowledgement for the current user (when the "ack" parameter is present) or saves the edited alert fields (when a "body" parameter is present), binding the posted target group, target organisation and target org type by name or id. Deleting the resource soft-deletes the underlying Alert row rather than removing it.

Group: Resources

Extends: AbstractResource

Implements: GetableResource, PostableResource, TitledPage, DeletableResource, ContentPermissionsResource


Properties

PropertyReturnsDescription
alertEndDateDateThe date the alert stops being active.
alertNameStringThe alert's portable name, falling back to a URL-safe version of its title when no name is set.
alertStartDateDateThe date from which the alert becomes active.
allControlStatesList<String>The control state codes an alert can be set to, for populating the status/audience picker in the editor.
allowDismissbooleanWhether a viewer is allowed to dismiss this alert from their dashboard.
allPositionsList<String>The dashboard positions an alert can be placed at, for populating the position picker in the editor.
allTypesList<String>The display types an alert can be set to, for populating the type picker in the editor.
authorProfileThe profile that authored this alert.
bodyStringThe alert's message body markup.
breadCrumbsMap<String,String>The breadcrumb trail shown above the manage-alert admin page: a single entry linking back to the dashboard alerts list.
childOrgTargetsStringThe raw child-org-targeting configuration stored on the alert, used when the alert's control state extends its audience to child organisations or child organisation websites.
contentManagedPermissionsbooleanWhether this resource's read/write permissions are managed as content permissions rather than inherited plainly. Always true for a dashboard alert.
controlStringThe alert's control state code, one of the Alert.CONTROL codes.
dismissCountlongHow many people have dismissed this alert. Only meaningful while dismissing is allowed, but it is not gated on that here - an alert whose dismiss setting was turned off still really was dismissed by those people, and hiding the count would lose that.
endDateStringThe alert's end date, formatted for display.
groupsList<Group>The groups belonging to this alert's organisation, for populating the target-group picker in the editor.
idlongThe wrapped alert's database id. Zero for an alert that has not yet been saved.
nameStringThis resource's URL segment name, "alert-{id}" (or "alert-new" for an unsaved alert).
orgTypesList<OrgType>The org types the editor's org type picker offers. Org types belong to the account, which is the current tenant org - the same list OrganisationManager.getAllOrgTypes() returns, so the picker and the value posted back always agree.
parentCommonCollectionResourceThe folder this alert page lives under: either an OrganisationFolder (admin dashboard alert) or a BranchFolder (website alert).
positionStringWhere on the dashboard the alert is displayed, Alert.POS_TOP or Alert.POS_BOTTOM.
startDateStringThe alert's start date, formatted for display.
targetGroupStringThe name of the group this alert is targeted at.
targetOrgLongThe id of the organisation this alert is targeted at, when its audience extends to a specific child organisation.
targetOrgNameStringThe formatted display name of the organisation this alert is targeted at.
targetOrgTypeStringThe name of the org type this alert is targeted at, when its audience extends to every organisation of a given type.
titleStringThe alert's title, falling back to "Alert {id}" when the alert has no title set.
typeStringThe alert's display type, one of the Alert.TYPE constants.

Inherited from AbstractResource

Properties

PropertyReturnsDescription
accessControlListMap<Principal,List<Priviledge>>The access control list of allowed privileges per principal for this resource. This implementation is not populated; access is instead resolved dynamically via the security manager, so this always returns null.
asListResourceListThis resource wrapped as a single-element ResourceList, convenient for scripts that want to treat a single resource the same way as a list of resources.
attributesMap<String,Object>A mutable, request-scoped map of arbitrary attributes attached to this resource instance, for passing values between code that shares a reference to the same resource.
createDateDateThe date this resource was created. This base implementation always returns null; subclasses that track creation dates override it.
dirbooleanWhether this resource is a collection (folder-like) resource rather than a single item.
hrefStringThe URL-encoded path to this resource, suitable for use as a browser or WebDAV href. Collection resources get a trailing slash.
linkStringA ready-to-use HTML anchor tag linking to this resource's href, using its name as the link text.
modifiedDateDateThe date this resource was last modified. This base implementation always returns null; subclasses that track modification dates override it.
oAuth2ProvidersMap<String,OAuth2Provider>The OAuth2 login providers available for this resource, combining the providers configured on the social login app with the platform's built-in social posting services mapped onto their OAuth2 provider templates.
pathPathThe path of this resource within its resource tree, built by appending this resource's name to its parent's path, as a Path object with convenient path manipulation methods.
principalCollectionHrefsHrefListThe hrefs of the collections that contain principals, so a WebDAV client can discover where to list users. This base implementation always returns the single href "/users/".
principalURLStringThe href of the owning principal resource for this resource, found by walking up the parent chain to the nearest principal resource.
publicbooleanWhether this resource is readable by anonymous, unauthenticated users. This base implementation always returns false; subclasses override it where public content is allowed.
readablebooleanWhether the current user, who may be null for an anonymous request, has READ_CONTENT permission on this resource.
realmStringThe HTTP authentication realm used for digest and basic authentication challenges on this resource.
uniqueIdStringA unique identifier for this resource. This base implementation always returns null; resource types that need a stable id (for example content resources) override it.
writablebooleanWhether the current user, who may be null for an anonymous request, has WRITE_CONTENT permission on this resource.

Methods

getUniqueId() · getRealm() · getPrincipalURL() · getPrincipalCollectionHrefs() · getPath() · getHref() · getLink() · isPublic() · find(String path) · find(Path p) · isDir() · getContentType(String accepts) · getModifiedDate() · getCreateDate() · getAccessControlList() · closest(String type) · closest(Class<T> c) · isReadable() · isWritable() · getAsList() · getOAuth2Providers() · getAttributes()

getUniqueId()

Returns: String

A unique identifier for this resource. This base implementation always returns null; resource types that need a stable id (for example content resources) override it.

getRealm()

Returns: String

The HTTP authentication realm used for digest and basic authentication challenges on this resource.

getPrincipalURL()

Returns: String

The href of the owning principal resource for this resource, found by walking up the parent chain to the nearest principal resource.

getPrincipalCollectionHrefs()

Returns: HrefList

The hrefs of the collections that contain principals, so a WebDAV client can discover where to list users. This base implementation always returns the single href "/users/".

getPath()

Returns: Path

The path of this resource within its resource tree, built by appending this resource's name to its parent's path, as a Path object with convenient path manipulation methods.

getHref()

Returns: String

The URL-encoded path to this resource, suitable for use as a browser or WebDAV href. Collection resources get a trailing slash.

Returns: String

A ready-to-use HTML anchor tag linking to this resource's href, using its name as the link text.

isPublic()

Returns: boolean

Whether this resource is readable by anonymous, unauthenticated users. This base implementation always returns false; subclasses override it where public content is allowed.

find(String path)

Returns: Resource

Finds a resource within the website by its path. A relative path is evaluated relative to this resource; an absolute path is evaluated from the website root. For example find("/programs/p1") looks up the program p1 from the root, and find("../p1") looks up p1 in the folder above this resource.

ParameterDescription
paththe relative or absolute path to resolve

find(Path p)

Returns: Resource

Finds a resource by walking a Path object one part at a time, following "." and ".." segments and looking up each remaining part as a child of the current resource.

ParameterDescription
pthe path to resolve, relative to this resource or absolute

isDir()

Returns: boolean

Whether this resource is a collection (folder-like) resource rather than a single item.

getContentType(String accepts)

Returns: String

The content type this resource should be served as. This base implementation always returns "text/html; charset=UTF-8" for getable resources (regardless of the accepts header, since XHTML is not used because of CKEditor compatibility) and an empty string otherwise. Subclasses override this where a different content type is needed.

ParameterDescription
acceptsthe client's Accept header value, currently not used to vary the result

getModifiedDate()

Returns: Date

The date this resource was last modified. This base implementation always returns null; subclasses that track modification dates override it.

getCreateDate()

Returns: Date

The date this resource was created. This base implementation always returns null; subclasses that track creation dates override it.

getAccessControlList()

Returns: Map<Principal,List<Priviledge>>

The access control list of allowed privileges per principal for this resource. This implementation is not populated; access is instead resolved dynamically via the security manager, so this always returns null.

closest(String type)

Returns: CommonResource

Finds the closest resource, starting from this one and walking up through its parents, whose is(type) returns true.

ParameterDescription
typethe type name to match, as used by is(String)

closest(Class<T> c)

Returns: T

Finds the closest resource, starting from this one and walking up through its parents, that is an instance of the given class.

ParameterDescription
cthe class to match against

isReadable()

Returns: boolean

Whether the current user, who may be null for an anonymous request, has READ_CONTENT permission on this resource.

isWritable()

Returns: boolean

Whether the current user, who may be null for an anonymous request, has WRITE_CONTENT permission on this resource.

getAsList()

Returns: ResourceList

This resource wrapped as a single-element ResourceList, convenient for scripts that want to treat a single resource the same way as a list of resources.

getOAuth2Providers()

Returns: Map<String,OAuth2Provider>

The OAuth2 login providers available for this resource, combining the providers configured on the social login app with the platform's built-in social posting services mapped onto their OAuth2 provider templates.

getAttributes()

Returns: Map<String,Object>

A mutable, request-scoped map of arbitrary attributes attached to this resource instance, for passing values between code that shares a reference to the same resource.


Methods

getTitle() · getAlertName() · getId() · getChildOrgTargets() · getAuthor() · isExisting(Group targetGroup, String title) · getAllPositions() · getAllControlStates() · getAllTypes() · getParent() · getName() · getGroups() · getType() · getPosition() · getControl() · getBody() · getTargetGroup() · getTargetOrg() · getTargetOrgName() · getTargetOrgType() · getOrgTypes() · isAllowDismiss() · getDismissCount() · getStartDate() · getAlertStartDate() · getEndDate() · getAlertEndDate() · isContentManagedPermissions() · getBreadCrumbs()

getTitle()

Returns: String

The alert's title, falling back to "Alert {id}" when the alert has no title set.

getAlertName()

Returns: String

The alert's portable name, falling back to a URL-safe version of its title when no name is set.

getId()

Returns: long

The wrapped alert's database id. Zero for an alert that has not yet been saved.

getChildOrgTargets()

Returns: String

The raw child-org-targeting configuration stored on the alert, used when the alert's control state extends its audience to child organisations or child organisation websites.

getAuthor()

Returns: Profile

The profile that authored this alert.

isExisting(Group targetGroup, String title)

Returns: Alert

Finds another alert, in the same website or organisation and target group as this one, that already has the given title. Used to detect a duplicate title before saving. Never returns this alert itself.

ParameterDescription
targetGroupthe target group to search within, or null to search the organisation's own alerts
titlethe title to look for

getAllPositions()

Returns: List<String>

The dashboard positions an alert can be placed at, for populating the position picker in the editor.

getAllControlStates()

Returns: List<String>

The control state codes an alert can be set to, for populating the status/audience picker in the editor.

getAllTypes()

Returns: List<String>

The display types an alert can be set to, for populating the type picker in the editor.

getParent()

Returns: CommonCollectionResource

The folder this alert page lives under: either an OrganisationFolder (admin dashboard alert) or a BranchFolder (website alert).

getName()

Returns: String

This resource's URL segment name, "alert-{id}" (or "alert-new" for an unsaved alert).

getGroups()

Returns: List<Group>

The groups belonging to this alert's organisation, for populating the target-group picker in the editor.

getType()

Returns: String

The alert's display type, one of the Alert.TYPE constants.

getPosition()

Returns: String

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

getControl()

Returns: String

The alert's control state code, one of the Alert.CONTROL codes.

getBody()

Returns: String

The alert's message body markup.

getTargetGroup()

Returns: String

The name of the group this alert is targeted at.

getTargetOrg()

Returns: Long

The id of the organisation this alert is targeted at, when its audience extends to a specific child organisation.

getTargetOrgName()

Returns: String

The formatted display name of the organisation this alert is targeted at.

getTargetOrgType()

Returns: String

The name of the org type this alert is targeted at, when its audience extends to every organisation of a given type.

getOrgTypes()

Returns: List<OrgType>

The org types the editor's org type picker offers. Org types belong to the account, which is the current tenant org - the same list OrganisationManager.getAllOrgTypes() returns, so the picker and the value posted back always agree.

isAllowDismiss()

Returns: boolean

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

getDismissCount()

Returns: long

How many people have dismissed this alert. Only meaningful while dismissing is allowed, but it is not gated on that here - an alert whose dismiss setting was turned off still really was dismissed by those people, and hiding the count would lose that.

getStartDate()

Returns: String

The alert's start date, formatted for display.

getAlertStartDate()

Returns: Date

The date from which the alert becomes active.

getEndDate()

Returns: String

The alert's end date, formatted for display.

getAlertEndDate()

Returns: Date

The date the alert stops being active.

isContentManagedPermissions()

Returns: boolean

Whether this resource's read/write permissions are managed as content permissions rather than inherited plainly. Always true for a dashboard alert.

getBreadCrumbs()

Returns: Map<String,String>

The breadcrumb trail shown above the manage-alert admin page: a single entry linking back to the dashboard alerts list.

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