create new id if null id is set
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 14 Jun 2008 14:15:15 +0000 (16:15 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 14 Jun 2008 14:15:15 +0000 (16:15 +0200)
src/net/pterodactylus/jsite/core/Node.java
src/net/pterodactylus/jsite/core/Project.java

index b632eea..9a4d3be 100644 (file)
@@ -77,7 +77,11 @@ public class Node extends AbstractBean {
         *            The internal ID of the node
         */
        void setId(String id) {
-               this.id = id;
+               if (id == null) {
+                       this.id = Hex.toHex(IdGenerator.generateId());
+               } else {
+                       this.id = id;
+               }
        }
 
        /**
index 8bc45dd..9ddada5 100644 (file)
@@ -127,7 +127,11 @@ public class Project extends AbstractBean {
         *            The internal ID
         */
        void setId(String id) {
-               this.id = id;
+               if (id == null) {
+                       this.id = Hex.toHex(IdGenerator.generateId());
+               } else {
+                       this.id = id;
+               }
        }
 
        /**