Class DefaultNotificationManager

    • Constructor Detail

      • DefaultNotificationManager

        protected DefaultNotificationManager()
        This hidden constructor permits to IoC to create an instance of ComponentInstanceDeletion of this implementation.
    • Method Detail

      • delete

        public void delete​(String componentInstanceId)
        Deletes the resources belonging to the specified component instance. This method is invoked by Silverpeas when a component instance is being deleted.
        Specified by:
        delete in interface ComponentInstanceDeletion
        Parameters:
        componentInstanceId - the unique identifier of a component instance.
      • getNotifAddressProperties

        public Properties getNotifAddressProperties​(String addressId,
                                                    String aUserId)
                                             throws NotificationException
        Description copied from interface: NotificationManager
        Gets the properties of the specified notification address of the given user.
        Specified by:
        getNotifAddressProperties in interface NotificationManager
        Parameters:
        addressId - the unique identifier of a notification address. It can be either a built-in address identifier or the identifier of a custom address set by the user.
        aUserId - the unique identifier of a user.
        Returns:
        a Properties instance with the notification address properties.
        Throws:
        NotificationException - if an error occurs while building the address properties.
      • getDefaultAddressId

        public String getDefaultAddressId​(String aUserId)
                                   throws NotificationException
        Description copied from interface: NotificationManager
        Gets the default notification address of the specified user. If multi-channel is supported, the user can have several default notification addresses. In that case, only the first one is get.
        Specified by:
        getDefaultAddressId in interface NotificationManager
        Parameters:
        aUserId - the unique identifier of the user.
        Returns:
        the unique identifier of a notification address. It can be either a built-in address identifier of a notification channel or the identifier of a custom notification address set by the user.
        Throws:
        NotificationException - if an error occurs while getting a default address.
      • getNotifPreferences

        public List<Properties> getNotifPreferences​(String aUserId)
                                             throws NotificationException
        Description copied from interface: NotificationManager
        Gets the notifications preferences of the specified user.
        Specified by:
        getNotifPreferences in interface NotificationManager
        Parameters:
        aUserId - the unique identifier of the user.
        Returns:
        a list of properties containing "name", "type", "usage" and "address" keys for each notification preference. The address identifies the unique identifier of a notification address that can be the identifier of either a built-in notification address or a custom notification address set by the user.
        Throws:
        NotificationException - if an error occurs while getting the preferences of the user about the notifications.
      • getNotifPreference

        public Properties getNotifPreference​(String aPrefId,
                                             String aUserId)
                                      throws NotificationException
        Description copied from interface: NotificationManager
        Gets the properties about the specified preference of the given user on the notifications.
        Specified by:
        getNotifPreference in interface NotificationManager
        Parameters:
        aPrefId - a unique identifier of the preference.
        aUserId - a unique identifier of the user.
        Returns:
        the properties containing "name", "type", "usage" and "address" keys of the preference.
        Throws:
        NotificationException - if an error occurs while getting the given preference.
      • setDefaultAddress

        public void setDefaultAddress​(String aNotificationAddressId,
                                      String aUserId)
                               throws NotificationException
        Description copied from interface: NotificationManager
        Sets the specified notification address as the default one for the given user. If multi-channel is disabled, the specified address will replace the previous one if any.
        Specified by:
        setDefaultAddress in interface NotificationManager
        Parameters:
        aNotificationAddressId - the unique identifier of a notification address. It can be either a built-in address identifier or a custom one set by the user.
        aUserId - the unique identifier of the user.
        Throws:
        NotificationException - if an error occurs while setting the specified address as a default one.
      • addDefaultAddress

        public void addDefaultAddress​(String aNotificationAddressId,
                                      String aUserId)
                               throws NotificationException
        Description copied from interface: NotificationManager
        Sets the specified notification address as a default one for the given user identifier. Whatever the multi-channel support, the specified address is added among the others default ones of the user.
        Specified by:
        addDefaultAddress in interface NotificationManager
        Parameters:
        aNotificationAddressId - the unique identifier of an address.
        aUserId - the unique identifier of a user.
        Throws:
        NotificationException - if an error occurs while adding the setting the address as a new default one for the user.
      • savePreferences

        public void savePreferences​(String aUserId,
                                    int instanceLocalId,
                                    int aMessageType,
                                    String notifAddressId)
                             throws NotificationException
        Description copied from interface: NotificationManager
        Saves the preference on notification of the given user and for the specified component instance and for the specified type of message.
        Specified by:
        savePreferences in interface NotificationManager
        Parameters:
        aUserId - the unique identifier of a user.
        instanceLocalId - the local identifier of a component instance.
        aMessageType - the type of message.
        notifAddressId - the unique identifier of a notification address.
        Throws:
        NotificationException - if an error occurs while saving the preferences.
      • saveNotifAddress

        public void saveNotifAddress​(NotificationAddress notificationAddress)
                              throws NotificationException
        Description copied from interface: NotificationManager
        Saves the specified custom notification address for the specified user. A custom address is a notification address the user defines himself in order to be notified either through another channel that those related to the built-in addresses or to another address that the built-in ones.
        Specified by:
        saveNotifAddress in interface NotificationManager
        Parameters:
        notificationAddress - a custom notification address to save.
        Throws:
        NotificationException - if an error occurs while saving the specified custom address.
      • deleteNotifAddress

        public void deleteNotifAddress​(String aNotificationAddressId)
                                throws NotificationException
        Description copied from interface: NotificationManager
        Deletes the specified custom notification address. If this address was set as a default one, then it is replaced by the first channel that values the property notif.defaultChannels in the NotificationManagerSettings.properties properties file.
        Specified by:
        deleteNotifAddress in interface NotificationManager
        Parameters:
        aNotificationAddressId - the unique identifier of a custom notification address.
        Throws:
        NotificationException - if an error occurs while deleting the notification address.
      • testNotifAddress

        public void testNotifAddress​(String addressId,
                                     String aUserId)
                              throws NotificationException
        Description copied from interface: NotificationManager
        Tests the specified address for specified user by sending a notification message through the channel related by this address. If the address is a built-in one, then the unique identifier of the user is required to know at whom the address refers. Otherwise, for a custom address, the address itself identifies the concerned user.
        Specified by:
        testNotifAddress in interface NotificationManager
        Parameters:
        addressId - the unique identifier of a notification address. It can be either a built-in or a custom one defined by the user himself.
        aUserId - the unique identifier of a user.
        Throws:
        NotificationException - if an error occurs while sending a test notification message.
      • notifyExternals

        public void notifyExternals​(NotificationParameters params,
                                    Collection<ExternalRecipient> externals)
                             throws NotificationException
        Description copied from interface: NotificationManager
        Notifies the specified external users by using the given notification parameters. Whatever the channels defined in the parameters, only the SMTP channel is used to notify external users.
        Specified by:
        notifyExternals in interface NotificationManager
        Parameters:
        params - the parameters that carries among others the message to send, the subject of the notification, and so on.
        externals - a collection of external recipients.
        Throws:
        NotificationException - if an error occurs while sending the notification.
      • getUsersFromGroup

        public Collection<UserRecipient> getUsersFromGroup​(String groupId)
                                                    throws NotificationException
        Description copied from interface: NotificationManager
        Gets all the notification recipients that are members of the specified user group. The user that have not an activated state in Silverpeas is not taken into account, so this kind of users is not included into the returned collection.
        Specified by:
        getUsersFromGroup in interface NotificationManager
        Parameters:
        groupId - the unique identifier of a user group in Silverpeas.
        Returns:
        a collection of recipients.
        Throws:
        NotificationException - if an error occurs while getting the recipients of the given user group.
      • getComponentFullName

        public String getComponentFullName​(String compInst)
                                    throws NotificationException
        Description copied from interface: NotificationManager
        Gets the full name of a component instance. Such a full name is made up of the name of the space that contains the component instance followed by the name of the component instance.
        Specified by:
        getComponentFullName in interface NotificationManager
        Parameters:
        compInst - the unique identifier of a component instance.
        Returns:
        the full name of the given component instance: the space name followed by the component name, separated by the minus character.
        Throws:
        NotificationException - if an error occurs computing the component instance full name.