Class AbstractNotifyCommentAuthorObserver

java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.web.repository.comment.AbstractNotifyCommentAuthorObserver
All Implemented Interfaces:
Observer, LogEnabled, PluginAware, Prioritizable, Supporter<Event>, Contextualizable, Serviceable
Direct Known Subclasses:
NotifyCommentAuthorWhenReplyingObserver, SendMailToVisitorCommentListener

Abstract observer to notify comment authors when a comment is created or updated.
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • contextualize

      public void contextualize(Context context) throws ContextException
      Specified by:
      contextualize in interface Contextualizable
      Throws:
      ContextException
    • setPluginInfo

      public void setPluginInfo(String pluginName, String featureName, String id)
      Description copied from interface: PluginAware
      Sets the plugin info relative to the current component.
      Note : The feature name may be null if the targeted component in declared at plugin level.
      Specified by:
      setPluginInfo in interface PluginAware
      Parameters:
      pluginName - Unique identifier for the plugin hosting the extension
      featureName - Unique feature identifier (unique for a given pluginName)
      id - Unique identifier of this component
    • getPriority

      public int getPriority()
      Description copied from interface: Prioritizable
      Get the priority for the component. On components using Prioritizable interface, each implementation define the order. In most cases, less is the number, more prior is the component.
      Specified by:
      getPriority in interface Prioritizable
      Returns:
      the priority
    • getMailLanguage

      protected String getMailLanguage(Content content, Comment comment)
      Get the language to use for the mail notification of a comment
      Parameters:
      content - The content commented
      comment - The comment it self
      Returns:
      The language to use for the mail notification of a comment
    • getMailLanguage

      protected String getMailLanguage(Content content, UserIdentity commentAuthor, String commentAuthorEmail)
      Get the language to use for the mail notification of a comment
      Parameters:
      content - The content commented
      commentAuthor - The user identity of the comment's author if it exists (null for unauthenticated comment), used to get the user's language
      commentAuthorEmail - The email of the comment's author, used to find a user with this email on the content's site and get its language if the author user identity is not provided
      Returns:
      The language to use for the mail notification of a comment
    • getMailLanguage

      protected String getMailLanguage(Content content, User user)
      Get the language to use for the mail notification of a comment
      Parameters:
      content - The content commented
      user - The user to notify. Can be null, in this case the content's language or the default language will be used
      Returns:
      The language to use for the mail notification of a comment
    • resolveCommentAuthor

      protected User resolveCommentAuthor(Content content, Comment comment)
      Try to resolve the user author of the comment as a User from author or email provided in the comment
      Parameters:
      content - the commented content
      comment - the comment
      Returns:
      The user author or null if not found
    • resolveCommentAuthor

      protected User resolveCommentAuthor(Content content, UserIdentity commentAuthor, String commentAuthorEmail)
      Try to resolve the user author of the comment as a User from author or email provided in the comment
      Parameters:
      content - The content commented
      commentAuthor - The user identity of the comment's author if it exists (null for unauthenticated comment), used to get the user's language
      commentAuthorEmail - The email of the comment's author, used to find a user with this email on the content's site and get its language if the author user identity is not provided
      Returns:
      The user author or null if not found
    • getMailSender

      protected String getMailSender(Content content)
      Get the email sender for the mail notification of a comment
      Parameters:
      content - The content commented
      Returns:
      The email sender for the mail notification of a comment
    • getMailRecipient

      protected String getMailRecipient(Comment comment)
      Get the email recipient for the mail notification of a comment
      Parameters:
      comment - The comment
      Returns:
      The email recipient for the mail notification of a comment. Can be null or empty.