- * Returns whether the target Sone is trusted by the origin Sone.
- *
- * @param origin
- * The origin Sone
- * @param target
- * The target Sone
- * @return {@code true} if the target Sone is trusted by the origin Sone
- */
- public boolean isSoneTrusted(Sone origin, Sone target) {
- checkNotNull(origin, "origin must not be null");
- checkNotNull(target, "target must not be null");
- checkArgument(origin.getIdentity() instanceof OwnIdentity, "origin’s identity must be an OwnIdentity");
- return trustedIdentities.containsEntry(origin.getIdentity(), target.getIdentity());
- }
-
- /** {@inheritDoc} */
- @Override
- public Optional<Post> getPost(String postId) {
- return database.getPost(postId);
- }
-
- /** {@inheritDocs} */
- @Override
- public Collection<Post> getPosts(String soneId) {
- return database.getPosts(soneId);
- }
-
- /** {@inheritDoc} */
- @Override
- public Collection<Post> getDirectedPosts(final String recipientId) {
- checkNotNull(recipientId, "recipient must not be null");
- return database.getDirectedPosts(recipientId);
- }
-
- /**
- * Returns a post reply builder.
- *
- * @return A new post reply builder
- */
- public PostReplyBuilder postReplyBuilder() {
- return database.newPostReplyBuilder();
- }
-
- /** {@inheritDoc} */
- @Override
- public Optional<PostReply> getPostReply(String replyId) {
- return database.getPostReply(replyId);
- }
-
- /** {@inheritDoc} */
- @Override
- public List<PostReply> getReplies(final String postId) {
- return database.getReplies(postId);
- }
-
- /**
- * Returns all Sones that have liked the given post.
- *
- * @param post
- * The post to get the liking Sones for
- * @return The Sones that like the given post
- */
- public Set<Sone> getLikes(Post post) {
- Set<Sone> sones = new HashSet<Sone>();
- for (Sone sone : getSones()) {
- if (sone.getLikedPostIds().contains(post.getId())) {
- sones.add(sone);
- }
- }
- return sones;
- }
-
- /**
- * Returns all Sones that have liked the given reply.
- *
- * @param reply
- * The reply to get the liking Sones for
- * @return The Sones that like the given reply
- */
- public Set<Sone> getLikes(PostReply reply) {
- Set<Sone> sones = new HashSet<Sone>();
- for (Sone sone : getSones()) {
- if (sone.getLikedReplyIds().contains(reply.getId())) {
- sones.add(sone);
- }
- }
- return sones;
- }
-
- /**