2 * jSite2 - Project.java -
3 * Copyright © 2008 David Roden
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.
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.
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.
20 package net.pterodactylus.jsite.project;
22 import java.beans.PropertyChangeListener;
24 import net.pterodactylus.util.beans.AbstractBean;
27 * Container for project information. A Project is capable of notifying
28 * {@link PropertyChangeListener}s if any of the contained properties change.
30 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
32 public class Project extends AbstractBean {
34 /** Name of the “name” property. */
35 public static final String PROPERTY_NAME = "name";
37 /** Name of the “description” property. */
38 public static final String PROPERTY_DESCRIPTION = "description";
40 /** Name of the “public key” property. */
41 public static final String PROPERTY_PUBLIC_KEY = "publicKey";
43 /** Name of the “private key” property. */
44 public static final String PROPERTY_PRIVATE_KEY = "privateKey";
46 /** Name of the “base path” property. */
47 public static final String PROPERTY_BASE_PATH = "basePath";
52 /** The name of the project. */
55 /** The description of the project. */
56 private String description;
58 /** The public key. */
59 private String publicKey;
61 /** The private key. */
62 private String privateKey;
64 /** The base path of the project. */
65 private String basePath;
68 * Creates a new project.
75 * Clones the given project.
79 Project(Project project) {
80 this.name = project.name;
81 this.description = project.description;
82 this.publicKey = project.publicKey;
83 this.privateKey = project.privateKey;
84 this.basePath = project.basePath;
88 * Returns the internal ID.
90 * @return The internal ID
97 * Sets the internal ID.
102 void setId(String id) {
107 * Returns the name of the project.
109 * @return The name of the project
111 public String getName() {
116 * Sets the name of the project.
119 * The name of the project
121 public void setName(String name) {
122 String oldName = this.name;
124 fireIfPropertyChanged(PROPERTY_NAME, oldName, name);
128 * Returns the description of the project.
130 * @return The description of the project
132 public String getDescription() {
137 * Sets the description of the project
140 * The description of the project
142 public void setDescription(String description) {
143 String oldDescription = this.description;
144 this.description = description;
145 fireIfPropertyChanged(PROPERTY_DESCRIPTION, oldDescription, description);
149 * Returns the public key of the project.
151 * @return The public key of the project
153 public String getPublicKey() {
158 * Sets the public key of the project.
161 * The public key of the project
163 void setPublicKey(String publicKey) {
164 String oldPublicKey = this.publicKey;
165 this.publicKey = publicKey;
166 fireIfPropertyChanged(PROPERTY_PUBLIC_KEY, oldPublicKey, publicKey);
170 * Returns the private key of the project.
172 * @return The private key of the project
174 public String getPrivateKey() {
179 * Sets the private key of the project.
182 * The private key of the project
184 void setPrivateKey(String privateKey) {
185 String oldPrivateKey = this.privateKey;
186 this.privateKey = privateKey;
187 fireIfPropertyChanged(PROPERTY_PRIVATE_KEY, oldPrivateKey, privateKey);
191 * Returns the base path of the project.
193 * @return The base path of the project
195 public String getBasePath() {
200 * Sets the base path of the project.
203 * The base path of the project
205 public void setBasePath(String basePath) {
206 String oldBasePath = this.basePath;
207 this.basePath = basePath;
208 fireIfPropertyChanged(PROPERTY_BASE_PATH, oldBasePath, basePath);