Class SimpleUserNotification

  • All Implemented Interfaces:
    UserNotification

    public class SimpleUserNotification
    extends Object
    implements UserNotification
    This implementation of UserNotification permits to send a simple user notification, basically a title and a message.

    It is also possible to deal with the SilverpeasTemplate API.

    This is useful when user notification must be performed into a simple functional context.

    This implementation is designed in order to handle the messages into all the handled user languages

    Author:
    Yohann Chastagnier
    • Method Detail

      • fromSystem

        public static SimpleUserNotification fromSystem()
        Initializes an instance by indicating the system as the sender.
        Returns:
        the new instance.
      • from

        public static SimpleUserNotification from​(User sender)
        Initializes an instance by specifying directly the sender.
        Parameters:
        sender - the User which represents the sender.
        Returns:
        itself.
      • andComponentInstanceId

        public SimpleUserNotification andComponentInstanceId​(String componentInstanceId)
        Sets the instance id of the component from wich the notification is sent.
        Parameters:
        componentInstanceId - a component instance identifier as string.
        Returns:
        itself.
      • withExtraMessage

        public SimpleUserNotification withExtraMessage​(String extraMessage)
        Sets an extra message which is not produced against a language.
        Parameters:
        extraMessage - an extra message as string.
        Returns:
        itself.
      • toUsers

        public SimpleUserNotification toUsers​(User... users)
        Sets the given users as receivers.
        Parameters:
        users - the receivers represented by an array of User.
        Returns:
        itself.
      • toUsers

        public SimpleUserNotification toUsers​(Stream<User> users)
        Sets the given users as receivers.
        Parameters:
        users - the receivers represented by a stream of User.
        Returns:
        itself.
      • toGroups

        public SimpleUserNotification toGroups​(Collection<Group> groups)
        Sets the users of given groups as receivers.
        Parameters:
        groups - receivers represented by the users contained into the list of Group.
        Returns:
        itself.
      • toGroups

        public SimpleUserNotification toGroups​(Group... groups)
        Sets the users of given groups as receivers.
        Parameters:
        groups - receivers represented by the users contained into the array of Group.
        Returns:
        itself.
      • toGroups

        public SimpleUserNotification toGroups​(Stream<Group> groups)
        Sets the users of given groups as receivers.
        Parameters:
        groups - receivers represented by the users contained into the stream of Group.
        Returns:
        itself.
      • toEMails

        public SimpleUserNotification toEMails​(Stream<String> eMails,
                                               String language)
        Sets the given e-mails as receivers.
        Parameters:
        eMails - a stream of receiver e-mails.
        language - the language to use with emails.
        Returns:
        itself.
      • send

        public void send()
        Description copied from interface: UserNotification
        Sends this notification at the specified addresses declared within the metadata of this notification.
        Specified by:
        send in interface UserNotification
      • send

        public void send​(BuiltInNotifAddress notificationAddress)
        Description copied from interface: UserNotification
        Sends this notification to the specified builtin user notification address.
        Specified by:
        send in interface UserNotification
        Parameters:
        notificationAddress - the type of the media to vehicle the notification.