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
| Property | Returns | Description |
|---|---|---|
| alertEndDate | Date | The date the alert stops being active. |
| alertName | String | The alert's portable name, falling back to a URL-safe version of its title when no name is set. |
| alertStartDate | Date | The date from which the alert becomes active. |
| allControlStates | List<String> | The control state codes an alert can be set to, for populating the status/audience picker in the editor. |
| allowDismiss | boolean | Whether a viewer is allowed to dismiss this alert from their dashboard. |
| allPositions | List<String> | The dashboard positions an alert can be placed at, for populating the position picker in the editor. |
| allTypes | List<String> | The display types an alert can be set to, for populating the type picker in the editor. |
| author | Profile | The profile that authored this alert. |
| body | String | The alert's message body markup. |
| breadCrumbs | Map<String,String> | The breadcrumb trail shown above the manage-alert admin page: a single entry linking back to the dashboard alerts list. |
| childOrgTargets | 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. |
| contentManagedPermissions | boolean | Whether this resource's read/write permissions are managed as content permissions rather than inherited plainly. Always true for a dashboard alert. |
| control | String | The alert's control state code, one of the Alert.CONTROL codes. |
| dismissCount | 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. |
| endDate | String | The alert's end date, formatted for display. |
| groups | List<Group> | The groups belonging to this alert's organisation, for populating the target-group picker in the editor. |
| id | long | The wrapped alert's database id. Zero for an alert that has not yet been saved. |
| name | String | This resource's URL segment name, "alert-{id}" (or "alert-new" for an unsaved alert). |
| orgTypes | 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. |
| parent | CommonCollectionResource | The folder this alert page lives under: either an OrganisationFolder (admin dashboard alert) or a BranchFolder (website alert). |
| position | String | Where on the dashboard the alert is displayed, Alert.POS_TOP or Alert.POS_BOTTOM. |
| startDate | String | The alert's start date, formatted for display. |
| targetGroup | String | The name of the group this alert is targeted at. |
| targetOrg | Long | The id of the organisation this alert is targeted at, when its audience extends to a specific child organisation. |
| targetOrgName | String | The formatted display name of the organisation this alert is targeted at. |
| targetOrgType | String | The name of the org type this alert is targeted at, when its audience extends to every organisation of a given type. |
| title | String | The alert's title, falling back to "Alert {id}" when the alert has no title set. |
| type | String | The alert's display type, one of the Alert.TYPE constants. |
Inherited from AbstractResource
Properties
| Property | Returns | Description |
|---|---|---|
| accessControlList | 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. |
| asList | 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. |
| attributes | 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. |
| createDate | Date | The date this resource was created. This base implementation always returns null; subclasses that track creation dates override it. |
| dir | boolean | Whether this resource is a collection (folder-like) resource rather than a single item. |
| href | String | The URL-encoded path to this resource, suitable for use as a browser or WebDAV href. Collection resources get a trailing slash. |
| link | String | A ready-to-use HTML anchor tag linking to this resource's href, using its name as the link text. |
| modifiedDate | Date | The date this resource was last modified. This base implementation always returns null; subclasses that track modification dates override it. |
| oAuth2Providers | 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. |
| path | 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. |
| principalCollectionHrefs | 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/". |
| principalURL | String | The href of the owning principal resource for this resource, found by walking up the parent chain to the nearest principal resource. |
| public | boolean | Whether this resource is readable by anonymous, unauthenticated users. This base implementation always returns false; subclasses override it where public content is allowed. |
| readable | boolean | Whether the current user, who may be null for an anonymous request, has READ_CONTENT permission on this resource. |
| realm | String | The HTTP authentication realm used for digest and basic authentication challenges on this resource. |
| uniqueId | 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. |
| writable | boolean | Whether 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.
getLink()
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.
| Parameter | Description |
|---|---|
path | the 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.
| Parameter | Description |
|---|---|
p | the 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.
| Parameter | Description |
|---|---|
accepts | the 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.
| Parameter | Description |
|---|---|
type | the 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.
| Parameter | Description |
|---|---|
c | the 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.
| Parameter | Description |
|---|---|
targetGroup | the target group to search within, or null to search the organisation's own alerts |
title | the 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.