2 * Sone - PostReplyDatabase.java - Copyright © 2013 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.sone.database;
20 import java.util.Collection;
21 import java.util.List;
23 import net.pterodactylus.sone.data.PostReply;
24 import net.pterodactylus.sone.data.Sone;
26 import com.google.common.base.Optional;
29 * Database for handling {@link PostReply}s.
31 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
33 public interface PostReplyDatabase {
36 * Returns the reply with the given ID.
39 * The ID of the reply to get
40 * @return The reply, or {@code null} if there is no such reply
42 Optional<PostReply> getPostReply(String id);
45 * Returns all replies for the given post, order ascending by time.
48 * The ID of the post to get all replies for
49 * @return All replies for the given post
51 List<PostReply> getReplies(String postId);
53 boolean isPostReplyKnown(PostReply postReply);
54 void setPostReplyKnown(PostReply postReply);
57 * Stores the given post reply.
62 void storePostReply(PostReply postReply);
65 * Stores the given post replies as exclusive collection of post replies for
66 * the given Sone. This will remove all other post replies from this Sone!
69 * The Sone to store all post replies for
71 * The post replies of the Sone
72 * @throws IllegalArgumentException
73 * if one of the replies does not belong to the given Sone
75 void storePostReplies(Sone sone, Collection<PostReply> postReplies) throws IllegalArgumentException;
78 * Removes the given post reply from this store.
81 * The post reply to remove
83 void removePostReply(PostReply postReply);
86 * Removes all post replies of the given Sone.
89 * The Sone to remove all post replies for
91 void removePostReplies(Sone sone);