add method to get overrides from project
[jSite2.git] / src / net / pterodactylus / jsite / project / Project.java
index 4025b82..d6a319d 100644 (file)
 package net.pterodactylus.jsite.project;
 
 import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.List;
 
 import net.pterodactylus.util.beans.AbstractBean;
 
 /**
  * Container for project information. A Project is capable of notifying
  * {@link PropertyChangeListener}s if any of the contained properties change.
- * 
+ *
  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
- * @version $Id$
  */
 public class Project extends AbstractBean {
 
@@ -44,8 +45,11 @@ public class Project extends AbstractBean {
        /** Name of the “private key” property. */
        public static final String PROPERTY_PRIVATE_KEY = "privateKey";
 
-       /** Name of the “local path” property. */
-       public static final String PROPERTY_LOCAL_PATH = "localPath";
+       /** Name of the “base path” property. */
+       public static final String PROPERTY_BASE_PATH = "basePath";
+
+       /** Internal ID. */
+       private String id;
 
        /** The name of the project. */
        private String name;
@@ -62,13 +66,51 @@ public class Project extends AbstractBean {
        /** The base path of the project. */
        private String basePath;
 
-       //
-       // EVENT MANAGEMENT
-       //
+       /** The overrides. */
+       private final List<Override> overrides = new ArrayList<Override>();
+
+       /**
+        * Creates a new project.
+        */
+       public Project() {
+               /* do nothing. */
+       }
+
+       /**
+        * Clones the given project.
+        *
+        * @param project
+        */
+       Project(Project project) {
+               this.name = project.name;
+               this.description = project.description;
+               this.publicKey = project.publicKey;
+               this.privateKey = project.privateKey;
+               this.basePath = project.basePath;
+       }
+
+       /**
+        * Returns the internal ID.
+        *
+        * @return The internal ID
+        */
+       String getId() {
+               return id;
+       }
+
+       /**
+        * Sets the internal ID.
+        *
+        * @param id
+        *            The internal ID
+        */
+       void setId(String id) {
+               this.id = id;
+       }
 
        /**
         * Returns the name of the project.
-        * 
+        *
         * @return The name of the project
         */
        public String getName() {
@@ -77,7 +119,7 @@ public class Project extends AbstractBean {
 
        /**
         * Sets the name of the project.
-        * 
+        *
         * @param name
         *            The name of the project
         */
@@ -89,7 +131,7 @@ public class Project extends AbstractBean {
 
        /**
         * Returns the description of the project.
-        * 
+        *
         * @return The description of the project
         */
        public String getDescription() {
@@ -98,7 +140,7 @@ public class Project extends AbstractBean {
 
        /**
         * Sets the description of the project
-        * 
+        *
         * @param description
         *            The description of the project
         */
@@ -110,7 +152,7 @@ public class Project extends AbstractBean {
 
        /**
         * Returns the public key of the project.
-        * 
+        *
         * @return The public key of the project
         */
        public String getPublicKey() {
@@ -119,11 +161,11 @@ public class Project extends AbstractBean {
 
        /**
         * Sets the public key of the project.
-        * 
+        *
         * @param publicKey
         *            The public key of the project
         */
-       public void setPublicKey(String publicKey) {
+       void setPublicKey(String publicKey) {
                String oldPublicKey = this.publicKey;
                this.publicKey = publicKey;
                fireIfPropertyChanged(PROPERTY_PUBLIC_KEY, oldPublicKey, publicKey);
@@ -131,7 +173,7 @@ public class Project extends AbstractBean {
 
        /**
         * Returns the private key of the project.
-        * 
+        *
         * @return The private key of the project
         */
        public String getPrivateKey() {
@@ -140,11 +182,11 @@ public class Project extends AbstractBean {
 
        /**
         * Sets the private key of the project.
-        * 
+        *
         * @param privateKey
         *            The private key of the project
         */
-       public void setPrivateKey(String privateKey) {
+       void setPrivateKey(String privateKey) {
                String oldPrivateKey = this.privateKey;
                this.privateKey = privateKey;
                fireIfPropertyChanged(PROPERTY_PRIVATE_KEY, oldPrivateKey, privateKey);
@@ -152,7 +194,7 @@ public class Project extends AbstractBean {
 
        /**
         * Returns the base path of the project.
-        * 
+        *
         * @return The base path of the project
         */
        public String getBasePath() {
@@ -161,14 +203,23 @@ public class Project extends AbstractBean {
 
        /**
         * Sets the base path of the project.
-        * 
+        *
         * @param basePath
         *            The base path of the project
         */
        public void setBasePath(String basePath) {
                String oldBasePath = this.basePath;
                this.basePath = basePath;
-               fireIfPropertyChanged(PROPERTY_LOCAL_PATH, oldBasePath, basePath);
+               fireIfPropertyChanged(PROPERTY_BASE_PATH, oldBasePath, basePath);
+       }
+
+       /**
+        * Returns the list of {@link Override}s.
+        *
+        * @return All overrides
+        */
+       public List<Override> getOverrides() {
+               return overrides;
        }
 
 }