Add method to copy the hashes after a project was inserted.
[jSite.git] / src / de / todesbaum / jsite / application / Project.java
index 669b782..16acd49 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * jSite - a tool for uploading websites into Freenet Copyright (C) 2006 David
- * Roden
+ * jSite - Project.java - Copyright © 2006–2011 David Roden
  *
  * This program is free software; you can redistribute it and/or modify it under
  * the terms of the GNU General Public License as published by the Free Software
@@ -420,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());
+               }
+       }
+
 }