Package org.json

Examples of org.json.JSONObject.optString()


        for (int i = 0; i < availableIDs.length; i++) {
            final String id = availableIDs[i];
            String option;

            if (id.equals(preference.optString(Preference.TIME_ZONE_ID))) {
                option = "<option value=\"" + id + "\" selected=\"true\">" + id + "</option>";
            } else {
                option = "<option value=\"" + id + "\">" + id + "</option>";
            }
View Full Code Here


        renderer.setTemplateName("article-pwd.ftl");

        final Map<String, Object> dataModel = renderer.getDataModel();

        dataModel.put("articleId", articleId);
        dataModel.put("articlePermalink", article.optString(Article.ARTICLE_PERMALINK));
        dataModel.put("articleTitle", article.optString(Article.ARTICLE_TITLE));
        dataModel.put("articleAbstract", article.optString(Article.ARTICLE_ABSTRACT));
        final String msg = request.getParameter(Keys.MSG);

        if (!Strings.isEmptyOrNull(msg)) {
View Full Code Here

        final Map<String, Object> dataModel = renderer.getDataModel();

        dataModel.put("articleId", articleId);
        dataModel.put("articlePermalink", article.optString(Article.ARTICLE_PERMALINK));
        dataModel.put("articleTitle", article.optString(Article.ARTICLE_TITLE));
        dataModel.put("articleAbstract", article.optString(Article.ARTICLE_ABSTRACT));
        final String msg = request.getParameter(Keys.MSG);

        if (!Strings.isEmptyOrNull(msg)) {
            dataModel.put(Keys.MSG, langPropsService.get("passwordNotMatchLabel"));
View Full Code Here

        final Map<String, Object> dataModel = renderer.getDataModel();

        dataModel.put("articleId", articleId);
        dataModel.put("articlePermalink", article.optString(Article.ARTICLE_PERMALINK));
        dataModel.put("articleTitle", article.optString(Article.ARTICLE_TITLE));
        dataModel.put("articleAbstract", article.optString(Article.ARTICLE_ABSTRACT));
        final String msg = request.getParameter(Keys.MSG);

        if (!Strings.isEmptyOrNull(msg)) {
            dataModel.put(Keys.MSG, langPropsService.get("passwordNotMatchLabel"));
        }
View Full Code Here

                response.sendRedirect(Latkes.getServePath() + article.getString(Article.ARTICLE_PERMALINK));

                return;
            }

            response.sendRedirect(Latkes.getServePath() + "/console/article-pwd?articleId=" + article.optString(Keys.OBJECT_ID) + "&msg=1");
        } catch (final Exception e) {
            LOGGER.log(Level.ERROR, "Processes article view password form submits failed", e);

            response.sendError(HttpServletResponse.SC_NOT_FOUND);
        }
View Full Code Here

        if (null == comment) {
            return false;
        }
       
        final String onId = comment.optString(Comment.COMMENT_ON_ID);
        final String onType = comment.optString(Comment.COMMENT_ON_TYPE);

        if (Page.PAGE.equals(onType)) {
            return false; // Only admin can access page comment
        }
View Full Code Here

        if (null == comment) {
            return false;
        }
       
        final String onId = comment.optString(Comment.COMMENT_ON_ID);
        final String onType = comment.optString(Comment.COMMENT_ON_TYPE);

        if (Page.PAGE.equals(onType)) {
            return false; // Only admin can access page comment
        }
       
View Full Code Here

            dataModel.put(Keys.Server.SERVER, Latkes.getServer());

            final JSONObject currentUser = userQueryService.getCurrentUser(request);

            if (null != currentUser) {
                final String email = currentUser.optString(User.USER_EMAIL);
                final String gravatar = Thumbnails.getGravatarURL(email, "60");

                dataModel.put(Common.GRAVATAR, gravatar);
            }
View Full Code Here

                return;
            }

            final JSONObject author = authorRet.getJSONObject(User.USER);
            final String authorEmail = author.optString(User.USER_EMAIL);

            final List<JSONObject> articles = articleQueryService.getArticlesByAuthorEmail(authorEmail, currentPageNum, pageSize);

            if (!articles.isEmpty()) {
                filler.setArticlesExProperties(articles, author, preference);
View Full Code Here

        if (null == article) {
            response.sendError(HttpServletResponse.SC_NOT_FOUND);
            return;
        }

        final String articleId = article.optString(Keys.OBJECT_ID);

        LOGGER.log(Level.DEBUG, "Article[id={0}]", articleId);
        final AbstractFreeMarkerRenderer renderer = new FreeMarkerRenderer();

        context.setRenderer(renderer);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.