Package org.json

Examples of org.json.JSONObject.optInt()


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

        final Query query = new Query();
        query.addFilter(Link.LINK_ORDER, FilterOperator.GREATER_THAN, link.optInt(Link.LINK_ORDER)).
                addSort(Link.LINK_ORDER, SortDirection.ASCENDING);
        query.setCurrentPageNum(1);
        query.setPageSize(1);

        final JSONObject result = get(query);
View Full Code Here


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

        final Query query = new Query().setFilter(new PropertyFilter(Page.PAGE_ORDER, FilterOperator.LESS_THAN, page.optInt(Page.PAGE_ORDER))).addSort(Page.PAGE_ORDER, SortDirection.DESCENDING).setCurrentPageNum(1).setPageSize(1).setPageCount(
            1);

        final JSONObject result = get(query);
        final JSONArray array = result.optJSONArray(Keys.RESULTS);
View Full Code Here

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

        final Query query = new Query().setFilter(new PropertyFilter(Page.PAGE_ORDER, FilterOperator.GREATER_THAN, page.optInt(Page.PAGE_ORDER))).addSort(Page.PAGE_ORDER, SortDirection.ASCENDING).setCurrentPageNum(1).setPageSize(1).setPageCount(
            1);

        final JSONObject result = get(query);
        final JSONArray array = result.optJSONArray(Keys.RESULTS);
View Full Code Here

     */
    private void removeForUnpublishedArticles(final List<JSONObject> archiveDates) throws RepositoryException {
        final Iterator<JSONObject> iterator = archiveDates.iterator();
        while (iterator.hasNext()) {
            final JSONObject archiveDate = iterator.next();
            if (0 == archiveDate.optInt(ArchiveDate.ARCHIVE_DATE_PUBLISHED_ARTICLE_COUNT)) {
                iterator.remove();
            }
        }
    }

View Full Code Here

                if (!cachedPage.optString(AbstractCacheablePageAction.CACHED_TYPE).
                        equals(langs.get(PageTypes.ARTICLE))) { // Cached is not an article page
                    continue;
                }

                final int hitCount = cachedPage.optInt(PageCaches.CACHED_HIT_COUNT);
                if (2 > hitCount) {
                    // Skips for view count tiny-changes, reduces Datastore Write Quota for Solo GAE version
                    continue;
                }
View Full Code Here

                final JSONObject article = articleRepository.get(articleId);
                if (null == article) {
                    continue;
                }

                final int oldViewCount = article.optInt(Article.ARTICLE_VIEW_COUNT);
                final int viewCount = oldViewCount + hitCount;

                article.put(Article.ARTICLE_VIEW_COUNT, viewCount);

                articleRepository.update(articleId, article);
View Full Code Here

                return;
            }

            LOGGER.log(Level.TRACE, "Before inc blog view count[statistic={0}]", statistic);

            int blogViewCnt = statistic.optInt(Statistic.STATISTIC_BLOG_VIEW_COUNT);

            ++blogViewCnt;
            statistic.put(Statistic.STATISTIC_BLOG_VIEW_COUNT, blogViewCnt);

            statisticRepository.update(Statistic.STATISTIC, statistic);
View Full Code Here

        if (null == statistic) {
            throw new RepositoryException("Not found statistic");
        }

        statistic.put(Statistic.STATISTIC_BLOG_ARTICLE_COUNT, statistic.optInt(Statistic.STATISTIC_BLOG_ARTICLE_COUNT) + 1);
        statisticRepository.update(Statistic.STATISTIC, statistic);
    }

    /**
     * Blog statistic published article count +1.
View Full Code Here

        if (null == statistic) {
            throw new RepositoryException("Not found statistic");
        }

        statistic.put(Statistic.STATISTIC_PUBLISHED_ARTICLE_COUNT, statistic.optInt(Statistic.STATISTIC_PUBLISHED_ARTICLE_COUNT) + 1);
        statisticRepository.update(Statistic.STATISTIC, statistic);
    }

    /**
     * Blog statistic article count -1.
View Full Code Here

            {
                String methodName = (String) json_req.getString("method");
                JSONArray arguments = json_req.getJSONArray("params");
               
                // If this a CallableReference it will have a non-zero objectID
                int object_id = json_req.optInt("objectID");
                StringBuffer sb = new StringBuffer(".doprocessCall(): call ");
                if (object_id != 0)
                {
                    sb.append("objectID=").append(object_id).append(" ");
                }
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.