- * @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);
- if (this.insertUri != null) {
- this.insertUri = this.insertUri.setSuggestedEdition(latestEdition);
+ * @param latestEdition
+ * The latest edition to update the URIs to
+ */
+ public void updateUris(long latestEdition) {
+ if ((requestUri != null) && (requestUri.getEdition() < latestEdition)) {
+ requestUri = requestUri.setSuggestedEdition(latestEdition);
+ }
+ if ((insertUri != null) && (insertUri.getEdition() < latestEdition)) {
+ insertUri = insertUri.setSuggestedEdition(latestEdition);
+ }
+ }
+
+ //
+ // PRIVATE METHODS
+ //
+
+ /**
+ * Updates the editions of the request URI and the insert URI (if latter is
+ * not {@code null}) with the greater edition of either one.
+ */
+ private void updateEditions() {
+ long requestEdition = 0;
+ if (requestUri != null) {
+ requestEdition = requestUri.getEdition();
+ }
+ long insertEdition = 0;
+ if (insertUri != null) {
+ insertEdition = insertUri.getEdition();