Package org.b3log.latke.repository

Examples of org.b3log.latke.repository.Query


    }

    @Override
    public List<JSONObject> getComments(final String onId, final int currentPageNum, final int pageSize)
            throws RepositoryException {
        final Query query = new Query().addSort(Keys.OBJECT_ID, SortDirection.DESCENDING).
                addFilter(Comment.COMMENT_ON_ID, FilterOperator.EQUAL, onId).
                setCurrentPageNum(currentPageNum).
                setPageSize(pageSize).
                setPageCount(1);
View Full Code Here


    }

    @Override
    public JSONObject getByArchiveDateId(final String archiveDateId, final int currentPageNum, final int pageSize)
        throws RepositoryException {
        final Query query = new Query().setFilter(new PropertyFilter(ArchiveDate.ARCHIVE_DATE + "_" + Keys.OBJECT_ID, FilterOperator.EQUAL, archiveDateId)).addSort(Article.ARTICLE + "_" + Keys.OBJECT_ID, SortDirection.DESCENDING).setCurrentPageNum(currentPageNum).setPageSize(pageSize).setPageCount(
            1);

        return get(query);
    }
View Full Code Here

        return get(query);
    }

    @Override
    public JSONObject getByArticleId(final String articleId) throws RepositoryException {
        final Query query = new Query();

        query.setFilter(new PropertyFilter(Article.ARTICLE + "_" + Keys.OBJECT_ID, FilterOperator.EQUAL, articleId));

        final JSONObject result = get(query);
        final JSONArray array = result.optJSONArray(Keys.RESULTS);

        if (0 == array.length()) {
View Full Code Here

            if (null != ret) {
                return (List<JSONObject>) ret;
            }
        }

        final Query query = new Query().addSort(Keys.OBJECT_ID, SortDirection.DESCENDING).
                setCurrentPageNum(1).
                setPageSize(num).setPageCount(1);

        List<JSONObject> ret;
        final JSONObject result = get(query);
View Full Code Here

            throw new RepositoryException("Can not parse archive date [" + archiveDate + "]");
        }

        LOGGER.log(Level.TRACE, "Archive date [{0}] parsed to time [{1}]", new Object[] {archiveDate, time});

        final Query query = new Query();

        query.setFilter(new PropertyFilter(ArchiveDate.ARCHIVE_TIME, FilterOperator.EQUAL, time)).setPageCount(1);

        final JSONObject result = get(query);
        final JSONArray array = result.optJSONArray(Keys.RESULTS);

        if (0 == array.length()) {
View Full Code Here

        return array.optJSONObject(0);
    }

    @Override
    public List<JSONObject> getArchiveDates() throws RepositoryException {
        final org.b3log.latke.repository.Query query = new Query().addSort(ArchiveDate.ARCHIVE_TIME, SortDirection.DESCENDING).setPageCount(
            1);
        final JSONObject result = get(query);

        final JSONArray archiveDates = result.optJSONArray(Keys.RESULTS);
        final List<JSONObject> ret = CollectionUtils.jsonArrayToList(archiveDates);
View Full Code Here

     */
    private static final LinkRepositoryImpl SINGLETON = new LinkRepositoryImpl(Link.LINK);

    @Override
    public JSONObject getByAddress(final String address) throws RepositoryException {
        final Query query = new Query().addFilter(Link.LINK_ADDRESS, FilterOperator.EQUAL, address).
                setPageCount(1);

        final JSONObject result = get(query);
        final JSONArray array = result.optJSONArray(Keys.RESULTS);

View Full Code Here

        return array.optJSONObject(0);
    }

    @Override
    public int getMaxOrder() throws RepositoryException {
        final Query query = new Query();
        query.addSort(Link.LINK_ORDER, SortDirection.DESCENDING);

        final JSONObject result = get(query);
        final JSONArray array = result.optJSONArray(Keys.RESULTS);

        if (0 == array.length()) {
View Full Code Here

        return array.optJSONObject(0).optInt(Link.LINK_ORDER);
    }

    @Override
    public JSONObject getByOrder(final int order) throws RepositoryException {
        final Query query = new Query();
        query.addFilter(Link.LINK_ORDER, FilterOperator.EQUAL, order);

        final JSONObject result = get(query);
        final JSONArray array = result.optJSONArray(Keys.RESULTS);

        if (0 == array.length()) {
View Full Code Here

        final JSONObject link = get(id);
        if (null == link) {
            return null;
        }

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

        final JSONObject result = get(query);
        final JSONArray array = result.optJSONArray(Keys.RESULTS);

        if (1 != array.length()) {
View Full Code Here

TOP

Related Classes of org.b3log.latke.repository.Query

Copyright © 2018 www.massapicom. 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.