Use compatibility mode when getting posts
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Sone.java
index c27e8cc..7acdb7f 100644 (file)
@@ -28,7 +28,6 @@ import java.util.Comparator;
 import java.util.List;
 import java.util.Set;
 
-import javax.annotation.Nonnegative;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
@@ -36,6 +35,7 @@ import net.pterodactylus.sone.freenet.wot.Identity;
 import net.pterodactylus.sone.freenet.wot.OwnIdentity;
 import net.pterodactylus.sone.template.SoneAccessor;
 
+import com.google.common.base.Optional;
 import freenet.keys.FreenetURI;
 
 import com.google.common.base.Function;
@@ -172,17 +172,6 @@ public interface Sone extends Identified, Fingerprintable, Comparable<Sone> {
                }
        };
 
-       public static final Function<Sone, String> toSoneXmlUri =
-                       new Function<Sone, String>() {
-                               @Nonnull
-                               @Override
-                               public String apply(@Nullable Sone input) {
-                                       return input.getRequestUri()
-                                                       .setMetaString(new String[] { "sone.xml" })
-                                                       .toString();
-                               }
-                       };
-
        public static final Function<Sone, List<Album>> toAllAlbums = new Function<Sone, List<Album>>() {
                @Override
                public List<Album> apply(@Nullable Sone sone) {
@@ -200,6 +189,13 @@ public interface Sone extends Identified, Fingerprintable, Comparable<Sone> {
                }
        };
 
+       Function<Sone, Collection<Post>> toAllPosts = new Function<Sone, Collection<Post>>() {
+               @Override
+               public Collection<Post> apply(@Nullable Sone sone) {
+                       return (sone != null) ? sone.getPosts() : Collections.<Post>emptyList();
+               }
+       };
+
        /**
         * Returns the identity of this Sone.
         *
@@ -229,15 +225,6 @@ public interface Sone extends Identified, Fingerprintable, Comparable<Sone> {
        FreenetURI getRequestUri();
 
        /**
-        * Sets the request URI of this Sone.
-        *
-        * @param requestUri
-        *              The request URI of this Sone
-        * @return This Sone (for method chaining)
-        */
-       Sone setRequestUri(FreenetURI requestUri);
-
-       /**
         * Returns the insert URI of this Sone.
         *
         * @return The insert URI of this Sone
@@ -351,7 +338,7 @@ public interface Sone extends Identified, Fingerprintable, Comparable<Sone> {
         *
         * @return The friend Sones of this Sone
         */
-       List<String> getFriends();
+       Collection<String> getFriends();
 
        /**
         * Returns whether this Sone has the given Sone as a friend Sone.
@@ -364,24 +351,6 @@ public interface Sone extends Identified, Fingerprintable, Comparable<Sone> {
        boolean hasFriend(String friendSoneId);
 
        /**
-        * Adds the given Sone as a friend Sone.
-        *
-        * @param friendSone
-        *              The friend Sone to add
-        * @return This Sone (for method chaining)
-        */
-       Sone addFriend(String friendSone);
-
-       /**
-        * Removes the given Sone as a friend Sone.
-        *
-        * @param friendSoneId
-        *              The ID of the friend Sone to remove
-        * @return This Sone (for method chaining)
-        */
-       Sone removeFriend(String friendSoneId);
-
-       /**
         * Returns the list of posts of this Sone, sorted by time, newest first.
         *
         * @return All posts of this Sone
@@ -541,6 +510,7 @@ public interface Sone extends Identified, Fingerprintable, Comparable<Sone> {
         * @return The root album of this Sone
         */
        Album getRootAlbum();
+       Optional<Image> getImageByInternalId(final String internalId);
 
        /**
         * Returns Sone-specific options.