+ public Set<PostReply> parsePostReplies(
+ PostReplyBuilderFactory postReplyBuilderFactory) {
+ Set<PostReply> replies = new HashSet<PostReply>();
+ while (true) {
+ String replyPrefix = "/Replies/" + replies.size();
+ String replyId = getString(replyPrefix + "/ID", null);
+ if (replyId == null) {
+ break;
+ }
+ String postId = getString(replyPrefix + "/Post/ID", null);
+ long replyTime = getLong(replyPrefix + "/Time", 0L);
+ String replyText = getString(replyPrefix + "/Text", null);
+ if ((postId == null) || (replyTime == 0) || (replyText == null)) {
+ throw new InvalidPostReplyFound();
+ }
+ PostReplyBuilder postReplyBuilder = postReplyBuilderFactory
+ .newPostReplyBuilder()
+ .withId(replyId)
+ .from(sone.getId())
+ .to(postId)
+ .withTime(replyTime)
+ .withText(replyText);
+ replies.add(postReplyBuilder.build());
+ }
+ return replies;
+ }
+
+ public Set<String> parseLikedPostIds() {
+ Set<String> likedPostIds = new HashSet<String>();
+ while (true) {
+ String likedPostId =
+ getString("/Likes/Post/" + likedPostIds.size() + "/ID",
+ null);
+ if (likedPostId == null) {
+ break;
+ }
+ likedPostIds.add(likedPostId);
+ }
+ return likedPostIds;
+ }
+