From: David ‘Bombe’ Roden Date: Sat, 14 Jun 2008 14:15:15 +0000 (+0200) Subject: create new id if null id is set X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=62d8078eff84dd476c3cf7c6b95b47d1438a1360;p=jSite2.git create new id if null id is set --- diff --git a/src/net/pterodactylus/jsite/core/Node.java b/src/net/pterodactylus/jsite/core/Node.java index b632eea..9a4d3be 100644 --- a/src/net/pterodactylus/jsite/core/Node.java +++ b/src/net/pterodactylus/jsite/core/Node.java @@ -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; + } } /** diff --git a/src/net/pterodactylus/jsite/core/Project.java b/src/net/pterodactylus/jsite/core/Project.java index 8bc45dd..9ddada5 100644 --- a/src/net/pterodactylus/jsite/core/Project.java +++ b/src/net/pterodactylus/jsite/core/Project.java @@ -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; + } } /**