use of com.google.gwt.json.client.JSONArray in project gwtphonegap by dankurka.
the class ContactBrowserImpl method createOrganisation.
private JSONArray createOrganisation(LightArray<ContactOrganisation> organisations) {
JSONArray jsonArray = new JSONArray();
for (int i = 0; i < organisations.length(); i++) {
ContactOrganisation co = organisations.get(i);
JSONObject orga = new JSONObject();
orga.put(ORGANISATION_NAME, getAsJSONString(co.getName()));
orga.put(ORGANISATION_DEPARTMENT, getAsJSONString(co.getDepartment()));
orga.put(ORGANISATION_TITLE, getAsJSONString(co.getTitle()));
orga.put(ORGANISATION_TYPE, getAsJSONString(co.getType()));
orga.put(ORGANISATION_PREF, JSONBoolean.getInstance(co.isPref()));
jsonArray.set(i, orga);
}
return jsonArray;
}
use of com.google.gwt.json.client.JSONArray in project rstudio by rstudio.
the class RemoteServer method sendRequest.
private <T> void sendRequest(String scope, String method, String param1, String param2, ServerRequestCallback<T> requestCallback) {
JSONArray params = new JSONArray();
// pass JSONNull if the string is null
params.set(0, param1 != null ? new JSONString(param1) : JSONNull.getInstance());
params.set(1, param2 != null ? new JSONString(param2) : JSONNull.getInstance());
sendRequest(scope, method, params, requestCallback);
}
use of com.google.gwt.json.client.JSONArray in project perun by CESNET.
the class AssignGroupToResources method prepareJSONObject.
/**
* Prepares a JSON object
*
* @return JSONObject the whole query
*/
private JSONObject prepareJSONObject() {
JSONObject jsonQuery = new JSONObject();
JSONArray array = new JSONArray();
for (int i = 0; i < resources.size(); i++) {
array.set(i, new JSONNumber(resources.get(i).getId()));
}
jsonQuery.put("resources", array);
jsonQuery.put("group", new JSONNumber(group.getId()));
return jsonQuery;
}
use of com.google.gwt.json.client.JSONArray in project perun by CESNET.
the class RemoveGroupsFromResource method prepareJSONObject.
/**
* Prepares a JSON object
*
* @return JSONObject the whole query
*/
private JSONObject prepareJSONObject() {
JSONObject jsonQuery = new JSONObject();
JSONArray array = new JSONArray();
for (int i = 0; i < groups.size(); i++) {
array.set(i, new JSONNumber(groups.get(i).getId()));
}
jsonQuery.put("groups", array);
jsonQuery.put("resource", new JSONNumber(resource.getId()));
return jsonQuery;
}
use of com.google.gwt.json.client.JSONArray in project perun by CESNET.
the class AddDestination method prepareJSONObject.
/**
* Prepares a JSON object
*
* @return JSONObject the whole query
*/
private JSONObject prepareJSONObject() {
// whole JSON query
JSONObject jsonQuery = new JSONObject();
jsonQuery.put("destination", new JSONString(destination));
jsonQuery.put("type", new JSONString(type));
jsonQuery.put("facility", new JSONNumber(facility.getId()));
JSONArray servs = new JSONArray();
for (int i = 0; i < services.size(); i++) {
// rebuild service object
JSONObject srv = new JSONObject();
srv.put("id", new JSONNumber(services.get(i).getId()));
srv.put("name", new JSONString(services.get(i).getName()));
servs.set(i, srv);
}
jsonQuery.put("services", servs);
return jsonQuery;
}
Aggregations