Store the “known” status of a post in the database.
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Post.java
index 759a8ba..bd3986f 100644 (file)
 
 package net.pterodactylus.sone.data;
 
+import java.util.Collections;
 import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
 
+import com.google.common.base.Function;
 import com.google.common.base.Optional;
 import com.google.common.base.Predicate;
 
@@ -50,6 +54,13 @@ public interface Post extends Identified {
 
        };
 
+       public static final Function<Post, List<PostReply>> TO_REPLIES = new Function<Post, List<PostReply>>() {
+               @Override
+               public List<PostReply> apply(Post post) {
+                       return (post == null) ? Collections.<PostReply>emptyList() : post.getReplies();
+               }
+       };
+
        //
        // ACCESSORS
        //
@@ -108,10 +119,16 @@ public interface Post extends Identified {
        /**
         * Sets whether this post is known.
         *
-        * @param known
-        *            {@code true} if this post is known, {@code false} otherwise
         * @return This post
         */
-       public Post setKnown(boolean known);
+       public Post setKnown();
+
+       void like(Sone localSone);
+       void unlike(Sone localSone);
+
+       boolean isLiked(Sone sone);
+       Set<Sone> getLikes();
+
+       List<PostReply> getReplies();
 
 }