Examples of CommentListener


Examples of net.sourceforge.pebble.api.event.comment.CommentListener

    log.debug("Registering comment listeners");

    for (String className : getCommentListeners()) {
      try {
        Class<?> c = Class.forName(className.trim());
        CommentListener listener = instantiate(c.asSubclass(CommentListener.class));
        eventListenerList.addCommentListener(listener);
      } catch (Exception e) {
        error("Could not start comment listener \"" + className + "\" - check the class name is correct on the <a href=\"viewPlugins.secureaction#commentListeners\">plugins page</a>.");
        log.error("Comment listener " + className + " could not be registered", e);
      }
View Full Code Here

Examples of net.sourceforge.pebble.api.event.comment.CommentListener

    log.debug("Registering comment listeners");

    for (String className : getCommentListeners()) {
      try {
        Class<?> c = Class.forName(className.trim());
        CommentListener listener = instantiate(c.asSubclass(CommentListener.class));
        eventListenerList.addCommentListener(listener);
      } catch (Exception e) {
        error("Could not start comment listener \"" + className + "\" - check the class name is correct on the <a href=\"viewPlugins.secureaction#commentListeners\">plugins page</a>.");
        log.error("Comment listener " + className + " could not be registered", e);
      }
View Full Code Here

Examples of net.sourceforge.pebble.api.event.comment.CommentListener

    if (SecurityUtils.isUserAuthorisedForBlog(blog)) {
      return false;
    } else {
      // run a subset of the default comment listeners to figure out whether
      // the comment is spam
      CommentListener listener1 = new IpAddressListener();
      CommentListener listener2 = new LinkSpamListener();
      CommentListener listener3 = new ContentSpamListener();
      CommentListener listener4 = new SpamScoreListener();
      CommentEvent event = new CommentEvent(comment, CommentEvent.COMMENT_ADDED);

      listener1.commentAdded(event);
      listener2.commentAdded(event);
      listener3.commentAdded(event);
      listener4.commentAdded(event);

      return (required != null && required.equalsIgnoreCase("true")) || !comment.isApproved();
    }
  }
View Full Code Here

Examples of net.sourceforge.pebble.api.event.comment.CommentListener

   * @param event   the CommentEvent instance
   */
  public void fireCommentEvent(CommentEvent event) {
    Iterator it = getEventListenerList().getCommentListeners().iterator();
    while (it.hasNext()) {
      CommentListener listener = (CommentListener)it.next();
      if (event.getType() == CommentEvent.COMMENT_ADDED) {
        listener.commentAdded(event);
      } else if (event.getType() == CommentEvent.COMMENT_REMOVED) {
        listener.commentRemoved(event);
      } else if (event.getType() == CommentEvent.COMMENT_APPROVED) {
        listener.commentApproved(event);
      } else if (event.getType() == CommentEvent.COMMENT_REJECTED) {
        listener.commentRejected(event);
      }

      // has the event been vetoed?
      if (event.isVetoed()) {
        break;
View Full Code Here

Examples of net.sourceforge.pebble.api.event.comment.CommentListener

   */
  public void testListenersFiredWhenCommentAdded() throws Exception {
    final StringBuffer buf = new StringBuffer("123");
    final Comment comment = blogEntry.createComment("title", "body", "author", "email", "website", "avatar", "127.0.0.1");

    CommentListener listener = new CommentListener() {
      public void commentAdded(CommentEvent event) {
        assertEquals(comment, event.getSource());
        buf.reverse();
      }

View Full Code Here

Examples of net.sourceforge.pebble.api.event.comment.CommentListener

    final StringBuffer buf = new StringBuffer("123");
    final Comment comment = blogEntry.createComment("title", "body", "author", "email", "website", "avatar", "127.0.0.1");
    blogEntry.addComment(comment);
    service.putBlogEntry(blogEntry);

    CommentListener listener = new CommentListener() {
      public void commentAdded(CommentEvent event) {
        fail();
      }

      public void commentRemoved(CommentEvent event) {
View Full Code Here

Examples of net.sourceforge.pebble.api.event.comment.CommentListener

    blogEntry.addComment(comment);
    comment.setPending();
    service.putBlogEntry(blogEntry);

    CommentListener listener = new CommentListener() {
      public void commentAdded(CommentEvent event) {
        fail();
      }

      public void commentRemoved(CommentEvent event) {
View Full Code Here

Examples of net.sourceforge.pebble.api.event.comment.CommentListener

    final Comment comment = blogEntry.createComment("title", "body", "author", "email", "website", "avatar", "127.0.0.1");
    blogEntry.addComment(comment);
    comment.setPending();
    service.putBlogEntry(blogEntry);

    CommentListener listener = new CommentListener() {
      public void commentAdded(CommentEvent event) {
      }

      public void commentRemoved(CommentEvent event) {
      }
View Full Code Here

Examples of net.sourceforge.pebble.api.event.comment.CommentListener

    blogEntry.addComment(comment3);
    service.putBlogEntry(blogEntry);

    final List comments = new ArrayList();

    CommentListener listener = new CommentListener() {
      public void commentAdded(CommentEvent event) {
        fail();
      }

      public void commentRemoved(CommentEvent event) {
View Full Code Here

Examples of net.sourceforge.pebble.api.event.comment.CommentListener

  /**
   * Tests that listeners are not fired when a comment is marked as pending.
   */
  public void testListenersFiredWhenCommentMarkedAsPending() {

    CommentListener listener = new CommentListener() {
      public void commentAdded(CommentEvent event) {
        fail();
      }

      public void commentRemoved(CommentEvent event) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.