Use traditional getter name.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 5 Nov 2010 09:30:04 +0000 (10:30 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 5 Nov 2010 09:30:04 +0000 (10:30 +0100)
22 files changed:
src/main/java/net/pterodactylus/sone/web/CreatePostPage.java
src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java
src/main/java/net/pterodactylus/sone/web/CreateSonePage.java
src/main/java/net/pterodactylus/sone/web/DeletePostPage.java
src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java
src/main/java/net/pterodactylus/sone/web/DeleteSonePage.java
src/main/java/net/pterodactylus/sone/web/FollowSonePage.java
src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java
src/main/java/net/pterodactylus/sone/web/LoginPage.java
src/main/java/net/pterodactylus/sone/web/OptionsPage.java
src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java
src/main/java/net/pterodactylus/sone/web/UnfollowSonePage.java
src/main/java/net/pterodactylus/sone/web/ViewPostPage.java
src/main/java/net/pterodactylus/sone/web/ViewSonePage.java
src/main/java/net/pterodactylus/sone/web/WebInterface.java
src/main/java/net/pterodactylus/sone/web/ajax/DeletePostAjaxPage.java
src/main/java/net/pterodactylus/sone/web/ajax/DeleteReplyAjaxPage.java
src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java
src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java
src/main/java/net/pterodactylus/sone/web/ajax/GetSoneStatusPage.java
src/main/java/net/pterodactylus/sone/web/ajax/JsonPage.java
src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java

index 869acd8..1b7271b 100644 (file)
@@ -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);
index 231d372..65e8e57 100644 (file)
@@ -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);
index d55624f..1c16d31 100644 (file)
@@ -95,7 +95,7 @@ public class CreateSonePage extends SoneTemplatePage {
        @Override
        protected void processTemplate(Request request, Template template) throws RedirectException {
                super.processTemplate(request, template);
-               List<OwnIdentity> ownIdentitiesWithoutSone = getOwnIdentitiesWithoutSone(webInterface.core());
+               List<OwnIdentity> 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 */
index 2aaa6c9..761be50 100644 (file)
@@ -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");
index f0ece19..c61dcf3 100644 (file)
@@ -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);
index 04aea3c..ae01573 100644 (file)
@@ -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");
                }
index 9fbca9a..bb90ce0 100644 (file)
@@ -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);
                }
index 52b7273..d413f61 100644 (file)
@@ -53,7 +53,7 @@ public class KnownSonesPage extends SoneTemplatePage {
        @Override
        protected void processTemplate(Request request, Template template) throws RedirectException {
                super.processTemplate(request, template);
-               List<Sone> knownSones = new ArrayList<Sone>(webInterface.core().getSones());
+               List<Sone> knownSones = new ArrayList<Sone>(webInterface.getCore().getSones());
                Collections.sort(knownSones, Sone.NICE_NAME_COMPARATOR);
                template.set("knownSones", knownSones);
        }
index 4a3e2b1..1e281b5 100644 (file)
@@ -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<Sone> localSones = new ArrayList<Sone>(webInterface.core().getLocalSones());
+               List<Sone> localSones = new ArrayList<Sone>(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<OwnIdentity> ownIdentitiesWithoutSone = CreateSonePage.getOwnIdentitiesWithoutSone(webInterface.core());
+               List<OwnIdentity> ownIdentitiesWithoutSone = CreateSonePage.getOwnIdentitiesWithoutSone(webInterface.getCore());
                template.set("identitiesWithoutSone", ownIdentitiesWithoutSone);
        }
 
index 3dc12c5..5127611 100644 (file)
@@ -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);
index f38e845..065950e 100644 (file)
@@ -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;
                        }
index d4fd688..7b7c7eb 100644 (file)
@@ -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);
                }
index 3f3dadc..9bc28fa 100644 (file)
@@ -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);
        }
 
index 430aa8c..1ff248d 100644 (file)
@@ -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);
        }
 
index c6dbca9..4d2eb68 100644 (file)
@@ -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());
index 8cd4559..4389e57 100644 (file)
@@ -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");
index c996e52..fa9de9b 100644 (file)
@@ -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);
        }
 
index 7dc1b24..0c83553 100644 (file)
@@ -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);
        }
 
index 529dd99..d27d82f 100644 (file)
@@ -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<Sone> sones = webInterface.core().getLikes(post);
+                       Post post = webInterface.getCore().getPost(id);
+                       Set<Sone> 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<Sone> sones = webInterface.core().getLikes(reply);
+                       Reply reply = webInterface.getCore().getReply(id);
+                       Set<Sone> 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");
index 740d143..cac308e 100644 (file)
@@ -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);
        }
 
index 94d1602..e8cd3d5 100644 (file)
@@ -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;
                        }
index e9650aa..509f629 100644 (file)
@@ -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);
        }