Use unique IDs for images
[Sone.git] / src / main / java / net / pterodactylus / sone / data / impl / IdOnlySone.java
1 package net.pterodactylus.sone.data.impl;
2
3 import static java.util.Collections.emptyList;
4 import static java.util.Collections.emptySet;
5
6 import java.util.Collection;
7 import java.util.List;
8 import java.util.Set;
9
10 import net.pterodactylus.sone.data.Album;
11 import net.pterodactylus.sone.data.Client;
12 import net.pterodactylus.sone.data.Image;
13 import net.pterodactylus.sone.data.Post;
14 import net.pterodactylus.sone.data.PostReply;
15 import net.pterodactylus.sone.data.Profile;
16 import net.pterodactylus.sone.data.Sone;
17 import net.pterodactylus.sone.data.SoneOptions;
18 import net.pterodactylus.sone.freenet.wot.Identity;
19
20 import com.google.common.base.Optional;
21 import freenet.keys.FreenetURI;
22
23 import com.google.common.base.Objects;
24
25 /**
26  * {@link Sone} implementation that only stores the ID of a Sone and returns
27  * {@code null}, {@code 0}, or empty collections where appropriate.
28  *
29  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
30  */
31 public class IdOnlySone implements Sone {
32
33         private final String id;
34
35         public IdOnlySone(String id) {
36                 this.id = id;
37         }
38
39         @Override
40         public Identity getIdentity() {
41                 return null;
42         }
43
44         @Override
45         public String getName() {
46                 return id;
47         }
48
49         @Override
50         public boolean isLocal() {
51                 return false;
52         }
53
54         @Override
55         public FreenetURI getRequestUri() {
56                 return null;
57         }
58
59         @Override
60         public FreenetURI getInsertUri() {
61                 return null;
62         }
63
64         @Override
65         public long getLatestEdition() {
66                 return 0;
67         }
68
69         @Override
70         public void setLatestEdition(long latestEdition) {
71         }
72
73         @Override
74         public long getTime() {
75                 return 0;
76         }
77
78         @Override
79         public Sone setTime(long time) {
80                 return null;
81         }
82
83         @Override
84         public SoneStatus getStatus() {
85                 return null;
86         }
87
88         @Override
89         public Sone setStatus(SoneStatus status) {
90                 return null;
91         }
92
93         @Override
94         public Profile getProfile() {
95                 return new Profile(this);
96         }
97
98         @Override
99         public void setProfile(Profile profile) {
100         }
101
102         @Override
103         public Client getClient() {
104                 return null;
105         }
106
107         @Override
108         public Sone setClient(Client client) {
109                 return null;
110         }
111
112         @Override
113         public boolean isKnown() {
114                 return false;
115         }
116
117         @Override
118         public Sone setKnown(boolean known) {
119                 return null;
120         }
121
122         @Override
123         public List<String> getFriends() {
124                 return emptyList();
125         }
126
127         @Override
128         public boolean hasFriend(String friendSoneId) {
129                 return false;
130         }
131
132         @Override
133         public List<Post> getPosts() {
134                 return emptyList();
135         }
136
137         @Override
138         public Sone setPosts(Collection<Post> posts) {
139                 return this;
140         }
141
142         @Override
143         public void addPost(Post post) {
144         }
145
146         @Override
147         public void removePost(Post post) {
148         }
149
150         @Override
151         public Set<PostReply> getReplies() {
152                 return emptySet();
153         }
154
155         @Override
156         public Sone setReplies(Collection<PostReply> replies) {
157                 return this;
158         }
159
160         @Override
161         public void addReply(PostReply reply) {
162         }
163
164         @Override
165         public void removeReply(PostReply reply) {
166         }
167
168         @Override
169         public Set<String> getLikedPostIds() {
170                 return emptySet();
171         }
172
173         @Override
174         public Sone setLikePostIds(Set<String> likedPostIds) {
175                 return this;
176         }
177
178         @Override
179         public boolean isLikedPostId(String postId) {
180                 return false;
181         }
182
183         @Override
184         public Sone addLikedPostId(String postId) {
185                 return this;
186         }
187
188         @Override
189         public Sone removeLikedPostId(String postId) {
190                 return this;
191         }
192
193         @Override
194         public Set<String> getLikedReplyIds() {
195                 return emptySet();
196         }
197
198         @Override
199         public Sone setLikeReplyIds(Set<String> likedReplyIds) {
200                 return this;
201         }
202
203         @Override
204         public boolean isLikedReplyId(String replyId) {
205                 return false;
206         }
207
208         @Override
209         public Sone addLikedReplyId(String replyId) {
210                 return this;
211         }
212
213         @Override
214         public Sone removeLikedReplyId(String replyId) {
215                 return this;
216         }
217
218         @Override
219         public Album getRootAlbum() {
220                 return null;
221         }
222
223         @Override
224         public Optional<Image> getImageByInternalId(String internalId) {
225                 return Optional.absent();
226         }
227
228         @Override
229         public SoneOptions getOptions() {
230                 return null;
231         }
232
233         @Override
234         public void setOptions(SoneOptions options) {
235         }
236
237         @Override
238         public int compareTo(Sone o) {
239                 return 0;
240         }
241
242         @Override
243         public String getFingerprint() {
244                 return null;
245         }
246
247         @Override
248         public String getId() {
249                 return id;
250         }
251
252         @Override
253         public int hashCode() {
254                 return id.hashCode();
255         }
256
257         @Override
258         public boolean equals(Object object) {
259                 return (object != null) && (object.getClass() == getClass()) && Objects.equal(id, ((IdOnlySone) object).id);
260         }
261
262 }