Use a unique ID for posts
[Sone.git] / src / main / java / net / pterodactylus / sone / data / impl / PostImpl.java
index 2d25715..4442b3b 100644 (file)
@@ -17,8 +17,7 @@
 
 package net.pterodactylus.sone.data.impl;
 
-import java.util.UUID;
-
+import net.pterodactylus.sone.data.IdBuilder;
 import net.pterodactylus.sone.data.Post;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.database.SoneProvider;
@@ -33,11 +32,13 @@ import com.google.common.base.Optional;
  */
 public class PostImpl implements Post {
 
+       private final IdBuilder idBuilder = new IdBuilder();
+
        /** The Sone provider. */
        private final SoneProvider soneProvider;
 
        /** The GUID of the post. */
-       private final UUID id;
+       private final String id;
 
        /** The ID of the owning Sone. */
        private final String soneId;
@@ -72,7 +73,7 @@ public class PostImpl implements Post {
         */
        public PostImpl(SoneProvider soneProvider, String id, String soneId, String recipientId, long time, String text) {
                this.soneProvider = soneProvider;
-               this.id = UUID.fromString(id);
+               this.id = id;
                this.soneId = soneId;
                this.recipientId = recipientId;
                this.time = time;
@@ -88,7 +89,17 @@ public class PostImpl implements Post {
         */
        @Override
        public String getId() {
-               return id.toString();
+               return idBuilder.buildId(soneId, id);
+       }
+
+       @Override
+       public String getInternalId() {
+               return id;
+       }
+
+       @Override
+       public boolean isLoaded() {
+               return true;
        }
 
        /**