Package org.json

Examples of org.json.JSONObject.optString()


            }

            final String userNewEmail = requestJSONObject.optString(User.USER_EMAIL).toLowerCase().trim();
            // Check email is whether duplicated
            final JSONObject mayBeAnother = userRepository.getByEmail(userNewEmail);
            if (null != mayBeAnother && !mayBeAnother.optString(Keys.OBJECT_ID).equals(oldUserId)) {
                // Exists someone else has the save email as requested
                throw new ServiceException(langPropsService.get("duplicatedEmailLabel"));
            }

            // Update
View Full Code Here


            final JSONObject tag = result.getJSONObject(Tag.TAG);
            final String tagId = tag.getString(Keys.OBJECT_ID);

            final JSONObject preference = preferenceQueryService.getPreference();

            Skins.fillLangs(preference.optString(Preference.LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel);

            final int pageSize = preference.getInt(Preference.ARTICLE_LIST_DISPLAY_COUNT);
            final int windowSize = preference.getInt(Preference.ARTICLE_LIST_PAGINATION_WINDOW_SIZE);

            final List<JSONObject> articles = articleQueryService.getArticlesByTag(tagId, currentPageNum, pageSize);
View Full Code Here

        ret.put("data", data);

        for (int i = 0; i < articles.length(); i++) {
            final JSONObject article = articles.optJSONObject(i);
            final String tagString = article.optString(Article.ARTICLE_TAGS_REF);

            final JSONArray tagArray = new JSONArray();

            data.put(tagArray);
View Full Code Here

        final String requestURI = request.getRequestURI();
        final int num = Integer.valueOf(requestURI.substring((Latkes.getContextPath() + "/dev/articles/gen/").length()));

        try {
            final JSONObject admin = userQueryService.getAdmin();
            final String authorEmail = admin.optString(User.USER_EMAIL);

            for (int i = 0; i < num; i++) {
                final JSONObject article = new JSONObject();

                article.put(Article.ARTICLE_TITLE, "article title" + i);
View Full Code Here

            }

            // Editor type
            final JSONObject preference = preferenceQueryService.getPreference();

            newPage.put(Page.PAGE_EDITOR_TYPE, preference.optString(Preference.EDITOR_TYPE));

            pageRepository.update(pageId, newPage);

            transaction.commit();
View Full Code Here

            page.put(Page.PAGE_COMMENT_COUNT, 0);
            final int maxOrder = pageRepository.getMaxOrder();

            page.put(Page.PAGE_ORDER, maxOrder + 1);

            String permalink = page.optString(Page.PAGE_PERMALINK);

            if (Strings.isEmptyOrNull(permalink)) {
                permalink = "/pages/" + Ids.genTimeMillisId() + ".html";
            }
View Full Code Here

            page.put(Page.PAGE_PERMALINK, permalink.replaceAll(" ", "-"));
           
            // Editor type
            final JSONObject preference = preferenceQueryService.getPreference();

            page.put(Page.PAGE_EDITOR_TYPE, preference.optString(Preference.EDITOR_TYPE));

            final String ret = pageRepository.add(page);

            transaction.commit();
View Full Code Here

        if (ret == null) {
            LOGGER.log(Level.ERROR, "can not find plugin[" + pluginId + "]");
            throw new ServiceException("can not find plugin[" + pluginId + "]");
        }

        return ret.optString(Plugin.PLUGIN_SETTING);
    }

    /**
     * Sets the plugin repository with the specified plugin repository.
     *
 
View Full Code Here

            chain.doFilter(request, response);

            return;
        }

        final String cachedType = cachedPageContentObject.optString(AbstractCacheablePageAction.CACHED_TYPE);

        try {
            // If cached an article that has view password, dispatches the password form
            if (langPropsService.get(PageTypes.ARTICLE).equals(cachedType)
                && cachedPageContentObject.has(AbstractCacheablePageAction.CACHED_PWD)) {
View Full Code Here

            final JSONObject preference = preferenceQueryService.getPreference();

            filler.fillBlogHeader(request, response, dataModel, preference);
            filler.fillUserTemplate(request, template, dataModel, preference);
            filler.fillBlogFooter(request, dataModel, preference);
            Skins.fillLangs(preference.optString(Preference.LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel);

            statisticMgmtService.incBlogViewCount(request, response);
        } catch (final Exception e) {
            LOGGER.log(Level.ERROR, e.getMessage(), e);
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.