Package org.json

Examples of org.json.JSONObject.optString()


            if (null == article) {
                return null;
            }

            // Markdown to HTML for content and abstract
            if ("CodeMirror-Markdown".equals(article.optString(ARTICLE_EDITOR_TYPE))) {
                Stopwatchs.start("Get Article Content [Markdown]");
                final String content = article.optString(ARTICLE_CONTENT);
                article.put(ARTICLE_CONTENT, Markdowns.toHTML(content));
                Stopwatchs.end();
            }
View Full Code Here


            }
        }

        final JSONObject currentUser = userQueryService.getCurrentUser(request);

        if (null != currentUser && !Role.VISITOR_ROLE.equals(currentUser.optString(User.USER_ROLE))) {
            return false;
        }

        return true; // Visitor or NOT logged in
    }
View Full Code Here

            }

            // Markdown to HTML for content and abstract
            if ("CodeMirror-Markdown".equals(article.optString(ARTICLE_EDITOR_TYPE))) {
                Stopwatchs.start("Get Article Content [Markdown]");
                final String content = article.optString(ARTICLE_CONTENT);
                article.put(ARTICLE_CONTENT, Markdowns.toHTML(content));
                Stopwatchs.end();
            }

            return article.getString(Article.ARTICLE_CONTENT);
View Full Code Here

        JSONObject defaultSign = null;

        for (int i = 0; i < signs.length(); i++) {
            final JSONObject ret = signs.getJSONObject(i);

            if (signId.equals(ret.optString(Keys.OBJECT_ID))) {
                return ret;
            }

            if ("1".equals(ret.optString(Keys.OBJECT_ID))) {
                defaultSign = ret;
View Full Code Here

            if (signId.equals(ret.optString(Keys.OBJECT_ID))) {
                return ret;
            }

            if ("1".equals(ret.optString(Keys.OBJECT_ID))) {
                defaultSign = ret;
            }
        }

        LOGGER.log(Level.WARN, "Can not find the sign[id={0}], returns a default sign[id=1]", signId);
View Full Code Here

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

        dataModel.putAll(langs);

        final JSONObject currentUser = userQueryService.getCurrentUser(request);
        final String userName = currentUser.optString(User.USER_NAME);

        dataModel.put(User.USER_NAME, userName);

        final String roleName = currentUser.optString(User.USER_ROLE);
View Full Code Here

        final JSONObject currentUser = userQueryService.getCurrentUser(request);
        final String userName = currentUser.optString(User.USER_NAME);

        dataModel.put(User.USER_NAME, userName);

        final String roleName = currentUser.optString(User.USER_ROLE);

        dataModel.put(User.USER_ROLE, roleName);

        final String email = currentUser.optString(User.USER_EMAIL);
        final String gravatar = Thumbnails.getGravatarURL(email, "60");
View Full Code Here

        final String roleName = currentUser.optString(User.USER_ROLE);

        dataModel.put(User.USER_ROLE, roleName);

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

        dataModel.put(Common.GRAVATAR, gravatar);

        try {
View Full Code Here

            if (needViewPwd(request, article)) {
                final String content = langPropsService.get("articleContentPwd");

                article.put(ARTICLE_CONTENT, content);
            } else if ("CodeMirror-Markdown".equals(article.optString(ARTICLE_EDITOR_TYPE))) {
                // Markdown to HTML for content and abstract
                Stopwatchs.start("Get Article Content [Markdown]");
                final String content = article.optString(ARTICLE_CONTENT);

                article.put(ARTICLE_CONTENT, Markdowns.toHTML(content));
View Full Code Here

                article.put(ARTICLE_CONTENT, content);
            } else if ("CodeMirror-Markdown".equals(article.optString(ARTICLE_EDITOR_TYPE))) {
                // Markdown to HTML for content and abstract
                Stopwatchs.start("Get Article Content [Markdown]");
                final String content = article.optString(ARTICLE_CONTENT);

                article.put(ARTICLE_CONTENT, Markdowns.toHTML(content));
                Stopwatchs.end();
            }
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.