Add method to copy the hashes after a project was inserted.
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 17 Mar 2012 02:02:01 +0000 (03:02 +0100)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 17 Mar 2012 02:02:01 +0000 (03:02 +0100)
src/de/todesbaum/jsite/application/Project.java

index 1f5e372..16acd49 100644 (file)
@@ -419,4 +419,15 @@ public class Project implements Comparable<Project> {
                return "USK@" + requestURI + "/" + path + "/" + (edition + offset) + "/";
        }
 
+       /**
+        * Copies the current hashes of all file options to the last insert hashes,
+        * updating the hashes for the next insert. This method should only be
+        * called after the insert has finished successfully.
+        */
+       public void copyHashes() {
+               for (FileOption fileOption : fileOptions.values()) {
+                       fileOption.setLastInsertHash(fileOption.getCurrentHash());
+               }
+       }
+
 }