com.silverpeas.comment.service.notification
Class DefaultCommentUserNotificationService

java.lang.Object
  extended by com.silverpeas.notification.DefaultNotificationSubscriber
      extended by com.silverpeas.comment.service.CommentActionListener
          extended by com.silverpeas.comment.service.notification.DefaultCommentUserNotificationService
All Implemented Interfaces:
CommentUserNotificationService, NotificationSubscriber, EventListener

@Named(value="commentUserNotificationService")
public class DefaultCommentUserNotificationService
extends CommentActionListener
implements CommentUserNotificationService

The default implementation of the user notification about events on the comments.


Field Summary
protected static String DEFAULT_SUBJECT_COMMENT_ADDING
          If no property with the subject of the notification message is defined in a Silverpeas component, then the below default property is taken.
protected static String NOTIFICATION_COMMENT_ATTRIBUTE
          The name of the attribute in a notification message that refers the comment responsable of the triggering of this service.
protected static String NOTIFICATION_CONTENT_ATTRIBUTE
          The name of the attribute in a notification message that refers the content commented by the comment responsable of the triggering of this service.
 
Fields inherited from interface com.silverpeas.comment.service.CommentUserNotificationService
SUBJECT_COMMENT_ADDING
 
Constructor Summary
DefaultCommentUserNotificationService()
           
 
Method Summary
 void commentAdded(Comment newComment)
          Sends a notification to the users that are concerned by the specified new comment on a given resource (publication, blog article, ...).
 void commentRemoved(Comment removedComment)
          No notifications are sent to the users when a comment is removed.
protected  CommentService getCommentService()
           
protected  NotificationSender getNotificationSender(String componentInstanceId)
           
protected  void notifyUsers(NotificationMetaData notification)
          Notifies the specified users, identified by their identifier, with the specified notification information.
 void register(String component, SilverpeasComponentService<? extends SilverpeasContent> service)
          Registers a Silverpeas component as a source of notifications about the add, the update or the deletion of a comment.
 void unregister(String component)
          Unregisters the specified component.
 
Methods inherited from class com.silverpeas.comment.service.CommentActionListener
onNotification, subscribeOnTopics, unsubscribeOnTopics
 
Methods inherited from class com.silverpeas.notification.DefaultNotificationSubscriber
getId, setId, subscribeForNotifications, unsubscribeForNotifications
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SUBJECT_COMMENT_ADDING

protected static final String DEFAULT_SUBJECT_COMMENT_ADDING
If no property with the subject of the notification message is defined in a Silverpeas component, then the below default property is taken.

See Also:
Constant Field Values

NOTIFICATION_COMMENT_ATTRIBUTE

protected 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

NOTIFICATION_CONTENT_ATTRIBUTE

protected static final String NOTIFICATION_CONTENT_ATTRIBUTE
The name of the attribute in a notification message that refers the content commented by the comment responsable of the triggering of this service.

See Also:
Constant Field Values
Constructor Detail

DefaultCommentUserNotificationService

public DefaultCommentUserNotificationService()
Method Detail

register

public void register(String component,
                     SilverpeasComponentService<? extends SilverpeasContent> service)
Registers a Silverpeas component as a source of notifications about the add, the update or the deletion of a comment. The Silverpeas component will be represented by a service that can be invoked at notification receipt.

The registration is done by specifying the unique name of the Silverpeas component and a SilverpeasComponentService object from which information about the commented resource can be get. A Silverpeas component service must be passed so that for each received event sent by an instance of the component, information about the commented resource can be get in order to both check right accesses and send a well-formed notification to the users interested by the event.

Specified by:
register in interface CommentUserNotificationService
Parameters:
component - the name of the Silverpeas component (it must be unique).
service - the Silverpeas component service from which information can be get for an instance of the Silverpeas component.

unregister

public void unregister(String component)
Unregisters the specified component. The comments handled within the specified comment won't be more treated by this service. The users won't be any more notified about them.

Specified by:
unregister in interface CommentUserNotificationService
Parameters:
component - the name of the Silverpeas component to unregister (it must be unique).

commentAdded

public void commentAdded(Comment newComment)
Sends a notification to the users that are concerned by the specified new comment on a given resource (publication, blog article, ...). The concerned users are thoses that commented the resource plus the author of the resource (in the case he's not the author of this new comment); the author of the comment isn't notified by its own comment.

Specified by:
commentAdded in interface CommentUserNotificationService
Specified by:
commentAdded in class CommentActionListener
Parameters:
newComment - the new comment.

commentRemoved

public void commentRemoved(Comment removedComment)
No notifications are sent to the users when a comment is removed. This feature isn't currently implemented.

Specified by:
commentRemoved in interface CommentUserNotificationService
Specified by:
commentRemoved in class CommentActionListener
Parameters:
removedComment - the comment that is removed.

notifyUsers

protected void notifyUsers(NotificationMetaData notification)
                    throws NotificationManagerException
Notifies the specified users, identified by their identifier, with the specified notification information.

Parameters:
notification - the notification information.
Throws:
NotificationManagerException - if the notification of the recipients fail.

getNotificationSender

protected NotificationSender getNotificationSender(String componentInstanceId)

getCommentService

protected CommentService getCommentService()


Copyright © 2016 Silverpeas. All Rights Reserved.