# HG changeset patch # User ymh # Date 1365024965 -7200 # Node ID f3957d5942038cc016529a83e8b0fd25011adea1 # Parent f9716d0867444e779b09c162f94e06873b2468ab Replace UUID.RandomUUID by type 1 uuids diff -r f9716d086744 -r f3957d594203 .classpath --- a/.classpath Wed Apr 03 22:09:08 2013 +0200 +++ b/.classpath Wed Apr 03 23:36:05 2013 +0200 @@ -260,5 +260,6 @@ + diff -r f9716d086744 -r f3957d594203 server/src/main/java/org/iri_research/renkan/Constants.java --- a/server/src/main/java/org/iri_research/renkan/Constants.java Wed Apr 03 22:09:08 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/Constants.java Wed Apr 03 23:36:05 2013 +0200 @@ -4,12 +4,15 @@ import java.util.Collections; import java.util.List; +import com.fasterxml.uuid.EthernetAddress; +import com.fasterxml.uuid.Generators; +import com.fasterxml.uuid.NoArgGenerator; + public class Constants { - //private final static Properties properties; static { - //Resource res = new ServletContextResource(, path) + } public final static List VERSION = Collections.unmodifiableList(new ArrayList() { @@ -46,6 +49,9 @@ public final static int PAGINATION_SIZE = 10; public final static String PROPERTIES_SERVLET_CONTEXT_NAME = "renkan.properties"; public final static String PROPERTIES_CLASSPATH_NAME = "renkan_run.properties"; + + private final static EthernetAddress ETHERNET_ADRESS = EthernetAddress.fromInterface(); + public final static NoArgGenerator UUID_GENERATOR = Generators.timeBasedGenerator(ETHERNET_ADRESS); public enum EditMode { READ_ONLY(1), diff -r f9716d086744 -r f3957d594203 server/src/main/java/org/iri_research/renkan/forms/SpaceForm.java --- a/server/src/main/java/org/iri_research/renkan/forms/SpaceForm.java Wed Apr 03 22:09:08 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/forms/SpaceForm.java Wed Apr 03 23:36:05 2013 +0200 @@ -1,8 +1,8 @@ package org.iri_research.renkan.forms; import java.util.Date; -import java.util.UUID; +import org.iri_research.renkan.Constants; import org.iri_research.renkan.models.Space; import org.iri_research.renkan.repositories.IRenkanRepository; import org.iri_research.renkan.repositories.SpacesRepository; @@ -43,8 +43,8 @@ @Override protected void saveToModel() { - if(this.getId() == null || this.getId().length() == 0) { - this.model.setId(UUID.randomUUID().toString()); + if(this.getId() == null || this.getId().length() == 0) { + this.model.setId(Constants.UUID_GENERATOR.generate().toString()); this.model.setCreated(new Date()); } this.model.setBinConfig(binConfig); diff -r f9716d086744 -r f3957d594203 server/src/main/java/org/iri_research/renkan/models/Edge.java --- a/server/src/main/java/org/iri_research/renkan/models/Edge.java Wed Apr 03 22:09:08 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/models/Edge.java Wed Apr 03 23:36:05 2013 +0200 @@ -1,7 +1,6 @@ package org.iri_research.renkan.models; -import java.util.UUID; - +import org.iri_research.renkan.Constants; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.mongodb.core.mapping.DBRef; import org.springframework.data.mongodb.core.mapping.Document; @@ -33,7 +32,7 @@ } public Edge(Edge edge, Node from, Node to, String projectId) { - this(UUID.randomUUID().toString(), edge.title, edge.description, edge.uri, edge.color, from, to, edge.createdBy, projectId); + this(Constants.UUID_GENERATOR.generate().toString(), edge.title, edge.description, edge.uri, edge.color, from, to, edge.createdBy, projectId); } public Edge(Edge edge) { diff -r f9716d086744 -r f3957d594203 server/src/main/java/org/iri_research/renkan/models/Node.java --- a/server/src/main/java/org/iri_research/renkan/models/Node.java Wed Apr 03 22:09:08 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/models/Node.java Wed Apr 03 23:36:05 2013 +0200 @@ -1,7 +1,6 @@ package org.iri_research.renkan.models; -import java.util.UUID; - +import org.iri_research.renkan.Constants; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.mongodb.core.geo.Point; import org.springframework.data.mongodb.core.mapping.Document; @@ -13,7 +12,7 @@ public class Node extends AbstractRenkanModel { public Node(Node node, String projectId) { - this(UUID.randomUUID().toString(), node.title, node.description, node.uri, node.color, node.createdBy, node.position, node.image, node.size, projectId); + this(Constants.UUID_GENERATOR.generate().toString(), node.title, node.description, node.uri, node.color, node.createdBy, node.position, node.image, node.size, projectId); } public Node(Node node) { diff -r f9716d086744 -r f3957d594203 server/src/main/java/org/iri_research/renkan/models/Project.java --- a/server/src/main/java/org/iri_research/renkan/models/Project.java Wed Apr 03 22:09:08 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/models/Project.java Wed Apr 03 23:36:05 2013 +0200 @@ -8,7 +8,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; import javax.crypto.spec.SecretKeySpec; @@ -56,7 +55,7 @@ public Project(Project project) { - this(project.spaceId, UUID.randomUUID().toString(), project.title, project.description, project.uri, new Date()); + this(project.spaceId, Constants.UUID_GENERATOR.generate().toString(), project.title, project.description, project.uri, new Date()); Map nodeCloneMap = new HashMap(project.nodes.size()); for (Node node : project.nodes) { diff -r f9716d086744 -r f3957d594203 server/src/main/java/org/iri_research/renkan/rest/ProjectsResource.java --- a/server/src/main/java/org/iri_research/renkan/rest/ProjectsResource.java Wed Apr 03 22:09:08 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/rest/ProjectsResource.java Wed Apr 03 23:36:05 2013 +0200 @@ -3,10 +3,10 @@ import java.util.Arrays; import java.util.Date; import java.util.List; -import java.util.UUID; import javax.ws.rs.Path; +import org.iri_research.renkan.Constants; import org.iri_research.renkan.models.Project; import org.iri_research.renkan.repositories.IRenkanRepository; import org.iri_research.renkan.repositories.ProjectsRepository; @@ -36,7 +36,7 @@ @Override protected String getNewId() { - return UUID.randomUUID().toString(); + return Constants.UUID_GENERATOR.generate().toString(); } @Override diff -r f9716d086744 -r f3957d594203 server/src/main/java/org/iri_research/renkan/rest/SpacesResource.java --- a/server/src/main/java/org/iri_research/renkan/rest/SpacesResource.java Wed Apr 03 22:09:08 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/rest/SpacesResource.java Wed Apr 03 23:36:05 2013 +0200 @@ -5,10 +5,10 @@ import java.util.Arrays; import java.util.Date; import java.util.List; -import java.util.UUID; import javax.ws.rs.Path; +import org.iri_research.renkan.Constants; import org.iri_research.renkan.models.Space; import org.iri_research.renkan.repositories.IRenkanRepository; import org.iri_research.renkan.repositories.SpacesRepository; @@ -40,7 +40,7 @@ @Override protected String getNewId() { - return UUID.randomUUID().toString(); + return Constants.UUID_GENERATOR.generate().toString(); }