Class NotificationMetaData
- java.lang.Object
-
- org.silverpeas.core.notification.user.client.NotificationMetaData
-
- All Implemented Interfaces:
Serializable
public class NotificationMetaData extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
AFTER_MESSAGE_FOOTER_TAG
static String
BEFORE_MESSAGE_FOOTER_TAG
-
Constructor Summary
Constructors Constructor Description NotificationMetaData()
Default ConstructorNotificationMetaData(int messageType, String title, String content)
Most common used constructorNotificationMetaData(int messageType, String title, Map<String,SilverpeasTemplate> templates, String fileName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExternalRecipient(ExternalRecipient externalRecipient)
void
addExtraMessage(String message, String language)
void
addGroupRecipient(GroupRecipient group)
Add a group recipient to group recipientsvoid
addGroupRecipients(Collection<GroupRecipient> groups)
void
addLanguage(String language, String title, String content)
void
addUserRecipient(UserRecipient user)
Add a user recipient to user recipients.void
addUserRecipients(Collection<UserRecipient> users)
Add a user recipient to user recipients.void
addUserRecipients(UserRecipient... users)
Add a user recipient to user recipients.void
addUserRecipientToExclude(UserRecipient user)
Add a user recipient to user recipients to excludeprotected boolean
displayGroup(String groupId)
NotificationMetaData
displayReceiversInFooter()
Calling this method to authorize the display of the users and groups that will received the same notification in the footer of the notification message.NotifAction
getAction()
Set<UserRecipient>
getAllUserRecipients()
Gets the complete list of users that will receive the notification, so it takes into account users of groups.
If the sender is identified, it is removed from the result.
No internal data of the currentNotificationMetaData
is updated.Set<UserRecipient>
getAllUserRecipients(boolean updateInternalUserRecipientsToExclude)
Gets the complete list of users that will receive the notification, so it takes into account users of groups.
If the sender is identified (as a user), it is removed from the result.String
getComponentId()
String
getContent()
Get message contentString
getContent(String language)
Date
getDate()
Get message dateString
getExternalLanguage()
Collection<ExternalRecipient>
getExternalRecipients()
String
getFileName()
Collection<GroupRecipient>
getGroupRecipients()
Get message group recipientsSet<String>
getLanguages()
Link
getLink()
Gets message link in the default language of the platform.Link
getLink(String language)
Gets the message link in the given language.int
getMessageType()
Get message typeNotificationResourceData
getNotificationResourceData()
NotificationResourceData
getNotificationResourceData(String lang)
String
getOriginalExtraMessage()
String
getSender()
Get message senderString
getSessionId()
Get message session IdMap<String,String>
getSimpleContents()
String
getSource()
Get message sourceMap<String,SilverpeasTemplate>
getTemplateContents()
SilverpeasTemplate
getTemplateMessageFooter(String language)
String
getTitle()
Get message titleString
getTitle(String language)
Collection<UserRecipient>
getUserRecipients()
Get message user recipientsCollection<UserRecipient>
getUserRecipientsToExclude()
Get message user recipients to excludeboolean
isAnswerAllowed()
Get answer allowedboolean
isManualUserOne()
Indicates if the currentNotificationMetaData
concerns a manual notification between a sender user and several user/group receivers.boolean
isSendByAUser()
Indicates if the notification is sent by a Silverpeas user or by a batch treatment.boolean
isSendImmediately()
NotificationMetaData
manualUserNotification()
Sets that the currentNotificationMetaData
instance concerns a manual notification between a sender user and several user/group receivers.void
setAction(NotifAction action)
void
setAnswerAllowed(boolean answerAllowed)
Set answer allowedvoid
setAttachmentTargetId(String attachmentTargetId)
Sets the unique identifier of a resource in Silverpeas that can have attachments.void
setComponentId(String componentId)
void
setContent(String content)
Set message contentvoid
setContent(String content, String language)
void
setDate(Date date)
Set message datevoid
setExternalLanguage(String externalLanguage)
Sets language to use for external receivers.void
setExternalRecipients(Collection<ExternalRecipient> externalRecipients)
void
setFileName(String fileName)
void
setGroupRecipients(Collection<GroupRecipient> groups)
Set message group recipientsvoid
setLink(String link)
Set message linkvoid
setLink(Link link)
Set linkvoid
setLink(Link link, String language)
Set linkvoid
setMessageType(int messageType)
Set message typevoid
setNotificationResourceData(String lang, NotificationResourceData notificationResourceData)
void
setNotificationResourceData(NotificationResourceData notificationResourceData)
void
setOriginalExtraMessage(String originalExtraMessage)
void
setSender(String sender)
Set message sendervoid
setSendImmediately(boolean sendImmediately)
void
setSessionId(String sessionId)
Set message session Idvoid
setSource(String source)
Set message sourcevoid
setTitle(String title)
Set message titlevoid
setTitle(String title, String language)
void
setUserRecipients(Collection<UserRecipient> users)
Set message user recipients
-
-
-
Field Detail
-
BEFORE_MESSAGE_FOOTER_TAG
public static final String BEFORE_MESSAGE_FOOTER_TAG
- See Also:
- Constant Field Values
-
AFTER_MESSAGE_FOOTER_TAG
public static final String AFTER_MESSAGE_FOOTER_TAG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NotificationMetaData
public NotificationMetaData()
Default Constructor
-
NotificationMetaData
public NotificationMetaData(int messageType, String title, String content)
Most common used constructor- Parameters:
messageType
- message type (NORMAL, URGENT, ...)title
- message title (=subject)content
- message content (=body)
-
NotificationMetaData
public NotificationMetaData(int messageType, String title, Map<String,SilverpeasTemplate> templates, String fileName)
-
-
Method Detail
-
getTemplateContents
public Map<String,SilverpeasTemplate> getTemplateContents()
-
setMessageType
public void setMessageType(int messageType)
Set message type- Parameters:
messageType
- the message type to be set
-
getMessageType
public int getMessageType()
Get message type- Returns:
- the message type
-
setDate
public void setDate(Date date)
Set message date- Parameters:
date
- the message date to be set
-
getDate
public Date getDate()
Get message date- Returns:
- the message date
-
setTitle
public void setTitle(String title)
Set message title- Parameters:
title
- the title to be set
-
getTitle
public String getTitle()
Get message title- Returns:
- the message title
-
setContent
public void setContent(String content)
Set message content- Parameters:
content
- the content to be set
-
getContent
public String getContent()
Get message content- Returns:
- the message content
-
setSource
public void setSource(String source)
Set message source- Parameters:
source
- the source to be set
-
getSource
public String getSource()
Get message source- Returns:
- the message source
-
setSender
public void setSender(String sender)
Set message sender- Parameters:
sender
- the sender to be set
-
setAnswerAllowed
public void setAnswerAllowed(boolean answerAllowed)
Set answer allowed- Parameters:
answerAllowed
- if answer allowed
-
getSender
public String getSender()
Get message sender- Returns:
- the message sender
-
isAnswerAllowed
public boolean isAnswerAllowed()
Get answer allowed- Returns:
- if answer is allowed
-
getLink
public Link getLink()
Gets message link in the default language of the platform.- Returns:
- the message link
-
getLink
public Link getLink(String language)
Gets the message link in the given language.- Parameters:
language
- the ISO 631-1 code of a language supported by Silverpeas.- Returns:
- the message link.
-
setLink
public void setLink(String link)
Set message link- Parameters:
link
- the link to be set
-
setLink
public void setLink(Link link)
Set link- Parameters:
link
- the link to be set
-
setLink
public void setLink(Link link, String language)
Set link- Parameters:
link
- the link to be setlanguage
- the language of the linkLabel
-
setSessionId
public void setSessionId(String sessionId)
Set message session Id- Parameters:
sessionId
- the session Id to be set
-
getSessionId
public String getSessionId()
Get message session Id- Returns:
- the message session Id
-
setAttachmentTargetId
public void setAttachmentTargetId(String attachmentTargetId)
Sets the unique identifier of a resource in Silverpeas that can have attachments. The target is set for eachNotificationResourceData
instances embedded by this metadata.- Parameters:
attachmentTargetId
- the unique identifier of a resource. Generally, the one of a contribution. If not defined, then nothing is done.
-
setUserRecipients
public void setUserRecipients(Collection<UserRecipient> users)
Set message user recipients- Parameters:
users
- the user ids that must receive this message
-
getUserRecipients
public Collection<UserRecipient> getUserRecipients()
Get message user recipients- Returns:
- the message user recipients
-
addUserRecipient
public void addUserRecipient(UserRecipient user)
Add a user recipient to user recipients. User that has not an activated state is not taken into account.- Parameters:
user
- recipient that must be added
-
addUserRecipients
public void addUserRecipients(UserRecipient... users)
Add a user recipient to user recipients. User that has not an activated state is not taken into account.- Parameters:
users
- users to be added
-
addUserRecipients
public void addUserRecipients(Collection<UserRecipient> users)
Add a user recipient to user recipients. User that has not an activated state is not taken into account.- Parameters:
users
- users to be added
-
getUserRecipientsToExclude
public Collection<UserRecipient> getUserRecipientsToExclude()
Get message user recipients to exclude- Returns:
- the message user recipients
-
addUserRecipientToExclude
public void addUserRecipientToExclude(UserRecipient user)
Add a user recipient to user recipients to exclude- Parameters:
user
- recipient that must not be notified
-
getExternalLanguage
public String getExternalLanguage()
-
setExternalLanguage
public void setExternalLanguage(String externalLanguage)
Sets language to use for external receivers.- Parameters:
externalLanguage
- a language as string.
-
getExternalRecipients
public Collection<ExternalRecipient> getExternalRecipients()
- Returns:
- the externalAddress
-
setExternalRecipients
public void setExternalRecipients(Collection<ExternalRecipient> externalRecipients)
- Parameters:
externalRecipients
- the externalAddress to set
-
addExternalRecipient
public void addExternalRecipient(ExternalRecipient externalRecipient)
- Parameters:
externalRecipient
- the externalRecipient to add
-
setGroupRecipients
public void setGroupRecipients(Collection<GroupRecipient> groups)
Set message group recipients- Parameters:
groups
- the groups that must receive this message
-
getGroupRecipients
public Collection<GroupRecipient> getGroupRecipients()
Get message group recipients- Returns:
- the message group recipients
-
addGroupRecipient
public void addGroupRecipient(GroupRecipient group)
Add a group recipient to group recipients- Parameters:
group
- group that must be added
-
addGroupRecipients
public void addGroupRecipients(Collection<GroupRecipient> groups)
-
getComponentId
public String getComponentId()
-
setComponentId
public void setComponentId(String componentId)
-
getOriginalExtraMessage
public String getOriginalExtraMessage()
-
setOriginalExtraMessage
public void setOriginalExtraMessage(String originalExtraMessage)
-
getFileName
public String getFileName()
-
setFileName
public void setFileName(String fileName)
-
isSendImmediately
public boolean isSendImmediately()
-
setSendImmediately
public void setSendImmediately(boolean sendImmediately)
-
getAction
public NotifAction getAction()
-
setAction
public void setAction(NotifAction action)
-
setNotificationResourceData
public void setNotificationResourceData(NotificationResourceData notificationResourceData)
-
setNotificationResourceData
public void setNotificationResourceData(String lang, NotificationResourceData notificationResourceData)
-
getNotificationResourceData
public NotificationResourceData getNotificationResourceData()
-
getNotificationResourceData
public NotificationResourceData getNotificationResourceData(String lang)
-
isSendByAUser
public boolean isSendByAUser()
Indicates if the notification is sent by a Silverpeas user or by a batch treatment.- Returns:
- true if the notification is sent by a Silverpeas user, false otherwise.
-
getTemplateMessageFooter
public SilverpeasTemplate getTemplateMessageFooter(String language)
-
getAllUserRecipients
public Set<UserRecipient> getAllUserRecipients() throws NotificationException
Gets the complete list of users that will receive the notification, so it takes into account users of groups.
If the sender is identified, it is removed from the result.
No internal data of the currentNotificationMetaData
is updated.- Returns:
- the complete list of users that will receive the notification.
- Throws:
NotificationException
- if an error occurs
-
getAllUserRecipients
public Set<UserRecipient> getAllUserRecipients(boolean updateInternalUserRecipientsToExclude) throws NotificationException
Gets the complete list of users that will receive the notification, so it takes into account users of groups.
If the sender is identified (as a user), it is removed from the result.- Parameters:
updateInternalUserRecipientsToExclude
- if true, the internal container of user recipients to exclude will be updated. This container is provided bygetUserRecipientsToExclude()
. If false, nothing is done.- Returns:
- the complete list of users that will receive the notification.
- Throws:
NotificationException
- if an error occurs
-
displayGroup
protected boolean displayGroup(String groupId)
-
displayReceiversInFooter
public NotificationMetaData displayReceiversInFooter()
Calling this method to authorize the display of the users and groups that will received the same notification in the footer of the notification message.- Returns:
- the current
NotificationMetaData
instance.
-
manualUserNotification
public NotificationMetaData manualUserNotification()
Sets that the currentNotificationMetaData
instance concerns a manual notification between a sender user and several user/group receivers.- Returns:
- the current
NotificationMetaData
instance.
-
isManualUserOne
public boolean isManualUserOne()
Indicates if the currentNotificationMetaData
concerns a manual notification between a sender user and several user/group receivers.
Warning : the sender information is not verified.- Returns:
- true if the current
NotificationMetaData
concerns a manual one, false otherwise.
-
-