Return ID of the post from post reply.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 24 Jan 2013 06:42:08 +0000 (07:42 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 24 Jan 2013 06:42:08 +0000 (07:42 +0100)
src/main/java/net/pterodactylus/sone/core/Core.java
src/main/java/net/pterodactylus/sone/data/PostReply.java
src/main/java/net/pterodactylus/sone/data/impl/PostReplyImpl.java
src/main/java/net/pterodactylus/sone/web/SearchPage.java
src/main/java/net/pterodactylus/sone/web/ajax/GetReplyAjaxPage.java
src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java

index 9bc31bb..33e57c7 100644 (file)
@@ -2008,7 +2008,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
                        for (PostReply reply : sone.getReplies()) {
                                String replyPrefix = sonePrefix + "/Replies/" + replyCounter++;
                                configuration.getStringValue(replyPrefix + "/ID").setValue(reply.getId());
-                               configuration.getStringValue(replyPrefix + "/Post/ID").setValue(reply.getPost().getId());
+                               configuration.getStringValue(replyPrefix + "/Post/ID").setValue(reply.getPostId());
                                configuration.getLongValue(replyPrefix + "/Time").setValue(reply.getTime());
                                configuration.getStringValue(replyPrefix + "/Text").setValue(reply.getText());
                        }
index 4452e2e..8dc6f93 100644 (file)
@@ -26,6 +26,13 @@ package net.pterodactylus.sone.data;
 public interface PostReply extends Reply<PostReply> {
 
        /**
+        * Returns the ID of the post this reply refers to.
+        *
+        * @return The ID of the post this reply refers to
+        */
+       public String getPostId();
+
+       /**
         * Returns the post this reply refers to.
         *
         * @return The post this reply refers to
index 017f019..fa6629e 100644 (file)
@@ -53,6 +53,14 @@ public class PostReplyImpl extends ReplyImpl<PostReply> implements PostReply {
        //
 
        /**
+        * {@inheritDocs}
+        */
+       @Override
+       public String getPostId() {
+               return postId;
+       }
+
+       /**
         * {@inheritDoc}
         */
        @Override
index b937b2f..6cb2c0c 100644 (file)
@@ -341,7 +341,7 @@ public class SearchPage extends SoneTemplatePage {
                if (!postReply.isPresent()) {
                        return null;
                }
-               return postReply.get().getPost().getId();
+               return postReply.get().getPostId();
        }
 
        /**
index a2ee122..b617608 100644 (file)
@@ -97,7 +97,7 @@ public class GetReplyAjaxPage extends JsonPage {
        private JsonObject createJsonReply(FreenetRequest request, PostReply reply, Sone currentSone) {
                JsonObject jsonReply = new JsonObject();
                jsonReply.put("id", reply.getId());
-               jsonReply.put("postId", reply.getPost().getId());
+               jsonReply.put("postId", reply.getPostId());
                jsonReply.put("soneId", reply.getSone().getId());
                jsonReply.put("time", reply.getTime());
                StringWriter stringWriter = new StringWriter();
index 8657a6a..9c4c76f 100644 (file)
@@ -134,7 +134,7 @@ public class GetStatusAjaxPage extends JsonPage {
                        JsonObject jsonReply = new JsonObject();
                        jsonReply.put("id", reply.getId());
                        jsonReply.put("sone", reply.getSone().getId());
-                       jsonReply.put("post", reply.getPost().getId());
+                       jsonReply.put("post", reply.getPostId());
                        jsonReply.put("postSone", reply.getPost().getSone().getId());
                        jsonReplies.add(jsonReply);
                }