Class AbstractTemplateUserNotificationBuilder<T>
- java.lang.Object
-
- org.silverpeas.core.notification.user.builder.AbstractUserNotificationBuilder
-
- org.silverpeas.core.notification.user.builder.AbstractResourceUserNotificationBuilder<T>
-
- org.silverpeas.core.notification.user.builder.AbstractTemplateUserNotificationBuilder<T>
-
- Type Parameters:
T
- the type of resource concerned by the notification.
- All Implemented Interfaces:
UserNotificationBuilder
- Direct Known Subclasses:
AbstractContributionTemplateUserNotificationBuilder
,AbstractInvitationUserNotification
,AbstractReplacementNotificationBuilder
,AgendaUserNotification
,CommentUserNotification
,FileSharingUserNotification
,PublicationDateReminderUserNotification
,UserNotificationBuilder
public abstract class AbstractTemplateUserNotificationBuilder<T> extends AbstractResourceUserNotificationBuilder<T>
- Author:
- Yohann Chastagnier
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractTemplateUserNotificationBuilder.NotificationTemporal
Handles the date formats into notification building context.
-
Field Summary
Fields Modifier and Type Field Description protected static String
CUSTOM_NOTIFICATION_SUBJECT
The property in the settings from which the subject of the notification will be set.protected static String
DEFAULT_NOTIFICATION_SUBJECT
-
Constructor Summary
Constructors Constructor Description AbstractTemplateUserNotificationBuilder(T resource)
Default constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected UserNotification
createNotification()
Creates the user notification.protected String
getBundleSubjectKey()
The name of the property in the bundle returned by theAbstractUserNotificationBuilder.getBundle()
method and that specifies a custom subject for the notifications built by this builder.protected String
getContributionAccessLinkLabelBundleKey()
Gets the string bundle key for contribution access linkprotected abstract String
getTemplateFileName()
Gets the fileName of StringTemplateprotected abstract String
getTemplatePath()
Gets the string template pathprotected String
getTitle()
The title is by default defined by the propertyGML.st.notification.subject
in the Silverpeas's general localization bundle.protected String
getTitle(String language)
Gets the title of the notification to build explicitly in the specified language from the bundle returned by theAbstractUserNotificationBuilder.getBundle()
method.protected void
perform(T resource)
protected void
performBuild(T resource)
protected abstract void
performNotificationResource(String language, T resource, NotificationResourceData notificationResourceData)
Builds the notification resource data container from a given language.protected void
performNotificationResource(T resource)
protected void
performNotificationResource(T resource, NotificationResourceData notificationResourceData)
protected abstract void
performTemplateData(String language, T resource, SilverpeasTemplate template)
-
Methods inherited from class org.silverpeas.core.notification.user.builder.AbstractResourceUserNotificationBuilder
getResource, getResourceURL, initialize, initializeNotificationResourceData, isGroupCanBeNotified, isSendImmediately, isUserCanBeNotified, performBuild, setResource
-
Methods inherited from class org.silverpeas.core.notification.user.builder.AbstractUserNotificationBuilder
build, getAction, getBundle, getBundle, getComponentInstanceId, getContent, getExternalAddressesToNotify, getGroupIdsToNotify, getLocalizationBundlePath, getMessageType, getNotificationMetaData, getSender, getUserIdsToExcludeFromNotifying, getUserIdsToNotify, stop, stopWhenNoUserToNotify
-
-
-
-
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
-
DEFAULT_NOTIFICATION_SUBJECT
protected static final String DEFAULT_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 theAbstractUserNotificationBuilder.getBundle()
method and that specifies a custom subject for the notifications built by this builder. By Default the custom subject is defined by the propertycustom.st.notification.subject
in the bundle returned by theAbstractUserNotificationBuilder.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 propertyGML.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 bygetBundleSubjectKey()
. 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 withI18NHelper.DEFAULT_LANGUAGE
as locale. So, to specify a custom implementation of this method, please override instead thegetTitle(String)
method.- Overrides:
getTitle
in classAbstractUserNotificationBuilder
- 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 theAbstractUserNotificationBuilder.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
-
createNotification
protected UserNotification createNotification()
Description copied from class:AbstractUserNotificationBuilder
Creates the user notification. This method is used to construct and initialize aUserNotification
object in theAbstractUserNotificationBuilder.build()
method.- Overrides:
createNotification
in classAbstractResourceUserNotificationBuilder<T>
- Returns:
- a
UserNotification
object.
-
performBuild
protected final void performBuild(T resource)
- Specified by:
performBuild
in classAbstractResourceUserNotificationBuilder<T>
-
performNotificationResource
protected final void performNotificationResource(T resource)
- Overrides:
performNotificationResource
in classAbstractResourceUserNotificationBuilder<T>
-
performNotificationResource
protected final void performNotificationResource(T resource, NotificationResourceData notificationResourceData)
- Specified by:
performNotificationResource
in classAbstractResourceUserNotificationBuilder<T>
-
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-2resource
- the resource concerned by the notificationnotificationResourceData
- 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.
-
-