Class CommentUserNotification
- 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<Contribution>
-
- org.silverpeas.core.comment.service.CommentUserNotification
-
- All Implemented Interfaces:
UserNotificationBuilder,FallbackToCoreTemplatePathBehavior
public class CommentUserNotification extends AbstractTemplateUserNotificationBuilder<Contribution> implements FallbackToCoreTemplatePathBehavior
- Author:
- Yohann Chastagnier
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.silverpeas.core.notification.user.builder.AbstractTemplateUserNotificationBuilder
AbstractTemplateUserNotificationBuilder.NotificationTemporal
-
-
Field Summary
Fields Modifier and Type Field Description static StringNOTIFICATION_COMMENT_ATTRIBUTEThe name of the attribute in a notification message that refers the comment responsable of the triggering of this service.-
Fields inherited from class org.silverpeas.core.notification.user.builder.AbstractTemplateUserNotificationBuilder
CUSTOM_NOTIFICATION_SUBJECT, DEFAULT_NOTIFICATION_SUBJECT
-
-
Constructor Summary
Constructors Constructor Description CommentUserNotification(CommentService commentService, Comment comment, Contribution commentedContent, String subjectKey, org.silverpeas.kernel.bundle.LocalizationBundle componentMessages, Set<String> recipients)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected NotifActiongetAction()Gets the type of action on the resource concerned by the notification if any.protected StringgetBundleSubjectKey()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 StringgetComponentInstanceId()Gets the component instance identifier.protected StringgetContributionAccessLinkLabelBundleKey()Gets the string bundle key for contribution access linkprotected StringgetLocalizationBundlePath()Gets the path of the localization bundle to load.protected StringgetSender()Gets the sender (the user identifier usually)protected StringgetTemplateFileName()Gets the fileName of StringTemplateprotected StringgetTemplatePath()Gets the string template pathprotected StringgetTitle(String language)The title is the either the default subject of the notifications as defined in the bundle returned byAbstractUserNotificationBuilder.getBundle()method and by the property given by thegetBundleSubjectKey()method or the default subject for the notification about the comments.protected Collection<String>getUserIdsToNotify()A collection of user identifiers.protected booleanisSendImmediately()Is the notification to build has to be sent immediately?protected voidperform(Contribution resource)protected voidperformNotificationResource(String language, Contribution resource, NotificationResourceData notificationResourceData)Builds the notification resource data container from a given language.protected voidperformTemplateData(String language, Contribution resource, SilverpeasTemplate template)-
Methods inherited from class org.silverpeas.core.notification.user.builder.AbstractTemplateUserNotificationBuilder
createNotification, getTitle, performBuild, performNotificationResource, performNotificationResource
-
Methods inherited from class org.silverpeas.core.notification.user.builder.AbstractResourceUserNotificationBuilder
getResource, getResourceURL, initialize, initializeNotificationResourceData, isGroupCanBeNotified, isUserCanBeNotified, performBuild, setResource
-
Methods inherited from class org.silverpeas.core.notification.user.builder.AbstractUserNotificationBuilder
build, getBundle, getBundle, getContent, getExternalAddressesToNotify, getGroupIdsToNotify, getMessageType, getNotificationMetaData, getUserIdsToExcludeFromNotifying, stop, stopWhenNoUserToNotify
-
-
-
-
Field Detail
-
NOTIFICATION_COMMENT_ATTRIBUTE
public static final String NOTIFICATION_COMMENT_ATTRIBUTE
The name of the attribute in a notification message that refers the comment responsable of the triggering of this service.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CommentUserNotification
public CommentUserNotification(CommentService commentService, Comment comment, Contribution commentedContent, String subjectKey, org.silverpeas.kernel.bundle.LocalizationBundle componentMessages, Set<String> recipients)
-
-
Method Detail
-
getBundleSubjectKey
protected String getBundleSubjectKey()
Description copied from class:AbstractTemplateUserNotificationBuilderThe 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.subjectin 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).- Overrides:
getBundleSubjectKeyin classAbstractTemplateUserNotificationBuilder<Contribution>- 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 String getTitle(String language)
The title is the either the default subject of the notifications as defined in the bundle returned byAbstractUserNotificationBuilder.getBundle()method and by the property given by thegetBundleSubjectKey()method or the default subject for the notification about the comments.- Overrides:
getTitlein classAbstractTemplateUserNotificationBuilder<Contribution>- Parameters:
language- the ISO-631 code of the language. It is here not taken into account. Only the the locale of the component messages bundle is taken into account.- Returns:
- the subject of the notification.
- See Also:
AbstractTemplateUserNotificationBuilder.getTitle()
-
getUserIdsToNotify
protected Collection<String> getUserIdsToNotify()
Description copied from class:AbstractUserNotificationBuilderA collection of user identifiers. All the users in this collection will be notified. This method requires to be implemented.- Specified by:
getUserIdsToNotifyin classAbstractUserNotificationBuilder- Returns:
-
perform
protected void perform(Contribution resource)
- Overrides:
performin classAbstractTemplateUserNotificationBuilder<Contribution>
-
performTemplateData
protected void performTemplateData(String language, Contribution resource, SilverpeasTemplate template)
- Specified by:
performTemplateDatain classAbstractTemplateUserNotificationBuilder<Contribution>
-
performNotificationResource
protected void performNotificationResource(String language, Contribution resource, NotificationResourceData notificationResourceData)
Description copied from class:AbstractTemplateUserNotificationBuilderBuilds 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- Specified by:
performNotificationResourcein classAbstractTemplateUserNotificationBuilder<Contribution>- Parameters:
language- the language in ISO-639-2resource- the resource concerned by the notificationnotificationResourceData- data about the notification
-
getTemplatePath
protected String getTemplatePath()
Description copied from class:AbstractTemplateUserNotificationBuilderGets the string template path- Specified by:
getTemplatePathin classAbstractTemplateUserNotificationBuilder<Contribution>- Returns:
- the StringTemplate file path
-
getTemplateFileName
protected String getTemplateFileName()
Description copied from class:AbstractTemplateUserNotificationBuilderGets the fileName of StringTemplate- Specified by:
getTemplateFileNamein classAbstractTemplateUserNotificationBuilder<Contribution>- Returns:
- the StringTemplate filename
-
getAction
protected NotifAction getAction()
Description copied from class:AbstractUserNotificationBuilderGets the type of action on the resource concerned by the notification if any.- Specified by:
getActionin classAbstractUserNotificationBuilder- Returns:
- a value of the
NotifActionenumeration.
-
getComponentInstanceId
protected String getComponentInstanceId()
Description copied from class:AbstractUserNotificationBuilderGets the component instance identifier.- Specified by:
getComponentInstanceIdin classAbstractUserNotificationBuilder- Returns:
- the unique identifier of the component instance concerned by the notification to build.
-
getSender
protected String getSender()
Description copied from class:AbstractUserNotificationBuilderGets the sender (the user identifier usually)- Specified by:
getSenderin classAbstractUserNotificationBuilder- Returns:
- the unique identifier of the sender.
-
isSendImmediately
protected boolean isSendImmediately()
Description copied from class:AbstractUserNotificationBuilderIs the notification to build has to be sent immediately? If no, then its sending will be delayed according to the preferences of the users.- Overrides:
isSendImmediatelyin classAbstractResourceUserNotificationBuilder<Contribution>- Returns:
- true if the notification to build has to be sent immediately.
-
getLocalizationBundlePath
protected String getLocalizationBundlePath()
Description copied from class:AbstractUserNotificationBuilderGets the path of the localization bundle to load. By default, returns the general translations. For more specific localized text to use in the notification, override this method.- Overrides:
getLocalizationBundlePathin classAbstractUserNotificationBuilder- Returns:
- the path of the localization bundle.
-
getContributionAccessLinkLabelBundleKey
protected String getContributionAccessLinkLabelBundleKey()
Description copied from class:AbstractTemplateUserNotificationBuilderGets the string bundle key for contribution access link- Overrides:
getContributionAccessLinkLabelBundleKeyin classAbstractTemplateUserNotificationBuilder<Contribution>- Returns:
- the string bundle key.
-
-