projects
/
Sone.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
80064be
)
Remove PostProvider methods from Core.
author
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Wed, 16 Oct 2013 18:27:08 +0000
(20:27 +0200)
committer
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Fri, 28 Feb 2014 21:25:28 +0000
(22:25 +0100)
15 files changed:
src/main/java/net/pterodactylus/sone/core/Core.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/DeletePostPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/MarkAsKnownPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/SearchPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ViewPostPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ViewSonePage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ajax/DeletePostAjaxPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ajax/GetTimesAjaxPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java
patch
|
blob
|
history
diff --git
a/src/main/java/net/pterodactylus/sone/core/Core.java
b/src/main/java/net/pterodactylus/sone/core/Core.java
index
21448b6
..
3e4bf1d
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/core/Core.java
+++ b/
src/main/java/net/pterodactylus/sone/core/Core.java
@@
-436,19
+436,6
@@
public class Core extends AbstractService implements SoneProvider, PostReplyProv
return trustedIdentities.containsEntry(origin.getIdentity(), target.getIdentity());
}
return trustedIdentities.containsEntry(origin.getIdentity(), target.getIdentity());
}
- public Optional<Post> getPost(String postId) {
- return database.getPost(postId);
- }
-
- public Collection<Post> getPosts(String soneId) {
- return database.getPosts(soneId);
- }
-
- public Collection<Post> getDirectedPosts(final String recipientId) {
- checkNotNull(recipientId, "recipient must not be null");
- return database.getDirectedPosts(recipientId);
- }
-
@Override
public Optional<PostReply> getPostReply(String replyId) {
return database.getPostReply(replyId);
@Override
public Optional<PostReply> getPostReply(String replyId) {
return database.getPostReply(replyId);
@@
-528,7
+515,7
@@
public class Core extends AbstractService implements SoneProvider, PostReplyProv
Set<Post> posts = new HashSet<Post>();
synchronized (bookmarkedPosts) {
for (String bookmarkedPostId : bookmarkedPosts) {
Set<Post> posts = new HashSet<Post>();
synchronized (bookmarkedPosts) {
for (String bookmarkedPostId : bookmarkedPosts) {
- Optional<Post> post = getPost(bookmarkedPostId);
+ Optional<Post> post =
database.
getPost(bookmarkedPostId);
if (post.isPresent()) {
posts.add(post.get());
}
if (post.isPresent()) {
posts.add(post.get());
}
diff --git
a/src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
b/src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
index
9be30fc
..
19c1979
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
+++ b/
src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
@@
-186,7
+186,7
@@
public abstract class AbstractSoneCommand extends AbstractCommand {
protected Post getPost(SimpleFieldSet simpleFieldSet, String parameterName) throws FcpException {
try {
String postId = simpleFieldSet.getString(parameterName);
protected Post getPost(SimpleFieldSet simpleFieldSet, String parameterName) throws FcpException {
try {
String postId = simpleFieldSet.getString(parameterName);
- Optional<Post> post = core.getPost(postId);
+ Optional<Post> post = core.get
Database().get
Post(postId);
if (!post.isPresent()) {
throw new FcpException("Could not load post from “" + postId + "”.");
}
if (!post.isPresent()) {
throw new FcpException("Could not load post from “" + postId + "”.");
}
diff --git
a/src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java
b/src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java
index
a99c031
..
fb44e3a
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java
+++ b/
src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java
@@
-67,7
+67,7
@@
public class GetPostFeedCommand extends AbstractSoneCommand {
}
allPosts.addAll(friendSone.get().getPosts());
}
}
allPosts.addAll(friendSone.get().getPosts());
}
- allPosts.addAll(getCore().getDirectedPosts(sone.getId()));
+ allPosts.addAll(getCore().getD
atabase().getD
irectedPosts(sone.getId()));
allPosts = Collections2.filter(allPosts, Post.FUTURE_POSTS_FILTER);
List<Post> sortedPosts = new ArrayList<Post>(allPosts);
allPosts = Collections2.filter(allPosts, Post.FUTURE_POSTS_FILTER);
List<Post> sortedPosts = new ArrayList<Post>(allPosts);
diff --git
a/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java
b/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java
index
1303508
..
4811997
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java
@@
-59,7
+59,7
@@
public class CreateReplyPage extends SoneTemplatePage {
String text = request.getHttpRequest().getPartAsStringFailsafe("text", 65536).trim();
String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
if (request.getMethod() == Method.POST) {
String text = request.getHttpRequest().getPartAsStringFailsafe("text", 65536).trim();
String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
if (request.getMethod() == Method.POST) {
- Optional<Post> post = webInterface.getCore().getPost(postId);
+ Optional<Post> post = webInterface.getCore().get
Database().get
Post(postId);
if (!post.isPresent()) {
throw new RedirectException("noPermission.html");
}
if (!post.isPresent()) {
throw new RedirectException("noPermission.html");
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/DeletePostPage.java
b/src/main/java/net/pterodactylus/sone/web/DeletePostPage.java
index
23c2cc1
..
5cb4b44
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/DeletePostPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/DeletePostPage.java
@@
-54,7
+54,7
@@
public class DeletePostPage extends SoneTemplatePage {
if (request.getMethod() == Method.GET) {
String postId = request.getHttpRequest().getParam("post");
String returnPage = request.getHttpRequest().getParam("returnPage");
if (request.getMethod() == Method.GET) {
String postId = request.getHttpRequest().getParam("post");
String returnPage = request.getHttpRequest().getParam("returnPage");
- Optional<Post> post = webInterface.getCore().getPost(postId);
+ Optional<Post> post = webInterface.getCore().get
Database().get
Post(postId);
if (!post.isPresent()) {
throw new RedirectException("noPermission.html");
}
if (!post.isPresent()) {
throw new RedirectException("noPermission.html");
}
@@
-64,7
+64,7
@@
public class DeletePostPage extends SoneTemplatePage {
} else if (request.getMethod() == Method.POST) {
String postId = request.getHttpRequest().getPartAsStringFailsafe("post", 36);
String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
} else if (request.getMethod() == Method.POST) {
String postId = request.getHttpRequest().getPartAsStringFailsafe("post", 36);
String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
- Optional<Post> post = webInterface.getCore().getPost(postId);
+ Optional<Post> post = webInterface.getCore().get
Database().get
Post(postId);
if (!post.isPresent() || !post.get().getSone().isLocal()) {
throw new RedirectException("noPermission.html");
}
if (!post.isPresent() || !post.get().getSone().isLocal()) {
throw new RedirectException("noPermission.html");
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/MarkAsKnownPage.java
b/src/main/java/net/pterodactylus/sone/web/MarkAsKnownPage.java
index
0b3d4b3
..
e89b6dc
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/MarkAsKnownPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/MarkAsKnownPage.java
@@
-64,7
+64,7
@@
public class MarkAsKnownPage extends SoneTemplatePage {
for (StringTokenizer idTokenizer = new StringTokenizer(ids); idTokenizer.hasMoreTokens();) {
String id = idTokenizer.nextToken();
if (type.equals("post")) {
for (StringTokenizer idTokenizer = new StringTokenizer(ids); idTokenizer.hasMoreTokens();) {
String id = idTokenizer.nextToken();
if (type.equals("post")) {
- Optional<Post> post = webInterface.getCore().getPost(id);
+ Optional<Post> post = webInterface.getCore().get
Database().get
Post(id);
if (!post.isPresent()) {
continue;
}
if (!post.isPresent()) {
continue;
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/SearchPage.java
b/src/main/java/net/pterodactylus/sone/web/SearchPage.java
index
d83b822
..
f809579
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/SearchPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/SearchPage.java
@@
-320,7
+320,7
@@
public class SearchPage extends SoneTemplatePage {
*/
private String getPostId(String phrase) {
String postId = phrase.startsWith("post://") ? phrase.substring(7) : phrase;
*/
private String getPostId(String phrase) {
String postId = phrase.startsWith("post://") ? phrase.substring(7) : phrase;
- return (webInterface.getCore().getPost(postId).isPresent()) ? postId : null;
+ return (webInterface.getCore().get
Database().get
Post(postId).isPresent()) ? postId : null;
}
/**
}
/**
diff --git
a/src/main/java/net/pterodactylus/sone/web/ViewPostPage.java
b/src/main/java/net/pterodactylus/sone/web/ViewPostPage.java
index
3f44419
..
409c63a
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ViewPostPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ViewPostPage.java
@@
-53,7
+53,7
@@
public class ViewPostPage extends SoneTemplatePage {
@Override
protected String getPageTitle(FreenetRequest request) {
String postId = request.getHttpRequest().getParam("post");
@Override
protected String getPageTitle(FreenetRequest request) {
String postId = request.getHttpRequest().getParam("post");
- Optional<Post> post = webInterface.getCore().getPost(postId);
+ Optional<Post> post = webInterface.getCore().get
Database().get
Post(postId);
String title = "";
if (post.isPresent()) {
title = post.get().getText().substring(0, Math.min(20, post.get().getText().length())) + "…";
String title = "";
if (post.isPresent()) {
title = post.get().getText().substring(0, Math.min(20, post.get().getText().length())) + "…";
@@
-68,7
+68,7
@@
public class ViewPostPage extends SoneTemplatePage {
super.processTemplate(request, templateContext);
String postId = request.getHttpRequest().getParam("post");
boolean raw = request.getHttpRequest().getParam("raw").equals("true");
super.processTemplate(request, templateContext);
String postId = request.getHttpRequest().getParam("post");
boolean raw = request.getHttpRequest().getParam("raw").equals("true");
- Optional<Post> post = webInterface.getCore().getPost(postId);
+ Optional<Post> post = webInterface.getCore().get
Database().get
Post(postId);
templateContext.set("post", post.orNull());
templateContext.set("raw", raw);
}
templateContext.set("post", post.orNull());
templateContext.set("raw", raw);
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java
b/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java
index
3c0ba8f
..
4874ade
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ViewSonePage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ViewSonePage.java
@@
-83,7
+83,7
@@
public class ViewSonePage extends SoneTemplatePage {
return;
}
List<Post> sonePosts = sone.get().getPosts();
return;
}
List<Post> sonePosts = sone.get().getPosts();
- sonePosts.addAll(webInterface.getCore().getDirectedPosts(sone.get().getId()));
+ sonePosts.addAll(webInterface.getCore().getD
atabase().getD
irectedPosts(sone.get().getId()));
Collections.sort(sonePosts, Post.TIME_COMPARATOR);
Pagination<Post> postPagination = new Pagination<Post>(sonePosts, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("postPage"), 0));
templateContext.set("postPagination", postPagination);
Collections.sort(sonePosts, Post.TIME_COMPARATOR);
Pagination<Post> postPagination = new Pagination<Post>(sonePosts, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("postPage"), 0));
templateContext.set("postPagination", postPagination);
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPage.java
index
dc95166
..
313d271
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPage.java
@@
-58,7
+58,7
@@
public class CreateReplyAjaxPage extends JsonPage {
if (!sender.isPresent()) {
sender = of(getCurrentSone(request.getToadletContext()));
}
if (!sender.isPresent()) {
sender = of(getCurrentSone(request.getToadletContext()));
}
- Optional<Post> post = webInterface.getCore().getPost(postId);
+ Optional<Post> post = webInterface.getCore().get
Database().get
Post(postId);
if (!post.isPresent()) {
return createErrorJsonObject("invalid-post-id");
}
if (!post.isPresent()) {
return createErrorJsonObject("invalid-post-id");
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/DeletePostAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/DeletePostAjaxPage.java
index
66a67eb
..
943d6a8
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/DeletePostAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/DeletePostAjaxPage.java
@@
-47,7
+47,7
@@
public class DeletePostAjaxPage extends JsonPage {
@Override
protected JsonReturnObject createJsonObject(FreenetRequest request) {
String postId = request.getHttpRequest().getParam("post");
@Override
protected JsonReturnObject createJsonObject(FreenetRequest request) {
String postId = request.getHttpRequest().getParam("post");
- Optional<Post> post = webInterface.getCore().getPost(postId);
+ Optional<Post> post = webInterface.getCore().get
Database().get
Post(postId);
if (!post.isPresent()) {
return createErrorJsonObject("invalid-post-id");
}
if (!post.isPresent()) {
return createErrorJsonObject("invalid-post-id");
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java
index
dea635c
..
3bb40c9
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java
@@
-64,7
+64,7
@@
public class GetLikesAjaxPage extends JsonPage {
return createErrorJsonObject("invalid-" + type + "-id");
}
if ("post".equals(type)) {
return createErrorJsonObject("invalid-" + type + "-id");
}
if ("post".equals(type)) {
- Optional<Post> post = webInterface.getCore().getPost(id);
+ Optional<Post> post = webInterface.getCore().get
Database().get
Post(id);
if (!post.isPresent()) {
return createErrorJsonObject("invalid-post-id");
}
if (!post.isPresent()) {
return createErrorJsonObject("invalid-post-id");
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.java
index
8587d12
..
1221f1a
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.java
@@
-61,7
+61,7
@@
public class GetPostAjaxPage extends JsonPage {
@Override
protected JsonReturnObject createJsonObject(FreenetRequest request) {
String postId = request.getHttpRequest().getParam("post");
@Override
protected JsonReturnObject createJsonObject(FreenetRequest request) {
String postId = request.getHttpRequest().getParam("post");
- Optional<Post> post = webInterface.getCore().getPost(postId);
+ Optional<Post> post = webInterface.getCore().get
Database().get
Post(postId);
if (!post.isPresent()) {
return createErrorJsonObject("invalid-post-id");
}
if (!post.isPresent()) {
return createErrorJsonObject("invalid-post-id");
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/GetTimesAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/GetTimesAjaxPage.java
index
c15abcc
..
b8fc52e
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/GetTimesAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/GetTimesAjaxPage.java
@@
-59,7
+59,7
@@
public class GetTimesAjaxPage extends JsonPage {
if (allIds.length() > 0) {
String[] ids = allIds.split(",");
for (String id : ids) {
if (allIds.length() > 0) {
String[] ids = allIds.split(",");
for (String id : ids) {
- Optional<Post> post = webInterface.getCore().getPost(id);
+ Optional<Post> post = webInterface.getCore().get
Database().get
Post(id);
if (!post.isPresent()) {
continue;
}
if (!post.isPresent()) {
continue;
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java
index
602f253
..
cb5940c
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java
@@
-55,7
+55,7
@@
public class MarkAsKnownAjaxPage extends JsonPage {
Core core = webInterface.getCore();
for (String id : ids) {
if (type.equals("post")) {
Core core = webInterface.getCore();
for (String id : ids) {
if (type.equals("post")) {
- Optional<Post> post = core.getPost(id);
+ Optional<Post> post = core.get
Database().get
Post(id);
if (!post.isPresent()) {
continue;
}
if (!post.isPresent()) {
continue;
}