X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdatabase%2FPostDatabase.java;h=d8956db2e1ad8a210972accc85afdf02de2a32c2;hb=4443dd5c27df6eee3f4a12db0160760300221138;hp=08328075d7514b0b7434cbb88ed968688c4690d0;hpb=027615fa64c78ef5ebc198e852cfd6d39b18aad0;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/database/PostDatabase.java b/src/main/java/net/pterodactylus/sone/database/PostDatabase.java
index 0832807..d8956db 100644
--- a/src/main/java/net/pterodactylus/sone/database/PostDatabase.java
+++ b/src/main/java/net/pterodactylus/sone/database/PostDatabase.java
@@ -17,14 +17,92 @@
package net.pterodactylus.sone.database;
+import java.util.Collection;
+import java.util.Set;
+
+import net.pterodactylus.sone.data.Post;
+import net.pterodactylus.sone.data.Sone;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+
/**
- * Combines a {@link PostProvider}, a {@link PostBuilderFactory}, and a
- * {@link PostStore} into a complete post database.
+ * Database for handling {@link Post}s.
*
* @author David âBombeâ Roden
*/
-public interface PostDatabase extends PostProvider, PostStore {
+public interface PostDatabase {
+
+ Function> getPost();
+
+ /**
+ * Returns the post with the given ID.
+ *
+ * @param postId
+ * The ID of the post to return
+ * @return The post with the given ID, or {@code null}
+ */
+ Optional getPost(String postId);
+
+ /**
+ * Returns all posts from the given Sone.
+ *
+ * @param soneId
+ * The ID of the Sone
+ * @return All posts from the given Sone
+ */
+ Collection getPosts(String soneId);
+
+ /**
+ * Returns all posts that have the given Sone as recipient.
+ *
+ * @see Post#getRecipient()
+ * @param recipientId
+ * The ID of the recipient of the posts
+ * @return All posts that have the given Sone as recipient
+ */
+ Collection getDirectedPosts(String recipientId);
+
+ /**
+ * Adds the given post to the store.
+ *
+ * @param post
+ * The post to store
+ */
+ void storePost(Post post);
+
+ /**
+ * Removes the given post.
+ *
+ * @param post
+ * The post to remove
+ */
+ 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
+ */
+ void storePosts(Sone sone, Collection posts) throws IllegalArgumentException;
+
+ /**
+ * Removes all posts of the given {@link Sone}
+ *
+ * @param sone
+ * The Sone to remove all posts for
+ */
+ void removePosts(Sone sone);
- /* nothing here. */
+ void likePost(Post post, Sone localSone);
+ void unlikePost(Post post, Sone localSone);
+ boolean isLiked(Post post, Sone sone);
+ Set getLikes(Post post);
}