From 62d8078eff84dd476c3cf7c6b95b47d1438a1360 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 14 Jun 2008 16:15:15 +0200 Subject: [PATCH] create new id if null id is set --- src/net/pterodactylus/jsite/core/Node.java | 6 +++++- src/net/pterodactylus/jsite/core/Project.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) 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; + } } /** -- 2.7.4