Set Sone in album builder, remote getOrCreate method from core.
[Sone.git] / src / main / java / net / pterodactylus / sone / core / ConfigurationSoneParser.java
index 3cb3b68..39dcd12 100644 (file)
@@ -1,6 +1,5 @@
 package net.pterodactylus.sone.core;
 
-import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -72,7 +71,7 @@ public class ConfigurationSoneParser {
                                .getValue(defaultValue);
        }
 
-       public Collection<Post> parsePosts(PostBuilderFactory postBuilderFactory)
+       public Set<Post> parsePosts(PostBuilderFactory postBuilderFactory)
        throws InvalidPostFound {
                Set<Post> posts = new HashSet<Post>();
                while (true) {
@@ -109,7 +108,7 @@ public class ConfigurationSoneParser {
                return (postRecipientId != null) && (postRecipientId.length() == 43);
        }
 
-       public Collection<PostReply> parsePostReplies(
+       public Set<PostReply> parsePostReplies(
                        PostReplyBuilderFactory postReplyBuilderFactory) {
                Set<PostReply> replies = new HashSet<PostReply>();
                while (true) {
@@ -150,6 +149,32 @@ public class ConfigurationSoneParser {
                return likedPostIds;
        }
 
+       public Set<String> parseLikedPostReplyIds() {
+               Set<String> likedPostReplyIds = new HashSet<String>();
+               while (true) {
+                       String likedReplyId = getString(
+                                       "/Likes/Reply/" + likedPostReplyIds.size() + "/ID", null);
+                       if (likedReplyId == null) {
+                               break;
+                       }
+                       likedPostReplyIds.add(likedReplyId);
+               }
+               return likedPostReplyIds;
+       }
+
+       public Set<String> parseFriends() {
+               Set<String> friends = new HashSet<String>();
+               while (true) {
+                       String friendId =
+                                       getString("/Friends/" + friends.size() + "/ID", null);
+                       if (friendId == null) {
+                               break;
+                       }
+                       friends.add(friendId);
+               }
+               return friends;
+       }
+
        public static class InvalidPostFound extends RuntimeException { }
 
        public static class InvalidPostReplyFound extends RuntimeException { }