Examples of optLong()


Examples of org.codehaus.jettison.json.JSONObject.optLong()

        } else {
            directionReturnToken = RexsterTokens.SLASH_BOTHCOUNT;
        }

        final JSONObject jsonObject = RestHelper.get(buildUri(directionReturnToken));
        return jsonObject.optLong(RexsterTokens.TOTAL_SIZE);
    }

    public Object vertexIds() {
        final String directionReturnToken;
        if (this.direction == Direction.IN) {
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optLong()

        return StringFactory.indexString(this);
    }

    public long count(final String key, final Object value) {
        final JSONObject countJson = RestHelper.get(this.graph.getGraphURI() + RexsterTokens.SLASH_INDICES_SLASH + RestHelper.encode(this.indexName) + RexsterTokens.SLASH_COUNT + RexsterTokens.QUESTION + RexsterTokens.KEY_EQUALS + key + RexsterTokens.AND + RexsterTokens.VALUE_EQUALS + RestHelper.uriCast(value));
        return countJson.optLong("totalSize");
    }
}
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optLong()

        valueAsJson = json.optJSONObject("keyLong");
        Assert.assertNotNull(valueAsJson);
        Assert.assertTrue(valueAsJson.has(GraphSONTokens.TYPE));
        Assert.assertEquals(GraphSONTokens.TYPE_LONG, valueAsJson.optString(GraphSONTokens.TYPE));
        Assert.assertTrue(valueAsJson.has(GraphSONTokens.VALUE));
        Assert.assertEquals(1L, valueAsJson.optLong(GraphSONTokens.VALUE));

        valueAsJson = json.optJSONObject("keyInt");
        Assert.assertNotNull(valueAsJson);
        Assert.assertTrue(valueAsJson.has(GraphSONTokens.TYPE));
        Assert.assertEquals(GraphSONTokens.TYPE_INTEGER, valueAsJson.optString(GraphSONTokens.TYPE));
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optLong()

        Assert.assertTrue(json.has(GraphSONTokens._ID));
        Assert.assertEquals(1, json.optInt(GraphSONTokens._ID));
        Assert.assertTrue(json.has("keyString"));
        Assert.assertEquals("string", json.optString("keyString"));
        Assert.assertTrue(json.has("keyLong"));
        Assert.assertEquals(1L, json.optLong("keyLong"));
        Assert.assertTrue(json.has("keyInt"));
        Assert.assertEquals(2, json.optInt("keyInt"));
        Assert.assertTrue(json.has("keyFloat"));
        Assert.assertEquals(3.3f, (float) json.optDouble("keyFloat"), 0);
        Assert.assertTrue(json.has("keyExponentialDouble"));
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optLong()

            JSONObject valueAsJson = listAsJSON.optJSONObject(ix);
            Assert.assertNotNull(valueAsJson);
            Assert.assertTrue(valueAsJson.has(GraphSONTokens.TYPE));
            Assert.assertEquals(GraphSONTokens.TYPE_LONG, valueAsJson.optString(GraphSONTokens.TYPE));
            Assert.assertTrue(valueAsJson.has(GraphSONTokens.VALUE));
            Assert.assertEquals(1000L, valueAsJson.optLong(GraphSONTokens.VALUE));
        }
    }

    @Test
    public void jsonFromElementVertexIntListPropertiesNoKeysWithTypes() throws JSONException {
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optLong()

        final Vertex v = new VertexThatReturnsNull();
        final JSONObject json = GraphSONUtility.jsonFromElement(v, null, GraphSONMode.EXTENDED);

        Assert.assertNotNull(json);
        Assert.assertTrue(json.has(GraphSONTokens._ID));
        Assert.assertEquals(1234l, json.optLong(GraphSONTokens._ID));
        Assert.assertFalse(json.has("alwaysNull"));
    }

    /**
     * This test is kinda weird since a Blueprints graph can't have properties set to null, howerver that does not
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optLong()

        final Vertex v = new VertexThatReturnsNull();
        final JSONObject json = GraphSONUtility.jsonFromElement(v, null, GraphSONMode.NORMAL);

        Assert.assertNotNull(json);
        Assert.assertTrue(json.has(GraphSONTokens._ID));
        Assert.assertEquals(1234l, json.optLong(GraphSONTokens._ID));
        Assert.assertFalse(json.has("alwaysNull"));
    }

    @Test
    public void jsonFromElementNullsNoKeysNoTypes() throws JSONException {
View Full Code Here

Examples of org.json.JSONArray.optLong()

      String docId = row.optString("id");
      JSONArray jsonInterval = row.optJSONArray("value");
      long min = 0;
      long max = -1;
      if( null != jsonInterval && jsonInterval.length() >= 2 ){
        min = jsonInterval.optLong(0);
        max = jsonInterval.optLong(1);
      }
      if( null != docId && max >= min ){
        Interval interval = new Interval(min,max);
        DocumentWithInterval docWithInt = new DocumentWithInterval(docId, interval);
View Full Code Here

Examples of org.json.JSONArray.optLong()

      JSONArray jsonInterval = row.optJSONArray("value");
      long min = 0;
      long max = -1;
      if( null != jsonInterval && jsonInterval.length() >= 2 ){
        min = jsonInterval.optLong(0);
        max = jsonInterval.optLong(1);
      }
      if( null != docId && max >= min ){
        Interval interval = new Interval(min,max);
        DocumentWithInterval docWithInt = new DocumentWithInterval(docId, interval);
        results.documentWithIntervals.add(docWithInt);
View Full Code Here

Examples of org.json.JSONArray.optLong()

      JSONArray jsonInterval = row.optJSONArray("value");
      results.intervalCount++;
      long min = 0;
      long max = -1;
      if( null != jsonInterval && jsonInterval.length() >= 2 ){
        min = jsonInterval.optLong(0);
        max = jsonInterval.optLong(1);
      }
      if( null != docId && max >= min ){
        Interval interval = new Interval(min,max);
        if( interval.intersectsWith(range) ){
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.