Add methods to notify core listeners about removed posts and replies.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 6 Dec 2010 05:44:07 +0000 (06:44 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 6 Dec 2010 05:44:07 +0000 (06:44 +0100)
src/main/java/net/pterodactylus/sone/core/CoreListener.java
src/main/java/net/pterodactylus/sone/core/CoreListenerManager.java
src/main/java/net/pterodactylus/sone/web/WebInterface.java

index 595d11a..950e890 100644 (file)
@@ -95,4 +95,20 @@ public interface CoreListener extends EventListener {
         */
        public void markReplyKnown(Reply reply);
 
+       /**
+        * Notifies a listener that the given post was removed.
+        *
+        * @param post
+        *            The removed post
+        */
+       public void postRemoved(Post post);
+
+       /**
+        * Notifies a listener that the given reply was removed.
+        *
+        * @param reply
+        *            The removed reply
+        */
+       public void replyRemoved(Reply reply);
+
 }
index 0fd8b1a..7ba226b 100644 (file)
@@ -145,4 +145,30 @@ public class CoreListenerManager extends AbstractListenerManager<Core, CoreListe
                }
        }
 
+       /**
+        * Notifies all listener that the given post was removed.
+        *
+        * @see CoreListener#postRemoved(Post)
+        * @param post
+        *            The removed post
+        */
+       void firePostRemoved(Post post) {
+               for (CoreListener coreListener : getListeners()) {
+                       coreListener.postRemoved(post);
+               }
+       }
+
+       /**
+        * Notifies all listener that the given reply was removed.
+        *
+        * @see CoreListener#replyRemoved(Reply)
+        * @param reply
+        *            The removed reply
+        */
+       void fireReplyRemoved(Reply reply) {
+               for (CoreListener coreListener : getListeners()) {
+                       coreListener.replyRemoved(reply);
+               }
+       }
+
 }
index 75b218c..dc09d78 100644 (file)
@@ -491,6 +491,22 @@ public class WebInterface implements CoreListener {
        }
 
        /**
+        * {@inheritDoc}
+        */
+       @Override
+       public void postRemoved(Post post) {
+               /* TODO */
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public void replyRemoved(Reply reply) {
+               /* TODO */
+       }
+
+       /**
         * Template provider implementation that uses
         * {@link WebInterface#createReader(String)} to load templates for
         * inclusion.