* @return The created post
*/
public Post createPost(Sone sone, long time, String text) {
- return getPost(UUID.randomUUID().toString()).setSone(sone).setTime(time).setText(text);
+ Post post = getPost(UUID.randomUUID().toString()).setSone(sone).setTime(time).setText(text);
+ sone.addPost(post);
+ return post;
+ }
+
+ /**
+ * Creates a reply.
+ *
+ * @param sone
+ * The Sone that posts the reply
+ * @param post
+ * The post the reply refers to
+ * @param text
+ * The text of the reply
+ * @return The created reply
+ */
+ public Reply createReply(Sone sone, Post post, String text) {
+ return createReply(sone, post, System.currentTimeMillis(), text);
+ }
+
+ /**
+ * Creates a reply.
+ *
+ * @param sone
+ * The Sone that posts the reply
+ * @param post
+ * The post the reply refers to
+ * @param time
+ * The time of the post
+ * @param text
+ * The text of the reply
+ * @return The created reply
+ */
+ public Reply createReply(Sone sone, Post post, long time, String text) {
+ Reply reply = getReply(UUID.randomUUID().toString()).setSone(sone).setPost(post).setTime(time).setText(text);
+ sone.addReply(reply);
+ return reply;
}
//
String friendName = configuration.getStringValue(friendPrefix + "/Name").getValue(null);
friendSone.setRequestUri(new FreenetURI(friendKey)).setName(friendName);
soneDownloader.addSone(friendSone);
- sone.addFriend(sone);
+ sone.addFriend(friendSone);
}
sone.setModificationCounter(modificationCounter);