Set the last insert edition of all inserted files after the project finished.
[jSite.git] / src / de / todesbaum / jsite / application / Project.java
index 1f5e372..b0ceb7f 100644 (file)
@@ -419,4 +419,18 @@ 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()) {
+                       if (!fileOption.getCurrentHash().equals(fileOption.getLastInsertHash())) {
+                               fileOption.setLastInsertEdition(edition);
+                               fileOption.setLastInsertHash(fileOption.getCurrentHash());
+                       }
+               }
+       }
+
 }