From: David ‘Bombe’ Roden Date: Thu, 14 Oct 2010 16:06:28 +0000 (+0200) Subject: Add method to update the suggested edition on the insert and request URIs. X-Git-Tag: 0.1-RC1~364 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;ds=sidebyside;h=1f597810693fe2af05e821342b83490cd75c2672;p=Sone.git Add method to update the suggested edition on the insert and request URIs. --- diff --git a/src/main/java/net/pterodactylus/sone/data/Sone.java b/src/main/java/net/pterodactylus/sone/data/Sone.java index 3baed89..8dcb442 100644 --- a/src/main/java/net/pterodactylus/sone/data/Sone.java +++ b/src/main/java/net/pterodactylus/sone/data/Sone.java @@ -44,11 +44,11 @@ public class Sone { private final String name; /** The URI under which the Sone is stored in Freenet. */ - private final FreenetURI requestUri; + private FreenetURI requestUri; /** The URI used to insert a new version of this Sone. */ /* This will be null for remote Sones! */ - private final FreenetURI insertUri; + private FreenetURI insertUri; /** The profile of this Sone. */ private Profile profile; @@ -307,6 +307,19 @@ public class Sone { this.modificationCounter = modificationCounter; } + /** + * Updates the suggested edition in both the request URI and the insert URI. + * + * @param requestUri + * The request URI that resulted from an insert + */ + public void updateUris(FreenetURI requestUri) { + /* TODO - check for the correct URI. */ + long latestEdition = requestUri.getSuggestedEdition(); + this.requestUri = this.requestUri.setSuggestedEdition(latestEdition); + this.insertUri = this.insertUri.setSuggestedEdition(latestEdition); + } + // // OBJECT METHODS //