Package org.codehaus.jettison.json

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


    final ImmutableList.Builder<ErrorCollection> results = ImmutableList.builder();
    if (issues != null && issues.length() == 0) {
      final JSONArray errors = jsonObject.optJSONArray("errors");
      for (int i = 0; i < errors.length(); i++) {
        final JSONObject currentJsonObject = errors.getJSONObject(i);
        results.add(getErrorsFromJson(currentJsonObject.getInt("status"), currentJsonObject
            .optJSONObject("elementErrors")));
      }
    } else {
      results.add(getErrorsFromJson(status, jsonObject));
    }
View Full Code Here


    final ImmutableList.Builder<ErrorCollection> results = ImmutableList.builder();
    if (issues != null && issues.length() == 0) {
      final JSONArray errors = jsonObject.optJSONArray("errors");
      for (int i = 0; i < errors.length(); i++) {
        final JSONObject currentJsonObject = errors.getJSONObject(i);
        results.add(getErrorsFromJson(currentJsonObject.getInt("status"), currentJsonObject
            .optJSONObject("elementErrors")));
      }
    } else {
      results.add(getErrorsFromJson(status, jsonObject));
    }
View Full Code Here

        }
        for (int i = 0; i < json.length(); i++) {
            JSONObject subJson = json.getJSONObject(i);
            MessagePart child = mp.addChild();
            child.setMessage(subJson.optString("message"));
            Properties props = (Properties) extractMap(subJson.optJSONObject("properties"), new Properties());
            for (Map.Entry entry : props.entrySet()) {
                child.addProperty(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
            }
            fillSubMessages(child, subJson.optJSONArray("children"));
        }
View Full Code Here

    final ImmutableList.Builder<ErrorCollection> results = ImmutableList.builder();
    if (issues != null && issues.length() == 0) {
      final JSONArray errors = jsonObject.optJSONArray("errors");
      for (int i = 0; i < errors.length(); i++) {
        final JSONObject currentJsonObject = errors.getJSONObject(i);
        results.add(getErrorsFromJson(currentJsonObject.getInt("status"), currentJsonObject
            .optJSONObject("elementErrors")));
      }
    } else {
      results.add(getErrorsFromJson(status, jsonObject));
    }
View Full Code Here

                ClientResponse responseGetEdge = this.doGraphGet(testGraph, "edges/" + encode(edgeToDelete));
                Assert.assertEquals(ClientResponse.Status.OK, responseGetEdge.getClientResponseStatus());
                JSONObject edgeJson = responseGetEdge.getEntity(JSONObject.class);

                List<String> keysToRemove = new ArrayList<String>();
                Iterator<String> propertyItty = edgeJson.optJSONObject(Tokens.RESULTS).keys();
                String keysToDeleteQueryString = "";
                while (propertyItty.hasNext()) {
                    String key = propertyItty.next();
                    if (!key.startsWith(Tokens.UNDERSCORE)) {
                        keysToRemove.add(key);
View Full Code Here

        request.setEntity(typeTheElement(GraphSONUtility.jsonFromElement(v, null, GraphSONMode.NORMAL)));

        ClientResponse response = this.client.handle(request);

        JSONObject jsonObject = response.getEntity(JSONObject.class);
        String id = jsonObject.optJSONObject(Tokens.RESULTS).optString(Tokens._ID);

        graphHolder.getVertexIdSet().put(v.getId().toString(), id);

    }
View Full Code Here

        request.getHeaders().put("Content-Type", headerValue);

        ClientResponse response = this.client.handle(request);

        JSONObject jsonObject = response.getEntity(JSONObject.class);
        String id = jsonObject.optJSONObject(Tokens.RESULTS).optString(Tokens._ID);

        graphHolder.getEdgeIdSet().put(e.getId().toString(), id);

    }
View Full Code Here

        final String url = getHttpBaseUri() + "graphs/gratefulgraph/edges/";
        for (int ix = 101; ix < 901; ix++) {
            final ClientRequest request = ClientRequest.create().build(URI.create(url + String.valueOf(ix)), "GET");
            final ClientResponse response = httpClient.handle(request);
            final JSONObject json = response.getEntity(JSONObject.class);
            Assert.assertEquals(ix, json.optJSONObject("results").optInt("_id"));
        }
    }
}
View Full Code Here

        final String url = getHttpBaseUri() + "graphs/gratefulgraph/vertices/";
        for (int ix = 1; ix < 801; ix++) {
            final ClientRequest request = ClientRequest.create().build(URI.create(url + String.valueOf(ix)), "GET");
            final ClientResponse response = httpClient.handle(request);
            final JSONObject json = response.getEntity(JSONObject.class);
            Assert.assertEquals(ix, json.optJSONObject("results").optInt("_id"));
        }
    }
}
View Full Code Here

            if (rexsterRequestObject.has(Tokens.OFFSET)) {

                // returns zero if the value identified by the offsetToken is
                // not a number and the key is just present.
                if (rexsterRequestObject.optJSONObject(Tokens.OFFSET).has(offsetToken)) {
                    return rexsterRequestObject.optJSONObject(Tokens.OFFSET).optLong(offsetToken);
                } else {
                    return null;
                }
            } else {
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.