X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdatabase%2FPostReplyDatabase.java;h=1b8fbe5f7924c01df239af487ca1fa6e126e168c;hb=53164b673d81b508ba6ef0d8578c033f1eba1ddc;hp=c9a809fbab80e5eb34140ea62189cd130a26f1b0;hpb=6e9a43ccd93ae125720547c0fe421dc81a54ba90;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/database/PostReplyDatabase.java b/src/main/java/net/pterodactylus/sone/database/PostReplyDatabase.java
index c9a809f..1b8fbe5 100644
--- a/src/main/java/net/pterodactylus/sone/database/PostReplyDatabase.java
+++ b/src/main/java/net/pterodactylus/sone/database/PostReplyDatabase.java
@@ -17,14 +17,77 @@
package net.pterodactylus.sone.database;
+import java.util.Collection;
+import java.util.List;
+
+import net.pterodactylus.sone.data.PostReply;
+import net.pterodactylus.sone.data.Sone;
+
+import com.google.common.base.Optional;
+
/**
- * Combines a {@link PostReplyProvider}, a {@link PostReplyBuilderFactory}, and
- * a {@link PostReplyStore} into a complete post reply database.
+ * Database for handling {@link PostReply}s.
*
* @author David âBombeâ Roden
*/
-public interface PostReplyDatabase extends PostReplyProvider, PostReplyBuilderFactory, PostReplyStore {
+public interface PostReplyDatabase {
+
+ /**
+ * Returns the reply with the given ID.
+ *
+ * @param id
+ * The ID of the reply to get
+ * @return The reply, or {@code null} if there is no such reply
+ */
+ Optional getPostReply(String id);
+
+ /**
+ * Returns all replies for the given post, order ascending by time.
+ *
+ * @param postId
+ * The ID of the post to get all replies for
+ * @return All replies for the given post
+ */
+ List getReplies(String postId);
+
+ boolean isPostReplyKnown(PostReply postReply);
+ void setPostReplyKnown(PostReply postReply);
+
+ /**
+ * Stores the given post reply.
+ *
+ * @param postReply
+ * The post reply
+ */
+ 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
+ */
+ void storePostReplies(Sone sone, Collection postReplies) throws IllegalArgumentException;
+
+ /**
+ * Removes the given post reply from this store.
+ *
+ * @param postReply
+ * The post reply to remove
+ */
+ void removePostReply(PostReply postReply);
- /* nothing here. */
+ /**
+ * Removes all post replies of the given Sone.
+ *
+ * @param sone
+ * The Sone to remove all post replies for
+ */
+ void removePostReplies(Sone sone);
}