Remove some unused methods.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 4 Nov 2014 19:22:40 +0000 (20:22 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 4 Nov 2014 19:22:40 +0000 (20:22 +0100)
src/main/java/net/pterodactylus/sone/database/PostReplyStore.java
src/main/java/net/pterodactylus/sone/database/PostStore.java
src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java

index a3cefb3..30268b8 100644 (file)
@@ -38,19 +38,6 @@ public interface PostReplyStore {
        public void storePostReply(PostReply postReply);
 
        /**
-        * Stores the given post replies as exclusive collection of post replies for
-        * the given Sone. This will remove all other post replies from this Sone!
-        *
-        * @param sone
-        *            The Sone to store all post replies for
-        * @param postReplies
-        *            The post replies of the Sone
-        * @throws IllegalArgumentException
-        *             if one of the replies does not belong to the given Sone
-        */
-       public void storePostReplies(Sone sone, Collection<PostReply> postReplies) throws IllegalArgumentException;
-
-       /**
         * Removes the given post reply from this store.
         *
         * @param postReply
@@ -58,12 +45,4 @@ public interface PostReplyStore {
         */
        public void removePostReply(PostReply postReply);
 
-       /**
-        * Removes all post replies of the given Sone.
-        *
-        * @param sone
-        *            The Sone to remove all post replies for
-        */
-       public void removePostReplies(Sone sone);
-
 }
index 9c2ca42..402a647 100644 (file)
@@ -45,25 +45,4 @@ public interface PostStore {
         */
        public void removePost(Post post);
 
-       /**
-        * Stores the given posts as all posts of a single {@link Sone}. This method
-        * will removed all other posts from the Sone!
-        *
-        * @param sone
-        *            The Sone to store the posts for
-        * @param posts
-        *            The posts to store
-        * @throws IllegalArgumentException
-        *             if posts do not all belong to the same Sone
-        */
-       public void storePosts(Sone sone, Collection<Post> posts) throws IllegalArgumentException;
-
-       /**
-        * Removes all posts of the given {@link Sone}
-        *
-        * @param sone
-        *            The Sone to remove all posts for
-        */
-       public void removePosts(Sone sone);
-
 }
index 0f795eb..eb0d20a 100644 (file)
@@ -357,51 +357,6 @@ public class MemoryDatabase extends AbstractService implements Database {
                }
        }
 
-       /** {@inheritDocs} */
-       @Override
-       public void storePosts(Sone sone, Collection<Post> posts) throws IllegalArgumentException {
-               checkNotNull(sone, "sone must not be null");
-               /* verify that all posts are from the same Sone. */
-               for (Post post : posts) {
-                       if (!sone.equals(post.getSone())) {
-                               throw new IllegalArgumentException(String.format("Post from different Sone found: %s", post));
-                       }
-               }
-
-               lock.writeLock().lock();
-               try {
-                       /* remove all posts by the Sone. */
-                       Collection<Post> oldPosts = getPostsFrom(sone.getId());
-                       for (Post post : oldPosts) {
-                               allPosts.remove(post.getId());
-                       }
-
-                       /* add new posts. */
-                       getPostsFrom(sone.getId()).addAll(posts);
-                       for (Post post : posts) {
-                               allPosts.put(post.getId(), post);
-                       }
-               } finally {
-                       lock.writeLock().unlock();
-               }
-       }
-
-       /** {@inheritDocs} */
-       @Override
-       public void removePosts(Sone sone) {
-               checkNotNull(sone, "sone must not be null");
-               lock.writeLock().lock();
-               try {
-                       /* remove all posts by the Sone. */
-                       getPostsFrom(sone.getId()).clear();
-                       for (Post post : sone.getPosts()) {
-                               allPosts.remove(post.getId());
-                       }
-               } finally {
-                       lock.writeLock().unlock();
-               }
-       }
-
        //
        // POSTREPLYPROVIDER METHODS
        //
@@ -461,32 +416,6 @@ public class MemoryDatabase extends AbstractService implements Database {
 
        /** {@inheritDocs} */
        @Override
-       public void storePostReplies(Sone sone, Collection<PostReply> postReplies) {
-               checkNotNull(sone, "sone must not be null");
-               /* verify that all posts are from the same Sone. */
-               for (PostReply postReply : postReplies) {
-                       if (!sone.equals(postReply.getSone())) {
-                               throw new IllegalArgumentException(String.format("PostReply from different Sone found: %s", postReply));
-                       }
-               }
-
-               lock.writeLock().lock();
-               try {
-                       /* remove all post replies of the Sone. */
-                       for (PostReply postReply : getRepliesFrom(sone.getId())) {
-                               removePostReply(postReply);
-                       }
-                       for (PostReply postReply : postReplies) {
-                               allPostReplies.put(postReply.getId(), postReply);
-                               sonePostReplies.put(postReply.getSone().getId(), postReply);
-                       }
-               } finally {
-                       lock.writeLock().unlock();
-               }
-       }
-
-       /** {@inheritDocs} */
-       @Override
        public void removePostReply(PostReply postReply) {
                lock.writeLock().lock();
                try {
@@ -496,21 +425,6 @@ public class MemoryDatabase extends AbstractService implements Database {
                }
        }
 
-       /** {@inheritDocs} */
-       @Override
-       public void removePostReplies(Sone sone) {
-               checkNotNull(sone, "sone must not be null");
-
-               lock.writeLock().lock();
-               try {
-                       for (PostReply postReply : sone.getReplies()) {
-                               removePostReply(postReply);
-                       }
-               } finally {
-                       lock.writeLock().unlock();
-               }
-       }
-
        //
        // ALBUMPROVDER METHODS
        //