X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Fjsite%2Fapplication%2FProject.java;h=8e8d6d7191dbc7d7c3f79c049abca08c0c21ede0;hb=717369ceab558fc6668c2f327b1004f52ba8eaa7;hp=807385a8410333db121d98f8a869360fe35f2527;hpb=e4f461213da0e30faf9e9eb2e97626abff320618;p=jSite.git diff --git a/src/de/todesbaum/jsite/application/Project.java b/src/de/todesbaum/jsite/application/Project.java index 807385a..8e8d6d7 100644 --- a/src/de/todesbaum/jsite/application/Project.java +++ b/src/de/todesbaum/jsite/application/Project.java @@ -30,7 +30,7 @@ import de.todesbaum.util.mime.DefaultMIMETypes; * @author David Roden * @version $Id$ */ -public abstract class Project implements Comparable { +public class Project implements Comparable { protected String name; protected String description; @@ -42,6 +42,8 @@ public abstract class Project implements Comparable { protected String localPath; protected String path; protected long lastInsertionTime; + /** The edition to insert to. */ + protected int edition; protected Map fileOptions = new HashMap(); @@ -59,6 +61,7 @@ public abstract class Project implements Comparable { insertURI = project.insertURI; requestURI = project.requestURI; path = project.path; + edition = project.edition; localPath = project.localPath; indexFile = project.indexFile; lastInsertionTime = project.lastInsertionTime; @@ -189,7 +192,7 @@ public abstract class Project implements Comparable { public String toString() { return name; } - + private String shortenURI(String uri) { if (uri.startsWith("freenet:")) { uri = uri.substring("freenet:".length()); @@ -197,6 +200,9 @@ public abstract class Project implements Comparable { if (uri.startsWith("SSK@")) { uri = uri.substring("SSK@".length()); } + if (uri.startsWith("USK@")) { + uri = uri.substring("USK@".length()); + } if (uri.endsWith("/")) { uri = uri.substring(0, uri.length() - 1); } @@ -235,7 +241,7 @@ public abstract class Project implements Comparable { * @return Returns the fileOptions. */ public Map getFileOptions() { - return Collections.unmodifiableMap(new HashMap(fileOptions)); + return Collections.unmodifiableMap(fileOptions); } /** @@ -246,16 +252,40 @@ public abstract class Project implements Comparable { this.fileOptions.clear(); this.fileOptions.putAll(fileOptions); } - - public String getFinalRequestURI(int offset) { - return "freenet:USK@" + requestURI + "/" + path + "/"; - } /** * {@inheritDoc} */ - public int compareTo(Object o) { - return name.compareToIgnoreCase(((Project) o).name); + public int compareTo(Project project) { + return name.compareToIgnoreCase(project.name); + } + + /** + * Returns the edition of the project. + * + * @return The edition of the project + */ + public int getEdition() { + return edition; + } + + /** + * Sets the edition of the project. + * + * @param edition + * The edition to set + */ + public void setEdition(int edition) { + this.edition = edition; + } + + /** + * Constructs the final request URI including the edition number. + * + * @return The final request URI + */ + public String getFinalRequestURI(int offset) { + return "USK@" + requestURI + "/" + path + "/" + (edition + offset) + "/"; } }