Package org.codehaus.jettison.json

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


            if (jsonObject.has("transitions")) {
              return JsonParseUtil.parseJsonArray(jsonObject.getJSONArray("transitions"), transitionJsonParserV5);
            } else {
              final Collection<Transition> transitions = new ArrayList<Transition>(jsonObject.length());
              @SuppressWarnings("unchecked")
              final Iterator<String> iterator = jsonObject.keys();
              while (iterator.hasNext()) {
                final String key = iterator.next();
                try {
                  final int id = Integer.parseInt(key);
                  final Transition transition = transitionJsonParser.parse(jsonObject.getJSONObject(key), id);
View Full Code Here


              .generate(transitionInput.getComment()));
        }
      }
      final Iterable<FieldInput> fields = transitionInput.getFields();
      JSONObject fieldsJs = new IssueUpdateJsonGenerator().generate(fields);
      if (fieldsJs.keys().hasNext()) {
        jsonObject.put("fields", fieldsJs);
      }
      if (fieldsJs.keys().hasNext()) {
        jsonObject.put("fields", fieldsJs);
      }
View Full Code Here

      final Iterable<FieldInput> fields = transitionInput.getFields();
      JSONObject fieldsJs = new IssueUpdateJsonGenerator().generate(fields);
      if (fieldsJs.keys().hasNext()) {
        jsonObject.put("fields", fieldsJs);
      }
      if (fieldsJs.keys().hasNext()) {
        jsonObject.put("fields", fieldsJs);
      }
      return post(transitionsUri, jsonObject);
    } catch (JSONException ex) {
      throw new RestClientException(ex);
View Full Code Here

  @Override
  public Permissions parse(final JSONObject json) throws JSONException {
    final JSONObject permissionsObject = json.getJSONObject("permissions");

    final List<Permission> permissions = Lists.newArrayList();
    final Iterator it = permissionsObject.keys();
    while (it.hasNext()) {
      final String key = it.next().toString();
      final JSONObject permissionObject = permissionsObject.getJSONObject(key);
      final Permission permission = permissionJsonParser.parse(permissionObject);
      permissions.add(permission);
View Full Code Here

                k = k.substring(1);
                if (k.equals("xmlns")) {
                    // if its a string its a default namespace
                    if (o instanceof JSONObject) {
                        JSONObject jo = (JSONObject) o;
                        for (Iterator pitr = jo.keys(); pitr.hasNext(); ) {
                            String prefix = (String) pitr.next();
                            String uri = jo.getString(prefix);

                            if (prefix.equals("$")) {
                                prefix = "";
View Full Code Here

            rawElement = RestHelper.getResultObject(this.graph.getGraphURI() + RexsterTokens.SLASH_VERTICES_SLASH + RestHelper.encode(this.getId()));
        else
            rawElement = RestHelper.getResultObject(this.graph.getGraphURI() + RexsterTokens.SLASH_EDGES_SLASH + RestHelper.encode(this.getId()));

        Set<String> keys = new HashSet<String>();
        Iterator keyIterator = rawElement.keys();
        while (keyIterator.hasNext()) {
            keys.add((String) keyIterator.next());
        }

        keys.remove(RexsterTokens._TYPE);
View Full Code Here

        ClientResponse response = client.resource("http://localhost:12060/repository/schema/recordType")
                .header("X-NGDATA-TEST", "example-data").get(ClientResponse.class);
        JSONObject object =  response.getEntity(JSONObject.class);

        assertThat(object).isNotNull();
        assertThat(object.keys()).contains("results");
        assertThat(response.getHeaders()).includes(entry("X-NGDATA-TEST", asList("example-data")));
    }

    @Test
    public void testHttpsIsReady() throws Exception {
View Full Code Here

    @Test
    public void testHttpsIsReady() throws Exception {
        Client client = new Client();
        JSONObject object = client.resource("https://localhost:12443/repository/schema/recordType").get(JSONObject.class);
        assertThat(object).isNotNull();
        assertThat(object.keys()).contains("results");
    }
}
View Full Code Here

            if (jsonObject.has("transitions")) {
              return JsonParseUtil.parseJsonArray(jsonObject.getJSONArray("transitions"), transitionJsonParserV5);
            } else {
              final Collection<Transition> transitions = new ArrayList<Transition>(jsonObject.length());
              @SuppressWarnings("unchecked")
              final Iterator<String> iterator = jsonObject.keys();
              while (iterator.hasNext()) {
                final String key = iterator.next();
                try {
                  final int id = Integer.parseInt(key);
                  final Transition transition = transitionJsonParser.parse(jsonObject.getJSONObject(key), id);
View Full Code Here

              .generate(transitionInput.getComment()));
        }
      }
      final Iterable<FieldInput> fields = transitionInput.getFields();
      final JSONObject fieldsJs = new IssueUpdateJsonGenerator().generate(fields);
      if (fieldsJs.keys().hasNext()) {
        jsonObject.put("fields", fieldsJs);
      }
      if (fieldsJs.keys().hasNext()) {
        jsonObject.put("fields", fieldsJs);
      }
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.