add default node
[jSite2.git] / src / net / pterodactylus / jsite / core / Project.java
index 1edb933..1301236 100644 (file)
@@ -27,7 +27,10 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import net.pterodactylus.jsite.core.Node;
+import net.pterodactylus.jsite.util.IdGenerator;
 import net.pterodactylus.util.beans.AbstractBean;
+import net.pterodactylus.util.number.Hex;
 
 /**
  * Container for project information. A Project is capable of notifying
@@ -79,6 +82,9 @@ public class Project extends AbstractBean {
        /** The overrides. */
        private final Map<String, FileOverride> fileOverrides = new HashMap<String, FileOverride>();
 
+       /** The default node to insert to. */
+       private Node node;
+
        /** The current root project file. */
        private ProjectFileImpl rootProjectFile;
 
@@ -86,7 +92,7 @@ public class Project extends AbstractBean {
         * Creates a new project.
         */
        public Project() {
-               /* do nothing. */
+               id = Hex.toHex(IdGenerator.generateId());
        }
 
        /**
@@ -95,6 +101,7 @@ public class Project extends AbstractBean {
         * @param project
         */
        Project(Project project) {
+               this();
                this.name = project.name;
                this.description = project.description;
                this.publicKey = project.publicKey;
@@ -369,6 +376,25 @@ public class Project extends AbstractBean {
                return currentProjectFile;
        }
 
+       /**
+        * Returns the default node to insert this project to.
+        * 
+        * @return The node to insert this project to
+        */
+       public Node getNode() {
+               return node;
+       }
+
+       /**
+        * Sets the default node to insert this project to.
+        * 
+        * @param node
+        *            The node to insert this project to
+        */
+       void setNode(Node node) {
+               this.node = node;
+       }
+
        //
        // PRIVATE METHODS
        //