jSite: First commit : verion 4.0 (written by Bombe)
[jSite.git] / src / de / todesbaum / jsite / application / EditionProject.java
1 /*
2  * jSite - a tool for uploading websites into Freenet
3  * Copyright (C) 2006 David Roden
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 package de.todesbaum.jsite.application;
21
22 /**
23  * Project extension for edition-based projects. In Freenet 0.7 this is
24  * currently the only project type.
25  * 
26  * @author David Roden <droden@gmail.com>
27  * @version $Id: EditionProject.java 417 2006-03-29 12:36:54Z bombe $
28  */
29 public class EditionProject extends Project {
30
31         /** The edition to insert to. */
32         private int edition;
33
34         /**
35          * Creates a new edition-based project.
36          */
37         public EditionProject() {
38         }
39
40         /**
41          * Clones the specified project as an edition-based project.
42          * 
43          * @param project
44          *            The project to clone
45          */
46         public EditionProject(Project project) {
47                 super(project);
48                 if (project instanceof EditionProject) {
49                         edition = ((EditionProject) project).edition;
50                 }
51         }
52
53         /**
54          * Returns the edition of the project.
55          * 
56          * @return The edition of the project
57          */
58         public int getEdition() {
59                 return edition;
60         }
61
62         /**
63          * Sets the edition of the project.
64          * 
65          * @param edition
66          *            The edition to set
67          */
68         public void setEdition(int edition) {
69                 this.edition = edition;
70         }
71
72         /**
73          * Constructs the final request URI including the edition number.
74          * 
75          * @return The final request URI
76          */
77         @Override
78         public String getFinalURI(int editionOffset) {
79                 return requestURI + path + "-" + (edition + editionOffset) + "/";
80         }
81
82 }