Examples of opt()


Examples of org.json.JSONObject.opt()

    }

    @Override
    public JSONObject getNextArticle(final String articleId) throws RepositoryException {
        final JSONObject currentArticle = get(articleId);
        final Date currentArticleCreateDate = (Date) currentArticle.opt(Article.ARTICLE_CREATE_DATE);

        final Query query = new Query().setFilter(CompositeFilterOperator.and(new PropertyFilter(Article.ARTICLE_CREATE_DATE, FilterOperator.GREATER_THAN, currentArticleCreateDate), new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true))).addSort(Article.ARTICLE_CREATE_DATE, SortDirection.ASCENDING).setCurrentPageNum(1).setPageSize(1).setPageCount(1).addProjection(Article.ARTICLE_TITLE, String.class).addProjection(
            Article.ARTICLE_PERMALINK, String.class);

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

Examples of org.json.JSONObject.opt()

    }

    @Override
    public JSONObject getPreviousArticle(final String articleId) throws RepositoryException {
        final JSONObject currentArticle = get(articleId);
        final Date currentArticleCreateDate = (Date) currentArticle.opt(Article.ARTICLE_CREATE_DATE);

        final Query query = new Query().addFilter(Article.ARTICLE_CREATE_DATE, FilterOperator.LESS_THAN, currentArticleCreateDate).
                addFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true).
                addSort(Article.ARTICLE_CREATE_DATE, SortDirection.DESCENDING).setCurrentPageNum(1).
                setPageSize(1).setPageCount(1).
View Full Code Here

Examples of org.json.JSONObject.opt()

    }

    @Override
    public JSONObject getNextArticle(final String articleId) throws RepositoryException {
        final JSONObject currentArticle = get(articleId);
        final Date currentArticleCreateDate = (Date) currentArticle.opt(Article.ARTICLE_CREATE_DATE);

        final Query query = new Query().addFilter(Article.ARTICLE_CREATE_DATE, FilterOperator.GREATER_THAN, currentArticleCreateDate).
                addFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true).
                addSort(Article.ARTICLE_CREATE_DATE, SortDirection.ASCENDING).setCurrentPageNum(1).
                setPageSize(1).setPageCount(1).
View Full Code Here

Examples of org.json.JSONObject.opt()

    public static FunctionRequest decodeRequest(Reader r) throws IOException, JSONException {
        JSONTokener t = new JSONTokener(r);
        JSONObject jo = new JSONObject(t);
        String name = jo.getString("name");
        JSONArray args = jo.getJSONArray("args");
        String sheetName = (String) jo.opt("sheetName");
        JSONObject caller = (JSONObject) jo.opt("caller");
        XLSRef cref = null;
        if (caller != null) {
            cref = (XLSRef) decode(caller);
        }
View Full Code Here

Examples of org.json.JSONObject.opt()

            for( PropertyDescriptor persistentProperty : actualValueType.properties() )
            {
                Object valueJson = null;
                try
                {
                    valueJson = jsonObject.opt( persistentProperty.qualifiedName().name() );

                    Object value = null;
                    if( valueJson != null && !valueJson.equals( JSONObject.NULL ) )
                    {
                        value = deserialize( valueJson, persistentProperty.valueType() );
View Full Code Here

Examples of org.json.JSONObject.opt()

            if (binaryData == null) {
               return;
            }
            JSONObject payload = new JSONObject(binaryData.toString(CharsetUtil.UTF_8));
            String opCode = (String) payload.get(OpHandler.OP_CODE);
            String cacheName = (String) payload.opt(OpHandler.CACHE_NAME);
            Cache<Object, Object> cache = getCache(cacheName);
           
            OpHandler handler = operationHandlers.get(opCode);
            if (handler != null) {
               handler.handleOp(payload, cache, ctx);
View Full Code Here

Examples of org.json.JSONObject.opt()

        JSONObject previousArticle = articleRepository.getPreviousArticle(article.getString(Keys.OBJECT_ID));

        Assert.assertNotNull(previousArticle);
        Assert.assertEquals(previousArticle.getString(Article.ARTICLE_TITLE), "article title1");
        Assert.assertEquals(previousArticle.getString(Article.ARTICLE_PERMALINK), "article permalink1");
        Assert.assertNull(previousArticle.opt(Keys.OBJECT_ID));

        previousArticle = articleRepository.getByPermalink(previousArticle.getString(Article.ARTICLE_PERMALINK));

        final JSONObject nextArticle = articleRepository.getNextArticle(previousArticle.getString(Keys.OBJECT_ID));
        Assert.assertNotNull(previousArticle);
View Full Code Here

Examples of org.json.JSONObject.opt()

        JSONObject previousArticle = articleRepository.getPreviousArticle(article.getString(Keys.OBJECT_ID));

        Assert.assertNotNull(previousArticle);
        Assert.assertEquals(previousArticle.getString(Article.ARTICLE_TITLE), "article title1");
        Assert.assertEquals(previousArticle.getString(Article.ARTICLE_PERMALINK), "article permalink1");
        Assert.assertNull(previousArticle.opt(Keys.OBJECT_ID));

        previousArticle = articleRepository.getByPermalink(previousArticle.getString(Article.ARTICLE_PERMALINK));

        final JSONObject nextArticle = articleRepository.getNextArticle(previousArticle.getString(Keys.OBJECT_ID));
        Assert.assertNotNull(previousArticle);
View Full Code Here

Examples of org.json.JSONObject.opt()

        System.out.println("DBObject: " + bjson);

        assertNotNull(bjson);

        JSONObject jobj = (JSONObject) JsonSerializer.deserialize(bjson);
        Object obj = jobj.opt("object");
        System.out.println(obj);
        System.out.println(mock);
        assertTrue(obj.toString().replaceAll(" ", "").equalsIgnoreCase(mock.toString().replaceAll(" ", "")));

        Object lst = jobj.opt("list");
View Full Code Here

Examples of org.json.JSONObject.opt()

        Object obj = jobj.opt("object");
        System.out.println(obj);
        System.out.println(mock);
        assertTrue(obj.toString().replaceAll(" ", "").equalsIgnoreCase(mock.toString().replaceAll(" ", "")));

        Object lst = jobj.opt("list");
        System.out.println(lst);
        System.out.println(list);
    }
}
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.