Class AbstractTemplateUserNotificationBuilder<T>

    • Field Detail

      • CUSTOM_NOTIFICATION_SUBJECT

        protected static final String CUSTOM_NOTIFICATION_SUBJECT
        The property in the settings from which the subject of the notification will be set. This key is to set a custom subject peculiar to a given component. If no such property exists or if this property isn't valued, then the default notification subject will be taken (it is defined by the property GML.st.notification.subject).
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractTemplateUserNotificationBuilder

        public AbstractTemplateUserNotificationBuilder​(T resource)
        Default constructor
        Parameters:
        resource - the resource which is the object of the notification.
    • Method Detail

      • getBundleSubjectKey

        protected String getBundleSubjectKey()
        The name of the property in the bundle returned by the AbstractUserNotificationBuilder.getBundle() method and that specifies a custom subject for the notifications built by this builder. By Default the custom subject is defined by the property custom.st.notification.subject in the bundle returned by the AbstractUserNotificationBuilder.getBundle() method. So this method doesn't require to be overridden unless to give a different property name; for example, in case there is a different subject for several kinds of notifications in a given Silverpeas component (and hence several notification builders).
        Returns:
        the name of the property in the AbstractUserNotificationBuilder.getBundle() bundle that specifies the subject to use in the notifications built by this builder.
      • getTitle

        protected final String getTitle()
        The title is by default defined by the property GML.st.notification.subject in the Silverpeas's general localization bundle. The property is valued by a StringTemplate pattern, so that information about the resource concerned by the notification can be passed.

        It can be overridden by specifying a another property in the bundle returned by AbstractUserNotificationBuilder.getBundle() and under the name given by getBundleSubjectKey(). By this way, each component in Silverpeas has a way to customize the title of the notifications for the resources handled by itself.

        This method delegates its call to the getTitle(String) method with I18NHelper.DEFAULT_LANGUAGE as locale. So, to specify a custom implementation of this method, please override instead the getTitle(String) method.

        Overrides:
        getTitle in class AbstractUserNotificationBuilder
        Returns:
        the title of the notification. By default, the title is specify globally for all notifications by the GML.st.notification.subject property.
      • getTitle

        protected String getTitle​(String language)
        Gets the title of the notification to build explicitly in the specified language from the bundle returned by the AbstractUserNotificationBuilder.getBundle() method. This method can be overridden to specify another implementation.
        Parameters:
        language - the ISO-631 code of a language.
        Returns:
        the title of the notification. By default, the title is specify globally for all notifications by the GML.st.notification.subject property.
        See Also:
        getTitle()
      • getTemplateFileName

        protected abstract String getTemplateFileName()
        Gets the fileName of StringTemplate
        Returns:
        the StringTemplate filename
      • perform

        protected void perform​(T resource)
      • performTemplateData

        protected abstract void performTemplateData​(String language,
                                                    T resource,
                                                    SilverpeasTemplate template)
      • performNotificationResource

        protected abstract void performNotificationResource​(String language,
                                                            T resource,
                                                            NotificationResourceData notificationResourceData)
        Builds the notification resource data container from a given language. Don't forget to fill resourceId, resourceType, resourceName, resourceDescription (optional), resourceLocation (optional). If ResourceLocation is empty , it will be filled by the NotificationManager with the given componentInstanceId of NotificationMetaData
        Parameters:
        language - the language in ISO-639-2
        resource - the resource concerned by the notification
        notificationResourceData - data about the notification
      • getTemplatePath

        protected abstract String getTemplatePath()
        Gets the string template path
        Returns:
        the StringTemplate file path
      • getContributionAccessLinkLabelBundleKey

        protected String getContributionAccessLinkLabelBundleKey()
        Gets the string bundle key for contribution access link
        Returns:
        the string bundle key.