Class NotificationMetaData

    • 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)
    • Method Detail

      • addLanguage

        public final void addLanguage​(String language,
                                      String title,
                                      String content)
      • getLanguages

        public Set<String> getLanguages()
      • 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
      • setTitle

        public void setTitle​(String title,
                             String language)
      • 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
      • setContent

        public void setContent​(String content,
                               String language)
      • getContent

        public String getContent()
        Get message content
        Returns:
        the message content
      • getContent

        public String getContent​(String language)
      • 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 set
        language - 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 each NotificationResourceData 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
      • setUserRecipientsToExclude

        public void setUserRecipientsToExclude​(Collection<UserRecipient> users)
        Set message user recipients to exclude
        Parameters:
        users - the user ids that must not receive this message
      • 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
      • addUserRecipientsToExclude

        public void addUserRecipientsToExclude​(UserRecipient[] users)
        Add a user recipient to user recipients to exclude
        Parameters:
        users - recipient that must not be notified
      • addUserRecipientsToExclude

        public void addUserRecipientsToExclude​(Collection<UserRecipient> users)
        Add a user recipient to user recipients to exclude
        Parameters:
        users - 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 lenguage as string.
      • 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
      • getComponentId

        public String getComponentId()
      • setComponentId

        public void setComponentId​(String componentId)
      • addExtraMessage

        public void addExtraMessage​(String message,
                                    String language)
      • 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)
      • setAction

        public void setAction​(NotifAction action)
      • setNotificationResourceData

        public void setNotificationResourceData​(NotificationResourceData notificationResourceData)
      • 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.
      • 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 current NotificationMetaData 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 by getUserRecipientsToExclude(). 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.
      • isManualUserOne

        public boolean isManualUserOne()
        Indicates if the current NotificationMetaData 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.