Package com.simplicite.util
Class Notification
- java.lang.Object
-
- com.simplicite.util.Notification
-
- All Implemented Interfaces:
java.io.Serializable
public class Notification extends java.lang.Object implements java.io.Serializable
Shared code Notification- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Notification.NotifRecipient
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Object
NOTI_CHANNEL_FIREBASE
static java.lang.Object
NOTI_CHANNEL_INTERNAL
static java.lang.Object
NOTI_CHANNEL_MAIL
static java.lang.Object
NOTI_CHANNEL_SPECIFIC
-
Constructor Summary
Constructors Constructor Description Notification(java.lang.String id, java.lang.String name, java.lang.String action, java.lang.String targetObj, java.lang.String expression)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChannel(java.lang.String channelId)
Add a channel to the Notificationvoid
addChannelRcpt(Notification.NotifRecipient rcpt, java.lang.String channelId)
Add a recipient to a channelvoid
addContent(java.lang.String lang, java.lang.String content)
void
addInternalContent(java.lang.String lang, java.lang.String content)
java.lang.String
getAction()
java.lang.String
getChannel()
java.util.Map<java.lang.String,java.lang.String>
getChannelContent(java.lang.String channelId)
Get contents in different langs of given channeljava.util.Map<java.lang.String,java.lang.String>
getChannelContent(java.lang.String channelId, java.lang.String notifId)
java.lang.String
getChannelMethod(java.lang.String id)
java.util.List<Notification.NotifRecipient>
getChannelRcpts(java.lang.String channelId)
java.util.List<Notification.NotifRecipient>
getChannelRcpts(java.lang.String channelId, java.lang.String notifId)
java.util.List<java.lang.String[]>
getChannelRowId(java.lang.String id)
Get row ids of channel refjava.util.List<java.lang.String>
getChannels()
Get list of dispatch channelsjava.util.Map<java.lang.String,java.lang.String>
getChannelTitle(java.lang.String channelId)
java.util.HashMap<java.lang.String,java.lang.String>
getChannelTitles(java.lang.String channelId, java.lang.String notifId)
static java.lang.String
getChannelType(java.lang.String rowid)
Return type of channeljava.lang.String
getContent(java.lang.String channelId, java.lang.String lang)
Get content for specific lang and channeljava.lang.String
getId()
java.lang.String
getMethod()
get method of object to be called when notification is triggeredjava.lang.String
getName()
ObjectDB
getObject()
Get object linked to notificationjava.util.List<java.lang.String>
getSubscribedUsersFromRcpt(Notification.NotifRecipient rcpt)
Retrieves a list of subscribed users based on the provided notification recipient.java.util.List<java.lang.String>
getSubscribedUsersOfChannel(java.lang.String channelId)
Get list of user ids subscribed to a notification channeljava.lang.String
getTestExpression()
Get condition of notification triggerboolean
isCreate()
boolean
isFieldLevel()
boolean
isObjectLevel()
boolean
isUpdate()
void
pushNotification(Grant grant, ObjectDB o)
Push notification for specified row of Objectvoid
setChannel(java.lang.String channelId)
void
setChannelContents(java.lang.String channelId, java.util.Map<java.lang.String,java.lang.String> content)
void
setChannelRcpts(java.lang.String channelId, java.util.List<Notification.NotifRecipient> rcpts)
Set channel recipientsvoid
setChannels(java.util.List<java.lang.String> channels)
Set all channels of Notificationvoid
setChannelTitles(java.lang.String channelId, java.util.Map<java.lang.String,java.lang.String> titles)
void
setMethod(java.lang.String m)
void
setObject(ObjectDB o)
-
-
-
Field Detail
-
NOTI_CHANNEL_INTERNAL
public static final java.lang.Object NOTI_CHANNEL_INTERNAL
-
NOTI_CHANNEL_SPECIFIC
public static final java.lang.Object NOTI_CHANNEL_SPECIFIC
-
NOTI_CHANNEL_MAIL
public static final java.lang.Object NOTI_CHANNEL_MAIL
-
NOTI_CHANNEL_FIREBASE
public static final java.lang.Object NOTI_CHANNEL_FIREBASE
-
-
Method Detail
-
pushNotification
public void pushNotification(Grant grant, ObjectDB o)
Push notification for specified row of Object- Parameters:
grant
-o
- Object that triggers Notification
-
getChannelType
public static java.lang.String getChannelType(java.lang.String rowid)
Return type of channel- Parameters:
rowid
- Channel config rowid- Returns:
- type of channel
-
getMethod
public java.lang.String getMethod()
get method of object to be called when notification is triggered- Returns:
- method
-
setMethod
public void setMethod(java.lang.String m)
-
getTestExpression
public java.lang.String getTestExpression()
Get condition of notification trigger- Returns:
- expression
-
getChannels
public java.util.List<java.lang.String> getChannels()
Get list of dispatch channels
-
setChannels
public void setChannels(java.util.List<java.lang.String> channels)
Set all channels of Notification- Parameters:
channels
-
-
addChannel
public void addChannel(java.lang.String channelId)
Add a channel to the Notification- Parameters:
channelId
-
-
addChannelRcpt
public void addChannelRcpt(Notification.NotifRecipient rcpt, java.lang.String channelId)
Add a recipient to a channel- Parameters:
rcpt
-channelId
-
-
getSubscribedUsersFromRcpt
public java.util.List<java.lang.String> getSubscribedUsersFromRcpt(Notification.NotifRecipient rcpt)
Retrieves a list of subscribed users based on the provided notification recipient.- Parameters:
rcpt
- The notification recipient for whom to fetch subscribed users.- Returns:
- A list of user IDs who are subscribed to the specified recipient.
-
getSubscribedUsersOfChannel
public java.util.List<java.lang.String> getSubscribedUsersOfChannel(java.lang.String channelId)
Get list of user ids subscribed to a notification channel- Parameters:
channelId
-- Returns:
- list of user ids subscribed to notification channel
-
getObject
public ObjectDB getObject()
Get object linked to notification- Returns:
- ObjectDB
-
setObject
public void setObject(ObjectDB o)
-
isCreate
public boolean isCreate()
-
isUpdate
public boolean isUpdate()
-
getName
public java.lang.String getName()
-
getId
public java.lang.String getId()
-
getAction
public java.lang.String getAction()
-
isFieldLevel
public boolean isFieldLevel()
-
isObjectLevel
public boolean isObjectLevel()
-
addContent
public void addContent(java.lang.String lang, java.lang.String content)
-
addInternalContent
public void addInternalContent(java.lang.String lang, java.lang.String content)
-
setChannel
public void setChannel(java.lang.String channelId)
-
getChannel
public java.lang.String getChannel()
-
setChannelContents
public void setChannelContents(java.lang.String channelId, java.util.Map<java.lang.String,java.lang.String> content)
-
getChannelContent
public java.util.Map<java.lang.String,java.lang.String> getChannelContent(java.lang.String channelId)
Get contents in different langs of given channel- Parameters:
channelId
-- Returns:
- content of channel per lang
-
setChannelTitles
public void setChannelTitles(java.lang.String channelId, java.util.Map<java.lang.String,java.lang.String> titles)
-
getChannelTitle
public java.util.Map<java.lang.String,java.lang.String> getChannelTitle(java.lang.String channelId)
-
getContent
public java.lang.String getContent(java.lang.String channelId, java.lang.String lang)
Get content for specific lang and channel- Parameters:
channelId
-lang
-- Returns:
- Content for notification channel in specified lang
-
setChannelRcpts
public void setChannelRcpts(java.lang.String channelId, java.util.List<Notification.NotifRecipient> rcpts)
Set channel recipients- Parameters:
channelId
-rcpts
-
-
getChannelRcpts
public java.util.List<Notification.NotifRecipient> getChannelRcpts(java.lang.String channelId)
-
getChannelRowId
public java.util.List<java.lang.String[]> getChannelRowId(java.lang.String id)
Get row ids of channel ref- Parameters:
id
-- Returns:
- List of channel ids
-
getChannelMethod
public java.lang.String getChannelMethod(java.lang.String id)
-
getChannelRcpts
public java.util.List<Notification.NotifRecipient> getChannelRcpts(java.lang.String channelId, java.lang.String notifId)
-
getChannelContent
public java.util.Map<java.lang.String,java.lang.String> getChannelContent(java.lang.String channelId, java.lang.String notifId)
-
getChannelTitles
public java.util.HashMap<java.lang.String,java.lang.String> getChannelTitles(java.lang.String channelId, java.lang.String notifId)
-
-