From 1f597810693fe2af05e821342b83490cd75c2672 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 14 Oct 2010 18:06:28 +0200 Subject: [PATCH] Add method to update the suggested edition on the insert and request URIs. --- src/main/java/net/pterodactylus/sone/data/Sone.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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 // -- 2.7.4