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
string | number | booleanContentId that will point the notificationcontent. Using same ContentId will version-up the Notification.
string | number | booleanInfo parameter for the open-process (json format).
string | number | booleanOption 1 (null): Notification takes Icon from its Type (recommended) Option 2 (for example: VAADIN:CHECK): Notification gets this icon Option 3 (Image): ???
string | number | booleanName of the originator in the notification popup.
string | number | booleanType of the notification, can be any type, defined in notificationtypes.
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
numberDays the notification lives. -1 is infinite
Initial notification state ("UNSEEN", "SEEN" (user has seen the notification but not interacted with it), "CONFIRMED" (user has interacted with the notification), "DELETED", "ARCHIVE").
string[]Array of user ids. 'null' for notification to the current user.
string | number | booleanCaption of the notification.
string | number | booleanDescription of the notification.
string | number | booleanThe subcategory as String
Returns
voidThrows
May throw an exception.
addNotificationWith
addNotificationWith(
pConfig):void
Adds a new notification for delivery.
Parameters
Returns
voidThrows
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
string | number | booleanno longer in use, set null
string | number | booleancontentid of notification to delete. Always needed
Returns
voiddeleteMultipleContentsIfOrphan
deleteMultipleContentsIfOrphan(
pContentIds):void
Checks if contents still used in one or more usernotifications, if not, it will be deleted, due to no usage.
Parameters
string[]contentids of notifications to delete. Always needed
Returns
voidgetAllTypes
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
string | number | booleanname 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
string | number | boolean(_____USER_XXX...)
all the states, the loaded notifications should have (for example notification.USEEN)
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
string | number | booleanthe Uid of the user
string[]the notificationids array(not contentid)
Returns
voidupdateUserNotificationsStateBulk
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
string | number | booleanthe Uid of the user; This is in fact the NAME-property of a user, for example "_____USER_eda27977-6353-41d2-ac94-76947ee0a550"
anythe 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.
the new state for the notifications; This has to be a value of the notification-constants like for example "notification.STATE_CONFIRMED"
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
voidThrows
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
string | number | booleanthe Uid of the user
string | number | booleanthe notificationid (not contentid)
Returns
voidProperties
PRIO_HIGH
PRIO_LOW
PRIO_MAX
PRIO_NONE
PRIO_NORMAL
PROP_BACKPACK
stringNot necessary to fill. Set null.
PROP_CAPTION
stringCaption of a notification-content
PROP_CONTENTID
stringThe id of the content. Every user-notification refers to a content per contentid.
PROP_CREATIONDATE
stringTimestamp of the content-creation. Needed for DAYSTOLIVE.
PROP_DAYSTOLIVE
stringContent gets deleted after this amount of days. 0 or -1 for infinite.
PROP_DESCRIPTION
stringDescription of a notification-content
PROP_FORCEDPRIORITY
stringForces 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
stringIconid
PROP_ID
stringNotificationId (different for every recipient of a content)
PROP_LINKINFO
stringInformation 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
stringPlaintext-Name of the originator
PROP_RECIPIENTUSERIDS
stringThe recipients of the given content as ???
PROP_STATE
stringState of the user-notification (for example notification.CONFIRMED)
PROP_SUBCATEGORY
stringThe subcategory of the content. Any string can be a subcategory.
PROP_TYPE
stringThe notificationtype-name of the given content.
PROP_USERID
stringUserId -> ____USER...
PROP_VERSON
stringThe 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
stringNotification-Type Property Default Priority
TYPEPROP_ICON
stringNotification-Type Property Icon
TYPEPROP_IS_ARCHIVABLE
stringNotification-Type Property if a notification is archivable or not
TYPEPROP_TITLE
stringNotification-Type Property Title
TYPEPROP_TYPECODE
stringNotification-Type Property Typecode
TYPEPROP_USER_PRIO
stringNotification-Type Property User Priority