Update copyrights in About dialog to 2012.
[jSite.git] / src / de / todesbaum / jsite / application / Project.java
index 1f5e372..d09dacc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jSite - Project.java - Copyright © 2006–2011 David Roden
+ * jSite - Project.java - Copyright © 2006–2012 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
@@ -419,4 +419,20 @@ public class Project implements Comparable<Project> {
                return "USK@" + requestURI + "/" + path + "/" + (edition + offset) + "/";
        }
 
+       /**
+        * Performs some post-processing on the project after it was inserted
+        * successfully. At the moment it copies the current hashes of all file
+        * options to the last insert hashes, updating the hashes for the next
+        * insert.
+        */
+       public void onSuccessfulInsert() {
+               for (FileOption fileOption : fileOptions.values()) {
+                       if ((fileOption.getCurrentHash() != null) && (fileOption.getCurrentHash().length() > 0) && !fileOption.getCurrentHash().equals(fileOption.getLastInsertHash())) {
+                               fileOption.setLastInsertEdition(edition);
+                               fileOption.setLastInsertHash(fileOption.getCurrentHash());
+                       }
+                       fileOption.setForceInsert(false);
+               }
+       }
+
 }