X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FSone.java;h=989c6a1ea4cd127751a8222104167750ab1f3099;hb=54e40cf0c1c650e9eca2d50762a92b5d13ccfa85;hp=797300126e6ee728a6b190ff76f2f6cce93b8f9f;hpb=7948a66da729b30be545d553e7a8234b5957b165;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/data/Sone.java b/src/main/java/net/pterodactylus/sone/data/Sone.java index 7973001..989c6a1 100644 --- a/src/main/java/net/pterodactylus/sone/data/Sone.java +++ b/src/main/java/net/pterodactylus/sone/data/Sone.java @@ -19,6 +19,7 @@ package net.pterodactylus.sone.data; import static com.google.common.collect.FluentIterable.from; import static java.util.Arrays.asList; +import static net.pterodactylus.sone.core.SoneUri.create; import static net.pterodactylus.sone.data.Album.FLATTENER; import static net.pterodactylus.sone.data.Album.IMAGES; @@ -35,10 +36,10 @@ import net.pterodactylus.sone.freenet.wot.Identity; import net.pterodactylus.sone.freenet.wot.OwnIdentity; import net.pterodactylus.sone.template.SoneAccessor; -import freenet.keys.FreenetURI; - +import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.primitives.Ints; +import freenet.keys.FreenetURI; /** * A Sone defines everything about a user: her profile, her status updates, her @@ -170,6 +171,13 @@ public interface Sone extends Identified, Fingerprintable, Comparable { } }; + public static final Function TO_FREENET_URI = new Function() { + @Override + public FreenetURI apply(Sone sone) { + return (sone == null) ? null : create(sone.getIdentity().getRequestUri()); + } + }; + /** * Returns the identity of this Sone. * @@ -192,38 +200,6 @@ public interface Sone extends Identified, Fingerprintable, Comparable { boolean isLocal(); /** - * Returns the request URI of this Sone. - * - * @return The request URI of this 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 - */ - FreenetURI getInsertUri(); - - /** - * Sets the insert URI of this Sone. - * - * @param insertUri - * The insert URI of this Sone - * @return This Sone (for method chaining) - */ - Sone setInsertUri(FreenetURI insertUri); - - /** * Returns the latest edition of this Sone. * * @return The latest edition of this Sone @@ -231,16 +207,6 @@ public interface Sone extends Identified, Fingerprintable, Comparable { long getLatestEdition(); /** - * Sets the latest edition of this Sone. If the given latest edition is not - * greater than the current latest edition, the latest edition of this Sone is - * not changed. - * - * @param latestEdition - * The latest edition of this Sone - */ - void setLatestEdition(long latestEdition); - - /** * Return the time of the last inserted update of this Sone. * * @return The time of the update (in milliseconds since Jan 1, 1970 UTC) @@ -301,15 +267,6 @@ public interface Sone extends Identified, Fingerprintable, Comparable { Client getClient(); /** - * Sets the client used by this Sone. - * - * @param client - * The client used by this Sone, or {@code null} - * @return This Sone (for method chaining) - */ - Sone setClient(Client client); - - /** * Returns whether this Sone is known. * * @return {@code true} if this Sone is known, {@code false} otherwise @@ -543,4 +500,13 @@ public interface Sone extends Identified, Fingerprintable, Comparable { PostReplyBuilder newPostReplyBuilder(String postId) throws IllegalStateException; + Modifier modify(); + + interface Modifier { + + Modifier setLatestEdition(long latestEdition); + Sone update(); + + } + }