projects
/
Sone.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
66b03d1
)
Rename getReply() to getPostReply(), remove convenience method.
author
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Tue, 15 Jan 2013 08:57:43 +0000
(09:57 +0100)
committer
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Wed, 16 Jan 2013 06:14:54 +0000
(07:14 +0100)
src/main/java/net/pterodactylus/sone/core/Core.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/core/SoneDownloader.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.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/ajax/DeleteReplyAjaxPage.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/GetReplyAjaxPage.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
5843b30
..
b25d8e3
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/core/Core.java
+++ b/
src/main/java/net/pterodactylus/sone/core/Core.java
@@
-609,18
+609,6
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
/**
* Returns the reply with the given ID. If there is no reply with the given
/**
* Returns the reply with the given ID. If there is no reply with the given
- * ID yet, a new one is created.
- *
- * @param replyId
- * The ID of the reply to get
- * @return The reply
- */
- public PostReply getReply(String replyId) {
- return getReply(replyId, true);
- }
-
- /**
- * Returns the reply with the given ID. If there is no reply with the given
* ID yet, a new one is created, unless {@code create} is false in which
* case {@code null} is returned.
*
* ID yet, a new one is created, unless {@code create} is false in which
* case {@code null} is returned.
*
@@
-631,7
+619,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
* to return {@code null} if no reply can be found
* @return The reply, or {@code null} if there is no such reply
*/
* to return {@code null} if no reply can be found
* @return The reply, or {@code null} if there is no such reply
*/
- public PostReply getReply(String replyId, boolean create) {
+ public PostReply get
Post
Reply(String replyId, boolean create) {
synchronized (replies) {
PostReply reply = replies.get(replyId);
if (create && (reply == null)) {
synchronized (replies) {
PostReply reply = replies.get(replyId);
if (create && (reply == null)) {
@@
-1382,7
+1370,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
logger.log(Level.WARNING, "Invalid reply found, aborting load!");
return;
}
logger.log(Level.WARNING, "Invalid reply found, aborting load!");
return;
}
- replies.add(get
Reply(replyId
).setSone(sone).setPost(getPost(postId)).setTime(replyTime).setText(replyText));
+ replies.add(get
PostReply(replyId, true
).setSone(sone).setPost(getPost(postId)).setTime(replyTime).setText(replyText));
}
/* load post likes. */
}
/* load post likes. */
diff --git
a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java
b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java
index
72ff008
..
39dbcd5
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/core/SoneDownloader.java
+++ b/
src/main/java/net/pterodactylus/sone/core/SoneDownloader.java
@@
-403,7
+403,7
@@
public class SoneDownloader extends AbstractService {
return null;
}
try {
return null;
}
try {
- replies.add(core.get
Reply(replyId
).setSone(sone).setPost(core.getPost(replyPostId)).setTime(Long.parseLong(replyTime)).setText(replyText));
+ replies.add(core.get
PostReply(replyId, true
).setSone(sone).setPost(core.getPost(replyPostId)).setTime(Long.parseLong(replyTime)).setText(replyText));
} catch (NumberFormatException nfe1) {
/* TODO - mark Sone as bad. */
logger.log(Level.WARNING, String.format("Downloaded reply for Sone %s with invalid time: %s", sone, replyTime));
} catch (NumberFormatException nfe1) {
/* TODO - mark Sone as bad. */
logger.log(Level.WARNING, String.format("Downloaded reply for Sone %s with invalid time: %s", sone, replyTime));
diff --git
a/src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
b/src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
index
1944570
..
1eb488e
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
+++ b/
src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
@@
-209,7
+209,7
@@
public abstract class AbstractSoneCommand extends AbstractCommand {
protected PostReply getReply(SimpleFieldSet simpleFieldSet, String parameterName) throws FcpException {
try {
String replyId = simpleFieldSet.getString(parameterName);
protected PostReply getReply(SimpleFieldSet simpleFieldSet, String parameterName) throws FcpException {
try {
String replyId = simpleFieldSet.getString(parameterName);
- PostReply reply = core.getReply(replyId, false);
+ PostReply reply = core.get
Post
Reply(replyId, false);
if (reply == null) {
throw new FcpException("Could not load reply from “" + replyId + "”.");
}
if (reply == null) {
throw new FcpException("Could not load reply from “" + replyId + "”.");
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java
b/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java
index
900acd9
..
0f010b7
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java
@@
-53,7
+53,7
@@
public class DeleteReplyPage extends SoneTemplatePage {
protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
super.processTemplate(request, templateContext);
String replyId = request.getHttpRequest().getPartAsStringFailsafe("reply", 36);
protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
super.processTemplate(request, templateContext);
String replyId = request.getHttpRequest().getPartAsStringFailsafe("reply", 36);
- PostReply reply = webInterface.getCore().get
Reply(replyId
);
+ PostReply reply = webInterface.getCore().get
PostReply(replyId, false
);
String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
if (request.getMethod() == Method.POST) {
if (!webInterface.getCore().isLocalSone(reply.getSone())) {
String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
if (request.getMethod() == Method.POST) {
if (!webInterface.getCore().isLocalSone(reply.getSone())) {
diff --git
a/src/main/java/net/pterodactylus/sone/web/MarkAsKnownPage.java
b/src/main/java/net/pterodactylus/sone/web/MarkAsKnownPage.java
index
4f8e071
..
409c748
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/MarkAsKnownPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/MarkAsKnownPage.java
@@
-71,7
+71,7
@@
public class MarkAsKnownPage extends SoneTemplatePage {
}
webInterface.getCore().markPostKnown(post);
} else if (type.equals("reply")) {
}
webInterface.getCore().markPostKnown(post);
} else if (type.equals("reply")) {
- PostReply reply = webInterface.getCore().getReply(id, false);
+ PostReply reply = webInterface.getCore().get
Post
Reply(id, false);
if (reply == null) {
continue;
}
if (reply == null) {
continue;
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/SearchPage.java
b/src/main/java/net/pterodactylus/sone/web/SearchPage.java
index
0f12abf
..
6d300ed
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/SearchPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/SearchPage.java
@@
-346,7
+346,7
@@
public class SearchPage extends SoneTemplatePage {
*/
private String getReplyPostId(String phrase) {
String replyId = phrase.startsWith("reply://") ? phrase.substring(8) : phrase;
*/
private String getReplyPostId(String phrase) {
String replyId = phrase.startsWith("reply://") ? phrase.substring(8) : phrase;
- return (webInterface.getCore().get
Reply(replyId, false) != null) ? webInterface.getCore().ge
tReply(replyId, false).getPost().getId() : null;
+ return (webInterface.getCore().get
PostReply(replyId, false) != null) ? webInterface.getCore().getPos
tReply(replyId, false).getPost().getId() : null;
}
/**
}
/**
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/DeleteReplyAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/DeleteReplyAjaxPage.java
index
0442117
..
857c777
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/DeleteReplyAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/DeleteReplyAjaxPage.java
@@
-49,7
+49,7
@@
public class DeleteReplyAjaxPage extends JsonPage {
@Override
protected JsonObject createJsonObject(FreenetRequest request) {
String replyId = request.getHttpRequest().getParam("reply");
@Override
protected JsonObject createJsonObject(FreenetRequest request) {
String replyId = request.getHttpRequest().getParam("reply");
- PostReply reply = webInterface.getCore().get
Reply(replyId
);
+ PostReply reply = webInterface.getCore().get
PostReply(replyId, false
);
if (reply == null) {
return createErrorJsonObject("invalid-reply-id");
}
if (reply == null) {
return createErrorJsonObject("invalid-reply-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
293b4b0
..
d4251f1
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java
@@
-67,7
+67,7
@@
public class GetLikesAjaxPage extends JsonPage {
Set<Sone> sones = webInterface.getCore().getLikes(post);
return createSuccessJsonObject().put("likes", sones.size()).put("sones", getSones(sones));
} else if ("reply".equals(type)) {
Set<Sone> sones = webInterface.getCore().getLikes(post);
return createSuccessJsonObject().put("likes", sones.size()).put("sones", getSones(sones));
} else if ("reply".equals(type)) {
- PostReply reply = webInterface.getCore().get
Reply(id
);
+ PostReply reply = webInterface.getCore().get
PostReply(id, false
);
Set<Sone> sones = webInterface.getCore().getLikes(reply);
return createSuccessJsonObject().put("likes", sones.size()).put("sones", getSones(sones));
}
Set<Sone> sones = webInterface.getCore().getLikes(reply);
return createSuccessJsonObject().put("likes", sones.size()).put("sones", getSones(sones));
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/GetReplyAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/GetReplyAjaxPage.java
index
38bf090
..
ca2996f
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/GetReplyAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/GetReplyAjaxPage.java
@@
-62,7
+62,7
@@
public class GetReplyAjaxPage extends JsonPage {
@Override
protected JsonObject createJsonObject(FreenetRequest request) {
String replyId = request.getHttpRequest().getParam("reply");
@Override
protected JsonObject createJsonObject(FreenetRequest request) {
String replyId = request.getHttpRequest().getParam("reply");
- PostReply reply = webInterface.getCore().get
Reply(replyId
);
+ PostReply reply = webInterface.getCore().get
PostReply(replyId, false
);
if ((reply == null) || (reply.getSone() == null)) {
return createErrorJsonObject("invalid-reply-id");
}
if ((reply == null) || (reply.getSone() == null)) {
return createErrorJsonObject("invalid-reply-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
f6bc05d
..
4d67c3c
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/GetTimesAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/GetTimesAjaxPage.java
@@
-77,7
+77,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) {
- PostReply reply = webInterface.getCore().getReply(id, false);
+ PostReply reply = webInterface.getCore().get
Post
Reply(id, false);
if (reply == null) {
continue;
}
if (reply == null) {
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
370bacd
..
7944e11
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java
@@
-63,7
+63,7
@@
public class MarkAsKnownAjaxPage extends JsonPage {
}
core.markPostKnown(post);
} else if (type.equals("reply")) {
}
core.markPostKnown(post);
} else if (type.equals("reply")) {
- PostReply reply = core.getReply(id, false);
+ PostReply reply = core.get
Post
Reply(id, false);
if (reply == null) {
continue;
}
if (reply == null) {
continue;
}