Skip to main content
Version: 2025.1

notification

JDITO-Funktionen für Notification

Methods

addNotification

addNotification(pContentId, pLinkInfo, pImageInfo, pOriginatorName, pType, pForcedPriority, pDaysToLive, pState, pUser, pCaption, pDescription, pSubcategory?): void

Adds a new notification for delivery.

Parameters

pContentId
string | number | boolean

ContentId that will point the notificationcontent. Using same ContentId will version-up the Notification.

pLinkInfo
string | number | boolean

Info parameter for the open-process (json format).

pImageInfo
string | number | boolean

Option 1 (null): Notification takes Icon from its Type (recommended) Option 2 (for example: VAADIN:CHECK): Notification gets this icon Option 3 (Image): ???

pOriginatorName
string | number | boolean

Name of the originator in the notification popup.

pType
string | number | boolean

Type of the notification, can be any type, defined in notificationtypes.

pForcedPriority

For example: ENotificationPriority.MAX (from MAX, HIGH, NORMAL, LOW, MIN, NONE); not changable from user. null and NONE have same effect -> userPrio or typeDefault take over

pDaysToLive
number

Days the notification lives. -1 is infinite

pState

Initial notification state ("UNSEEN", "SEEN" (user has seen the notification but not interacted with it), "CONFIRMED" (user has interacted with the notification), "DELETED", "ARCHIVE").

pUser
string[]

Array of user ids. 'null' for notification to the current user.

pCaption
string | number | boolean

Caption of the notification.

pDescription
string | number | boolean

Description of the notification.

pSubcategory?
string | number | boolean

The subcategory as String

Returns

void

Throws

May throw an exception.


addNotificationWith

addNotificationWith(pConfig): void

Adds a new notification for delivery.

Parameters

pConfig

the configuration

Returns

void

Throws

May throw an exception.

Throws

AditoIllegalArgumentException

Throws

AditoIllegalStateException


createConfig

createConfig(): NotificationConfig

Creates and returns a new configuration object for a notification.

Returns

NotificationConfig


createUpdateStrategy

createUpdateStrategy(): UpdateStrategyConfig

creates an object that can be used to get a NotificationUpdateStrategy for the updateUserNotificationsStateWithRecordsRecipe method

Returns


deleteContentIfOrphan

deleteContentIfOrphan(pNotificationId, pContentId): void

DEPRECATED please use deleteMultipleContentsIfOrphan-Method

Parameters

pNotificationId
string | number | boolean

no longer in use, set null

pContentId
string | number | boolean

contentid of notification to delete. Always needed

Returns

void

deleteMultipleContentsIfOrphan

deleteMultipleContentsIfOrphan(pContentIds): void

Checks if contents still used in one or more usernotifications, if not, it will be deleted, due to no usage.

Parameters

pContentIds
string[]

contentids of notifications to delete. Always needed

Returns

void

getAllTypes

getAllTypes(): any[]

Loads all Notificationtypes exitsting.

Returns

any[]

Array of Notificationtypes

Throws

May throw an exception.


getCustomTypes

getCustomTypes(): any[]

Loads all custom Notificationtypes exitsting.

Returns

any[]

Array of custom Notificationtypes

Throws

May throw an exception.


getType

getType(pTypeCode): Map<any, any>

Loads a Notificationtype

Parameters

pTypeCode
string | number | boolean

name of the type to load

Returns

Map<any, any>

Map of Type Properties

Throws

May throw an exception.


getUserNotifications

getUserNotifications(pUserId, pStates, pSubcategories): Map<any, any>[]

Loads all Notifications of a specific user, filtert by given states.

Parameters

pUserId
string | number | boolean

(_____USER_XXX...)

pStates

all the states, the loaded notifications should have (for example notification.USEEN)

pSubcategories
string[]

Returns

Map<any, any>[]

updateUserNotificationsState

updateUserNotificationsState(pUserId, pUids, pNewState): void

Sets the state of an array of usernotifications. User for Notification-Deletions -> new State: TODELETE or TODELETE_IF_NOT_ARCHIVED

Parameters

pUserId
string | number | boolean

the Uid of the user

pUids
string[]

the notificationids array(not contentid)

pNewState

the new state

Returns

void

updateUserNotificationsStateBulk

updateUserNotificationsStateBulk(pUserId, pEntityRecordsRecipe, pNewState, pUpdateStrategy): void

Sets the state for notifications by loading the described data blockwise and then updating the notifications via the notification-backend.

To describe where the data needs to be loaded from an EntityRecordsRecipe is passed.

It is necessary that while loading the data the following records are excluded:

  • Records that have already the newly set state

  • Records that can not be updated to the new state

This can be done by either:

  • Defining this in the given RecordsRecipe

  • Passing a matching UpdateStrategy, for example the "withTypeAndStateExclusion" strategy will extend the passed filter automatically

Parameters

pUserId
string | number | boolean

the Uid of the user; This is in fact the NAME-property of a user, for example "_____USER_eda27977-6353-41d2-ac94-76947ee0a550"

pEntityRecordsRecipe
any

the RecordsRecipe of the notification entity that shall be used for loading and updating the affected data. This can be passed as a String or a RecordsRecipe-object or as the RecordsRecipeBuilder. RecordsRecipe needs to describe an amount of records where the #UID-field of the entity is the uid of a notification. (not the contentId though!) If the uids-property of the given RecordsRecipe is set to an empty array this method will not update anything. However, this will not happen when null is passed in the uids-property.

pNewState

the new state for the notifications; This has to be a value of the notification-constants like for example "notification.STATE_CONFIRMED"

pUpdateStrategy

An update strategy of how the notifications should be updated. The update strategy can be created with one of the methods of the object created in createUpdateStrategy() Passing null will result in the "none"-strategy (which means no special treatments will affect the update process)

Returns

void

Throws

AditoException


updateUserNotificationState

updateUserNotificationState(pUserId, pUid, pNewState): void

Sets the state of an usernotification. User for Notification-Deletions -> new State: TODELETE or TODELETE_IF_NOT_ARCHIVED

Parameters

pUserId
string | number | boolean

the Uid of the user

pUid
string | number | boolean

the notificationid (not contentid)

pNewState

the new state

Returns

void

Properties

PRIO_HIGH


PRIO_LOW


PRIO_MAX


PRIO_NONE


PRIO_NORMAL


PROP_BACKPACK

string

Not necessary to fill. Set null.


PROP_CAPTION

string

Caption of a notification-content


PROP_CONTENTID

string

The id of the content. Every user-notification refers to a content per contentid.


PROP_CREATIONDATE

string

Timestamp of the content-creation. Needed for DAYSTOLIVE.


PROP_DAYSTOLIVE

string

Content gets deleted after this amount of days. 0 or -1 for infinite.


PROP_DESCRIPTION

string

Description of a notification-content


PROP_FORCEDPRIORITY

string

Forces a priority for the given content, regardless of user-priority for this content-type. null for not forcing any prio -> priority of the given type is used.


PROP_ICON

string

Iconid


PROP_ID

string

NotificationId (different for every recipient of a content)


PROP_LINKINFO

string

Information of the context and image to open. 1. context-name (for example "Person") 2. id (for example the PERSONID) ALWAYS use text.encodeMS(x) to set linkinfo, and text.decodeMS(x) after getting it.


PROP_ORIGINATOR

string

Plaintext-Name of the originator


PROP_RECIPIENTUSERIDS

string

The recipients of the given content as ???


PROP_STATE

string

State of the user-notification (for example notification.CONFIRMED)


PROP_SUBCATEGORY

string

The subcategory of the content. Any string can be a subcategory.


PROP_TYPE

string

The notificationtype-name of the given content.


PROP_USERID

string

UserId -> ____USER...


PROP_VERSON

string

The current version of the content. A continuous number starting at 0.


STATE_ARCHIVE

Notification is saved in archieve.


STATE_CONFIRMED

User interacted with the notification (for exampled clicked it to open the source/linkinformation)


STATE_SEEN

Notification appeared on users screen, but user never interacted with it.


STATE_TODELETE

Notification still exists but will be deleted.


STATE_UNSEEN

Notification never appeard on users screen.


TYPEPROP_DEFAULT_PRIO

string

Notification-Type Property Default Priority


TYPEPROP_ICON

string

Notification-Type Property Icon


TYPEPROP_IS_ARCHIVABLE

string

Notification-Type Property if a notification is archivable or not


TYPEPROP_TITLE

string

Notification-Type Property Title


TYPEPROP_TYPECODE

string

Notification-Type Property Typecode


TYPEPROP_USER_PRIO

string

Notification-Type Property User Priority