X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Fjsite%2Fapplication%2FProject.java;h=d09daccb095e84af173544e7b112c8c57bf56a68;hb=e47e15fdbb7515f5a3757c3f5df8c1d0950aee8e;hp=669b7829a08e7c36d9fb73551569822a7caaecd3;hpb=d5da3f0c6ec434e9d0754576c002762f49cf26bb;p=jSite.git diff --git a/src/de/todesbaum/jsite/application/Project.java b/src/de/todesbaum/jsite/application/Project.java index 669b782..d09dacc 100644 --- a/src/de/todesbaum/jsite/application/Project.java +++ b/src/de/todesbaum/jsite/application/Project.java @@ -1,6 +1,5 @@ /* - * jSite - a tool for uploading websites into Freenet Copyright (C) 2006 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 @@ -420,4 +419,20 @@ public class Project implements Comparable { 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); + } + } + }