com.silverpeas.comment.service
Interface CommentUserNotificationService


public interface CommentUserNotificationService

It is a service dedicated to notify the concerning users about the adding or the removal of the comments on a resource managed by a given Silverpeas component instance. This service is managed by the IoC container. All Silverpeas components interested to provide this feature should register themselves with this service. The registration is done by specifying the name of the component and by passing a ResourceInfoGetter object dedicated to the registered component. So, each time an event about a comment is received, from the component instance within which the comment is added or removed, the name of the Silverpeas component can be get and then the ResourceInfoGetter object can be retrieved amoung which enough information about the commented resource can be get to send a notification to the interested users.


Field Summary
static String SUBJECT_COMMENT_ADDING
          The suffix of the property valued with the subject of the notification message to send to the users.
 
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.
 void register(String component, SilverpeasComponentService<? extends SilverpeasContent> service)
          Registers the specified Silverpeas component so that the comments created or removed in an instance of the component will be treated by this service.
 void unregister(String component)
          Unregisters the specified component.
 

Field Detail

SUBJECT_COMMENT_ADDING

static final String SUBJECT_COMMENT_ADDING
The suffix of the property valued with the subject of the notification message to send to the users. This property must be defined in the resources of the Silverpeas component module. For example, for a Silverpeas component classifieds, a property classifieds.commentAddingSubject must be defined with the subject of the notification.

See Also:
Constant Field Values
Method Detail

commentAdded

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.

Parameters:
newComment - the new comment.

commentRemoved

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

Parameters:
removedComment - the comment that is removed.

register

void register(String component,
              SilverpeasComponentService<? extends SilverpeasContent> service)
Registers the specified Silverpeas component so that the comments created or removed in an instance of the component will be treated by this service. The registration is done by specifying the unique name of the Silverpeas component and a ResourceInfoGetter object from which information about the commented resource can be get. A ResourceInfoGetter object, specific to the Silverpeas component, must be passed so that for each received event about a comment handled in an instance of the component, information about the commented resource can be get in order to send a well-formed notification to the users interested by the event about the comment.

Parameters:
component - the name of the Silverpeas component (it must be unique).
getter - the ResourceInfoGetter object specific to the registered Silverpeas Component

unregister

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.

Parameters:
component - the name of the Silverpeas component to unregister (it must be unique).


Copyright © 2016 Silverpeas. All Rights Reserved.