Use unique IDs for images
[Sone.git] / src / main / java / net / pterodactylus / sone / data / impl / IdOnlySone.java
index 0ef220b..85402ce 100644 (file)
@@ -9,6 +9,7 @@ import java.util.Set;
 
 import net.pterodactylus.sone.data.Album;
 import net.pterodactylus.sone.data.Client;
+import net.pterodactylus.sone.data.Image;
 import net.pterodactylus.sone.data.Post;
 import net.pterodactylus.sone.data.PostReply;
 import net.pterodactylus.sone.data.Profile;
@@ -16,8 +17,11 @@ import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.data.SoneOptions;
 import net.pterodactylus.sone.freenet.wot.Identity;
 
+import com.google.common.base.Optional;
 import freenet.keys.FreenetURI;
 
+import com.google.common.base.Objects;
+
 /**
  * {@link Sone} implementation that only stores the ID of a Sone and returns
  * {@code null}, {@code 0}, or empty collections where appropriate.
@@ -217,6 +221,11 @@ public class IdOnlySone implements Sone {
        }
 
        @Override
+       public Optional<Image> getImageByInternalId(String internalId) {
+               return Optional.absent();
+       }
+
+       @Override
        public SoneOptions getOptions() {
                return null;
        }
@@ -240,4 +249,14 @@ public class IdOnlySone implements Sone {
                return id;
        }
 
+       @Override
+       public int hashCode() {
+               return id.hashCode();
+       }
+
+       @Override
+       public boolean equals(Object object) {
+               return (object != null) && (object.getClass() == getClass()) && Objects.equal(id, ((IdOnlySone) object).id);
+       }
+
 }