projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove createPost(*) methods from Core.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
fcp
/
CreatePostCommand.java
diff --git
a/src/main/java/net/pterodactylus/sone/fcp/CreatePostCommand.java
b/src/main/java/net/pterodactylus/sone/fcp/CreatePostCommand.java
index
a37dc46
..
ae45957
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/fcp/CreatePostCommand.java
+++ b/
src/main/java/net/pterodactylus/sone/fcp/CreatePostCommand.java
@@
-1,5
+1,5
@@
/*
/*
- * Sone - CreatePostCommand.java - Copyright © 2011–201
2
David Roden
+ * Sone - CreatePostCommand.java - Copyright © 2011–201
3
David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-17,7
+17,13
@@
package net.pterodactylus.sone.fcp;
package net.pterodactylus.sone.fcp;
+import static com.google.common.base.Optional.fromNullable;
+import static net.pterodactylus.sone.data.Identified.GET_ID;
+
+import com.google.common.base.Optional;
+
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.core.Core;
+import net.pterodactylus.sone.data.Identified;
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
@@
-28,7
+34,6
@@
import freenet.support.api.Bucket;
/**
* FCP command that creates a new {@link Post}.
*
/**
* FCP command that creates a new {@link Post}.
*
- * @see Core#createPost(Sone, Sone, String)
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
public class CreatePostCommand extends AbstractSoneCommand {
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
public class CreatePostCommand extends AbstractSoneCommand {
@@
-57,7
+62,7
@@
public class CreatePostCommand extends AbstractSoneCommand {
if (sone.equals(recipient)) {
return new ErrorResponse("Sone and Recipient must not be the same.");
}
if (sone.equals(recipient)) {
return new ErrorResponse("Sone and Recipient must not be the same.");
}
- Post post =
getCore().createPost(sone, recipient, text
);
+ Post post =
sone.newPostBuilder().randomId().currentTime().to(fromNullable(recipient).transform(GET_ID)).withText(text).build(
);
return new Response("PostCreated", new SimpleFieldSetBuilder().put("Post", post.getId()).get());
}
return new Response("PostCreated", new SimpleFieldSetBuilder().put("Post", post.getId()).get());
}