X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Ftodesbaum%2Fjsite%2Fapplication%2FProject.java;h=d9146a1b06c1defdff3ef515d99bd4de601e4760;hb=f4bf696b92e9c50e52a6f536d45c65da82844d67;hp=36fff55037ed857a3b211f200e7a2b35b31cb8bc;hpb=9e6e70c28963fde2a6c8b120974f8a70d4da25bc;p=jSite.git diff --git a/src/main/java/de/todesbaum/jsite/application/Project.java b/src/main/java/de/todesbaum/jsite/application/Project.java index 36fff55..d9146a1 100644 --- a/src/main/java/de/todesbaum/jsite/application/Project.java +++ b/src/main/java/de/todesbaum/jsite/application/Project.java @@ -1,5 +1,5 @@ /* - * jSite - Project.java - Copyright © 2006–2012 David Roden + * jSite - Project.java - Copyright © 2006–2014 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 @@ -60,6 +60,9 @@ public class Project implements Comparable { /** The edition to insert to. */ protected int edition; + /** Whether to always force inserts. */ + private boolean alwaysForceInserts; + /** Whether to ignore hidden directory. */ private boolean ignoreHiddenFiles; @@ -89,8 +92,11 @@ public class Project implements Comparable { localPath = project.localPath; indexFile = project.indexFile; lastInsertionTime = project.lastInsertionTime; + alwaysForceInserts = project.alwaysForceInserts; ignoreHiddenFiles = project.ignoreHiddenFiles; - fileOptions = new HashMap(project.fileOptions); + for (Entry fileOption : fileOptions.entrySet()) { + fileOptions.put(fileOption.getKey(), new FileOption(fileOption.getValue())); + } } /** @@ -252,6 +258,29 @@ public class Project implements Comparable { } /** + * Returns whether files for this project should always be inserted, even + * when unchanged. + * + * @return {@code true} to always force inserts on this project, + * {@code false} otherwise + */ + public boolean isAlwaysForceInsert() { + return alwaysForceInserts; + } + + /** + * Sets whether files for this project should always be inserted, even when + * unchanged. + * + * @param alwaysForceInsert + * {@code true} to always force inserts on this project, + * {@code false} otherwise + */ + public void setAlwaysForceInsert(boolean alwaysForceInsert) { + this.alwaysForceInserts = alwaysForceInsert; + } + + /** * Returns whether hidden files are ignored, i.e. not inserted. * * @return {@code true} if hidden files are not inserted, {@code false} @@ -433,7 +462,7 @@ public class Project implements Comparable { if ((fileOption.getCurrentHash() != null) && (fileOption.getCurrentHash().length() > 0) && (!fileOption.getCurrentHash().equals(fileOption.getLastInsertHash()) || fileOption.isForceInsert())) { fileOption.setLastInsertEdition(edition); fileOption.setLastInsertHash(fileOption.getCurrentHash()); - fileOption.setLastInsertFilename(fileOption.hasChangedName() ? fileOption.getChangedName() : fileOptionEntry.getKey()); + fileOption.setLastInsertFilename(fileOption.getChangedName().or(fileOptionEntry.getKey())); } fileOption.setForceInsert(false); }