projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Store the “known” status of a post in the database.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
data
/
Post.java
diff --git
a/src/main/java/net/pterodactylus/sone/data/Post.java
b/src/main/java/net/pterodactylus/sone/data/Post.java
index
759a8ba
..
bd3986f
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/data/Post.java
+++ b/
src/main/java/net/pterodactylus/sone/data/Post.java
@@
-17,8
+17,12
@@
package net.pterodactylus.sone.data;
package net.pterodactylus.sone.data;
+import java.util.Collections;
import java.util.Comparator;
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;
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
//
//
// ACCESSORS
//
@@
-108,10
+119,16
@@
public interface Post extends Identified {
/**
* Sets whether this post is known.
*
/**
* Sets whether this post is known.
*
- * @param known
- * {@code true} if this post is known, {@code false} otherwise
* @return This post
*/
* @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();
}
}