Store the Sone ID instead of the Sone itself in the session.
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Sone.java
index b969bd4..4a73470 100644 (file)
@@ -33,7 +33,10 @@ import freenet.keys.FreenetURI;
 public class Sone {
 
        /** A GUID for this Sone. */
-       private final UUID id = UUID.randomUUID();
+       private final UUID id;
+
+       /** The name of this Sone. */
+       private final String name;
 
        /** The URI under which the Sone is stored in Freenet. */
        private final FreenetURI requestUri;
@@ -48,22 +51,32 @@ public class Sone {
        /**
         * Creates a new Sone.
         *
+        * @param id
+        *            The ID of this Sone
+        * @param name
+        *            The name of the Sone
         * @param requestUri
         *            The request URI of the Sone
         */
-       public Sone(FreenetURI requestUri) {
-               this(requestUri, null);
+       public Sone(UUID id, String name, FreenetURI requestUri) {
+               this(id, name, requestUri, null);
        }
 
        /**
         * Creates a new Sone.
         *
+        * @param id
+        *            The ID of this Sone
+        * @param name
+        *            The name of the Sone
         * @param requestUri
         *            The request URI of the Sone
         * @param insertUri
         *            The insert URI of the Sone
         */
-       public Sone(FreenetURI requestUri, FreenetURI insertUri) {
+       public Sone(UUID id, String name, FreenetURI requestUri, FreenetURI insertUri) {
+               this.id = id;
+               this.name = name;
                this.requestUri = requestUri;
                this.insertUri = insertUri;
        }
@@ -82,6 +95,15 @@ public class Sone {
        }
 
        /**
+        * Returns the name of this Sone.
+        *
+        * @return The name of this Sone
+        */
+       public String getName() {
+               return name;
+       }
+
+       /**
         * Returns the request URI of this Sone.
         *
         * @return The request URI of this Sone