Class CommentListenerService

java.lang.Object
fr.paris.lutece.plugins.extend.modules.comment.service.CommentListenerService

public class CommentListenerService extends Object
Service to manage listeners over comments
  • Field Details

    • CONSTANT_EVERY_EXTENDABLE_RESOURCE_TYPE

      public static final String CONSTANT_EVERY_EXTENDABLE_RESOURCE_TYPE
      Constant that represents every extendable resource type
      See Also:
  • Method Details

    • registerListener

      public static void registerListener(String strExtendableResourceType, ICommentListener listener)
      Register a comment listener.
      Parameters:
      strExtendableResourceType - The extendable resource type associated with the listener. Use CONSTANT_EVERY_EXTENDABLE_RESOURCE_TYPE to associated the listener with every resource type.
      listener - The listener to register
    • hasListener

      public static boolean hasListener()
      Check if there is listeners to notify
      Returns:
      True if there is at last one listener, false otherwise
    • createComment

      public static void createComment(String strExtendableResourceType, String strIdExtendableResource, boolean bPublished)
      Notify to listeners the creation of a comment. Only listeners associated with the extendable resource type of the comment are notified.
      Parameters:
      strExtendableResourceType - The extendable resource type of the created comment
      strIdExtendableResource - The extendable resource id of the comment
      bPublished - True if the comment is published, false otherwise
    • createComment

      public static void createComment(String strExtendableResourceType, String strIdExtendableResource, boolean bPublished, jakarta.servlet.http.HttpServletRequest request)
      Notify to listeners the creation of a comment. Only listeners associated with the extendable resource type of the comment are notified.
      Parameters:
      strExtendableResourceType - The extendable resource type of the created comment
      strIdExtendableResource - The extendable resource id of the comment
      bPublished - True if the comment is published, false otherwise
      request - the HTTP request
    • publishComment

      public static void publishComment(int nIdComment, boolean bPublished)
      Notify to listeners the modification of a comment. Only listeners associated with the extendable resource type of the comment are notified.
      Parameters:
      nIdComment - The id of the updated comment
      bPublished - True if the comment was published, false if it was unpublished
    • publishComment

      public static void publishComment(String strExtendableResourceType, String strIdExtendableResource, boolean bPublished)
      Notify to listeners the modification of a comment. Only listeners associated with the extendable resource type of the comment are notified.
      Parameters:
      strExtendableResourceType - The extendable resource type of the updated comment
      strIdExtendableResource - The extendable resource id of the comment
      bPublished - True if the comment was published, false if it was unpublished
    • deleteComment

      public static void deleteComment(String strExtendableResourceType, String strIdExtendableResource, List<Integer> listIdRemovedComment)
      Notify to listeners the modification of a comment. Only listeners associated with the extendable resource type of the comment are notified.
      Parameters:
      strExtendableResourceType - The extendable resource type of the removed comment
      strIdExtendableResource - The extendable resource id of the comment
      listIdRemovedComment - The list of ids of removed comments
    • checkComment

      public static String checkComment(String comment, String strExtendableResourceType, String uidUser)
      Notify the check comment
      Parameters:
      listErrors -
      Returns:
    • checkComment

      public static String checkComment(String comment, String strExtendableResourceType, String strResourceId, String uidUser)
      Notify the check comment
      Parameters:
      listErrors -
      Returns:
    • canComment

      public static boolean canComment(fr.paris.lutece.portal.service.security.LuteceUser user, String strIdExtendableResource, String strExtendableResourceType)
      Check if a user can comment. Call listeners.
      Parameters:
      user - The lutece user
      strIdExtendableResource - The id of the extendable resource
      strExtendableResourceType - The type of the resource
      Returns:
      true when the user has the rights, otherwise false