From: David ‘Bombe’ Roden Date: Fri, 5 Nov 2010 09:30:04 +0000 (+0100) Subject: Use traditional getter name. X-Git-Tag: 0.2-RC1~21 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=bd2cbb229f68fb2535cf6010befa9c4a276d2ee6;p=Sone.git Use traditional getter name. --- diff --git a/src/main/java/net/pterodactylus/sone/web/CreatePostPage.java b/src/main/java/net/pterodactylus/sone/web/CreatePostPage.java index 869acd8..1b7271b 100644 --- a/src/main/java/net/pterodactylus/sone/web/CreatePostPage.java +++ b/src/main/java/net/pterodactylus/sone/web/CreatePostPage.java @@ -56,7 +56,7 @@ public class CreatePostPage extends SoneTemplatePage { String text = request.getHttpRequest().getPartAsStringFailsafe("text", 65536).trim(); if (text.length() != 0) { Sone currentSone = getCurrentSone(request.getToadletContext()); - webInterface.core().createPost(currentSone, System.currentTimeMillis(), text); + webInterface.getCore().createPost(currentSone, System.currentTimeMillis(), text); throw new RedirectException(returnPage); } template.set("errorTextEmpty", true); diff --git a/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java b/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java index 231d372..65e8e57 100644 --- a/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java +++ b/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java @@ -55,10 +55,10 @@ public class CreateReplyPage extends SoneTemplatePage { String text = request.getHttpRequest().getPartAsStringFailsafe("text", 65536).trim(); String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 64); if (request.getMethod() == Method.POST) { - Post post = webInterface.core().getPost(postId); + Post post = webInterface.getCore().getPost(postId); if (text.length() > 0) { Sone currentSone = getCurrentSone(request.getToadletContext()); - webInterface.core().createReply(currentSone, post, text); + webInterface.getCore().createReply(currentSone, post, text); throw new RedirectException(returnPage); } template.set("errorTextEmpty", true); diff --git a/src/main/java/net/pterodactylus/sone/web/CreateSonePage.java b/src/main/java/net/pterodactylus/sone/web/CreateSonePage.java index d55624f..1c16d31 100644 --- a/src/main/java/net/pterodactylus/sone/web/CreateSonePage.java +++ b/src/main/java/net/pterodactylus/sone/web/CreateSonePage.java @@ -95,7 +95,7 @@ public class CreateSonePage extends SoneTemplatePage { @Override protected void processTemplate(Request request, Template template) throws RedirectException { super.processTemplate(request, template); - List ownIdentitiesWithoutSone = getOwnIdentitiesWithoutSone(webInterface.core()); + List ownIdentitiesWithoutSone = getOwnIdentitiesWithoutSone(webInterface.getCore()); template.set("identitiesWithoutSone", ownIdentitiesWithoutSone); if (request.getMethod() == Method.POST) { String id = request.getHttpRequest().getPartAsStringFailsafe("identity", 44); @@ -111,8 +111,8 @@ public class CreateSonePage extends SoneTemplatePage { return; } /* create Sone. */ - webInterface.core().getIdentityManager().addContext(selectedIdentity, "Sone"); - Sone sone = webInterface.core().createSone(selectedIdentity); + webInterface.getCore().getIdentityManager().addContext(selectedIdentity, "Sone"); + Sone sone = webInterface.getCore().createSone(selectedIdentity); if (sone == null) { logger.log(Level.SEVERE, "Could not create Sone for OwnIdentity: %s", selectedIdentity); /* TODO - go somewhere else */ diff --git a/src/main/java/net/pterodactylus/sone/web/DeletePostPage.java b/src/main/java/net/pterodactylus/sone/web/DeletePostPage.java index 2aaa6c9..761be50 100644 --- a/src/main/java/net/pterodactylus/sone/web/DeletePostPage.java +++ b/src/main/java/net/pterodactylus/sone/web/DeletePostPage.java @@ -54,14 +54,14 @@ public class DeletePostPage extends SoneTemplatePage { if (request.getMethod() == Method.GET) { String postId = request.getHttpRequest().getParam("post"); String returnPage = request.getHttpRequest().getParam("returnPage"); - Post post = webInterface.core().getPost(postId); + Post post = webInterface.getCore().getPost(postId); template.set("post", post); template.set("returnPage", returnPage); return; } else if (request.getMethod() == Method.POST) { String postId = request.getHttpRequest().getPartAsStringFailsafe("post", 36); String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 64); - Post post = webInterface.core().getPost(postId); + Post post = webInterface.getCore().getPost(postId); Sone currentSone = getCurrentSone(request.getToadletContext()); if (!post.getSone().equals(currentSone)) { throw new RedirectException("noPermission.html"); diff --git a/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java b/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java index f0ece19..c61dcf3 100644 --- a/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java +++ b/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java @@ -52,7 +52,7 @@ public class DeleteReplyPage extends SoneTemplatePage { protected void processTemplate(Request request, Template template) throws RedirectException { super.processTemplate(request, template); String replyId = request.getHttpRequest().getPartAsStringFailsafe("reply", 36); - Reply reply = webInterface.core().getReply(replyId); + Reply reply = webInterface.getCore().getReply(replyId); String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 64); if (request.getMethod() == Method.POST) { Sone currentSone = getCurrentSone(request.getToadletContext()); @@ -60,7 +60,7 @@ public class DeleteReplyPage extends SoneTemplatePage { throw new RedirectException("noPermission.html"); } if (request.getHttpRequest().isPartSet("confirmDelete")) { - webInterface.core().deleteReply(reply); + webInterface.getCore().deleteReply(reply); throw new RedirectException(returnPage); } else if (request.getHttpRequest().isPartSet("abortDelete")) { throw new RedirectException(returnPage); diff --git a/src/main/java/net/pterodactylus/sone/web/DeleteSonePage.java b/src/main/java/net/pterodactylus/sone/web/DeleteSonePage.java index 04aea3c..ae01573 100644 --- a/src/main/java/net/pterodactylus/sone/web/DeleteSonePage.java +++ b/src/main/java/net/pterodactylus/sone/web/DeleteSonePage.java @@ -55,7 +55,7 @@ public class DeleteSonePage extends SoneTemplatePage { if (request.getMethod() == Method.POST) { if (request.getHttpRequest().isPartSet("deleteSone")) { Sone currentSone = getCurrentSone(request.getToadletContext()); - webInterface.core().deleteSone(currentSone); + webInterface.getCore().deleteSone(currentSone); } throw new RedirectException("index.html"); } diff --git a/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java b/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java index 9fbca9a..bb90ce0 100644 --- a/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java +++ b/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java @@ -52,10 +52,10 @@ public class FollowSonePage extends SoneTemplatePage { String soneId = request.getHttpRequest().getPartAsStringFailsafe("sone", 44); String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 64); Sone currentSone = getCurrentSone(request.getToadletContext()); - Sone sone = webInterface.core().getSone(soneId); + Sone sone = webInterface.getCore().getSone(soneId); if (!sone.equals(currentSone)) { currentSone.addFriend(sone); - webInterface.core().saveSone(currentSone); + webInterface.getCore().saveSone(currentSone); } throw new RedirectException(returnPage); } diff --git a/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java b/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java index 52b7273..d413f61 100644 --- a/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java +++ b/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java @@ -53,7 +53,7 @@ public class KnownSonesPage extends SoneTemplatePage { @Override protected void processTemplate(Request request, Template template) throws RedirectException { super.processTemplate(request, template); - List knownSones = new ArrayList(webInterface.core().getSones()); + List knownSones = new ArrayList(webInterface.getCore().getSones()); Collections.sort(knownSones, Sone.NICE_NAME_COMPARATOR); template.set("knownSones", knownSones); } diff --git a/src/main/java/net/pterodactylus/sone/web/LoginPage.java b/src/main/java/net/pterodactylus/sone/web/LoginPage.java index 4a3e2b1..1e281b5 100644 --- a/src/main/java/net/pterodactylus/sone/web/LoginPage.java +++ b/src/main/java/net/pterodactylus/sone/web/LoginPage.java @@ -63,13 +63,13 @@ public class LoginPage extends SoneTemplatePage { protected void processTemplate(Request request, Template template) throws RedirectException { super.processTemplate(request, template); /* get all own identities. */ - List localSones = new ArrayList(webInterface.core().getLocalSones()); + List localSones = new ArrayList(webInterface.getCore().getLocalSones()); Collections.sort(localSones, Sone.NICE_NAME_COMPARATOR); template.set("sones", localSones); if (request.getMethod() == Method.POST) { String soneId = request.getHttpRequest().getPartAsStringFailsafe("sone-id", 100); Sone selectedSone = null; - for (Sone sone : webInterface.core().getSones()) { + for (Sone sone : webInterface.getCore().getSones()) { if (sone.getId().equals(soneId)) { selectedSone = sone; break; @@ -80,7 +80,7 @@ public class LoginPage extends SoneTemplatePage { throw new RedirectException("index.html"); } } - List ownIdentitiesWithoutSone = CreateSonePage.getOwnIdentitiesWithoutSone(webInterface.core()); + List ownIdentitiesWithoutSone = CreateSonePage.getOwnIdentitiesWithoutSone(webInterface.getCore()); template.set("identitiesWithoutSone", ownIdentitiesWithoutSone); } diff --git a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java index 3dc12c5..5127611 100644 --- a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java +++ b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java @@ -51,7 +51,7 @@ public class OptionsPage extends SoneTemplatePage { @Override protected void processTemplate(Request request, Template template) throws RedirectException { super.processTemplate(request, template); - Options options = webInterface.core().getOptions(); + Options options = webInterface.getCore().getOptions(); if (request.getMethod() == Method.POST) { Integer insertionDelay = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("insertion-delay", 16)); options.getIntegerOption("InsertionDelay").set(insertionDelay); diff --git a/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java b/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java index f38e845..065950e 100644 --- a/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java +++ b/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java @@ -137,7 +137,7 @@ public class SoneTemplatePage extends TemplatePage { if (soneId == null) { return null; } - for (Sone sone : webInterface.core().getSones()) { + for (Sone sone : webInterface.getCore().getSones()) { if (sone.getId().equals(soneId)) { return sone; } diff --git a/src/main/java/net/pterodactylus/sone/web/UnfollowSonePage.java b/src/main/java/net/pterodactylus/sone/web/UnfollowSonePage.java index d4fd688..7b7c7eb 100644 --- a/src/main/java/net/pterodactylus/sone/web/UnfollowSonePage.java +++ b/src/main/java/net/pterodactylus/sone/web/UnfollowSonePage.java @@ -52,10 +52,10 @@ public class UnfollowSonePage extends SoneTemplatePage { String soneId = request.getHttpRequest().getPartAsStringFailsafe("sone", 44); String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 64); Sone currentSone = getCurrentSone(request.getToadletContext()); - Sone sone = webInterface.core().getSone(soneId); + Sone sone = webInterface.getCore().getSone(soneId); if (!sone.equals(currentSone)) { currentSone.removeFriend(sone); - webInterface.core().saveSone(currentSone); + webInterface.getCore().saveSone(currentSone); } throw new RedirectException(returnPage); } diff --git a/src/main/java/net/pterodactylus/sone/web/ViewPostPage.java b/src/main/java/net/pterodactylus/sone/web/ViewPostPage.java index 3f3dadc..9bc28fa 100644 --- a/src/main/java/net/pterodactylus/sone/web/ViewPostPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ViewPostPage.java @@ -50,7 +50,7 @@ public class ViewPostPage extends SoneTemplatePage { protected void processTemplate(Request request, Template template) throws RedirectException { super.processTemplate(request, template); String postId = request.getHttpRequest().getParam("post"); - Post post = webInterface.core().getPost(postId); + Post post = webInterface.getCore().getPost(postId); template.set("post", post); } diff --git a/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java b/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java index 430aa8c..1ff248d 100644 --- a/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java +++ b/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java @@ -50,7 +50,7 @@ public class ViewSonePage extends SoneTemplatePage { protected void processTemplate(Request request, Template template) throws RedirectException { super.processTemplate(request, template); String soneId = request.getHttpRequest().getParam("sone"); - Sone sone = webInterface.core().getSone(soneId); + Sone sone = webInterface.getCore().getSone(soneId); template.set("sone", sone); } diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index c6dbca9..4d2eb68 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -111,7 +111,7 @@ public class WebInterface { * * @return The Sone core */ - public Core core() { + public Core getCore() { return sonePlugin.core(); } @@ -176,10 +176,10 @@ public class WebInterface { DefaultTemplateFactory templateFactory = new DefaultTemplateFactory(); templateFactory.addAccessor(Object.class, new ReflectionAccessor()); templateFactory.addAccessor(Collection.class, new CollectionAccessor()); - templateFactory.addAccessor(Sone.class, new SoneAccessor(core())); - templateFactory.addAccessor(Post.class, new PostAccessor(core())); - templateFactory.addAccessor(Reply.class, new ReplyAccessor(core())); - templateFactory.addAccessor(Identity.class, new IdentityAccessor(core())); + templateFactory.addAccessor(Sone.class, new SoneAccessor(getCore())); + templateFactory.addAccessor(Post.class, new PostAccessor(getCore())); + templateFactory.addAccessor(Reply.class, new ReplyAccessor(getCore())); + templateFactory.addAccessor(Identity.class, new IdentityAccessor(getCore())); templateFactory.addFilter("date", new DateFilter()); templateFactory.addFilter("l10n", new L10nFilter(getL10n())); templateFactory.addFilter("substring", new SubstringFilter()); 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 8cd4559..4389e57 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/DeletePostAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/DeletePostAjaxPage.java @@ -49,7 +49,7 @@ public class DeletePostAjaxPage extends JsonPage { @Override protected JsonObject createJsonObject(Request request) { String postId = request.getHttpRequest().getParam("post"); - Post post = webInterface.core().getPost(postId); + Post post = webInterface.getCore().getPost(postId); Sone currentSone = getCurrentSone(request.getToadletContext()); if (post == null) { return new JsonObject().put("success", false).put("error", "invalid-post-id"); 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 c996e52..fa9de9b 100644 --- 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(Request request) { String replyId = request.getHttpRequest().getParam("reply"); - Reply reply = webInterface.core().getReply(replyId); + Reply reply = webInterface.getCore().getReply(replyId); Sone currentSone = getCurrentSone(request.getToadletContext()); if (reply == null) { return new JsonObject().put("success", false).put("error", "invalid-reply-id"); @@ -60,7 +60,7 @@ public class DeleteReplyAjaxPage extends JsonPage { if (!reply.getSone().equals(currentSone)) { return new JsonObject().put("success", false).put("error", "not-authorized"); } - webInterface.core().deleteReply(reply); + webInterface.getCore().deleteReply(reply); return new JsonObject().put("success", true); } diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java index 7dc1b24..0c83553 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java @@ -44,7 +44,7 @@ public class FollowSoneAjaxPage extends JsonPage { @Override protected JsonObject createJsonObject(Request request) { String soneId = request.getHttpRequest().getParam("sone"); - Sone sone = webInterface.core().getSone(soneId); + Sone sone = webInterface.getCore().getSone(soneId); if (sone == null) { return new JsonObject().put("success", false).put("error", "invalid-sone-id"); } @@ -53,7 +53,7 @@ public class FollowSoneAjaxPage extends JsonPage { return new JsonObject().put("success", false).put("error", "auth-required"); } currentSone.addFriend(sone); - webInterface.core().saveSone(currentSone); + webInterface.getCore().saveSone(currentSone); return new JsonObject().put("success", true); } 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 529dd99..d27d82f 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java @@ -62,12 +62,12 @@ public class GetLikesAjaxPage extends JsonPage { return new JsonObject().put("success", false).put("error", "invalid-" + type + "-id"); } if ("post".equals(type)) { - Post post = webInterface.core().getPost(id); - Set sones = webInterface.core().getLikes(post); + Post post = webInterface.getCore().getPost(id); + Set sones = webInterface.getCore().getLikes(post); return new JsonObject().put("success", true).put("likes", sones.size()).put("sones", getSones(sones)); } else if ("reply".equals(type)) { - Reply reply = webInterface.core().getReply(id); - Set sones = webInterface.core().getLikes(reply); + Reply reply = webInterface.getCore().getReply(id); + Set sones = webInterface.getCore().getLikes(reply); return new JsonObject().put("success", true).put("likes", sones.size()).put("sones", getSones(sones)); } return new JsonObject().put("success", false).put("error", "invalid-type"); diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/GetSoneStatusPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/GetSoneStatusPage.java index 740d143..cac308e 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetSoneStatusPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetSoneStatusPage.java @@ -54,8 +54,8 @@ public class GetSoneStatusPage extends JsonPage { @Override protected JsonObject createJsonObject(Request request) { String soneId = request.getHttpRequest().getParam("sone"); - Sone sone = webInterface.core().getSone(soneId); - SoneStatus soneStatus = webInterface.core().getSoneStatus(sone); + Sone sone = webInterface.getCore().getSone(soneId); + SoneStatus soneStatus = webInterface.getCore().getSoneStatus(sone); return new JsonObject().put("status", soneStatus.name()).put("name", SoneAccessor.getNiceName(sone)).put("modified", sone.getModificationCounter() > 0).put("lastUpdated", new SimpleDateFormat("MMM d, yyyy, HH:mm:ss").format(new Date(sone.getTime()))).put("age", (System.currentTimeMillis() - sone.getTime()) / 1000); } diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/JsonPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/JsonPage.java index 94d1602..e8cd3d5 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/JsonPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/JsonPage.java @@ -112,7 +112,7 @@ public abstract class JsonPage implements Page { if (soneId == null) { return null; } - for (Sone sone : webInterface.core().getSones()) { + for (Sone sone : webInterface.getCore().getSones()) { if (sone.getId().equals(soneId)) { return sone; } diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java index e9650aa..509f629 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java @@ -44,7 +44,7 @@ public class UnfollowSoneAjaxPage extends JsonPage { @Override protected JsonObject createJsonObject(Request request) { String soneId = request.getHttpRequest().getParam("sone"); - Sone sone = webInterface.core().getSone(soneId); + Sone sone = webInterface.getCore().getSone(soneId); if (sone == null) { return new JsonObject().put("success", false).put("error", "invalid-sone-id"); } @@ -53,7 +53,7 @@ public class UnfollowSoneAjaxPage extends JsonPage { return new JsonObject().put("success", false).put("error", "auth-required"); } currentSone.removeFriend(sone); - webInterface.core().saveSone(currentSone); + webInterface.getCore().saveSone(currentSone); return new JsonObject().put("success", true); }