use of com.google.gwt.json.client.JSONNumber in project perun by CESNET.
the class DeleteThanks method prepareJSONObject.
/**
* Prepares a JSON object
* @return JSONObject the whole query
*/
private JSONObject prepareJSONObject() {
// category
JSONObject thanks = new JSONObject();
thanks.put("id", new JSONNumber(thanksId));
return thanks;
}
use of com.google.gwt.json.client.JSONNumber in project perun by CESNET.
the class AddAdmin method prepareJSONObjectForGroup.
/**
* Prepares a JSON object
*
* @return JSONObject the whole query
*/
private JSONObject prepareJSONObjectForGroup() {
JSONObject jsonQuery = new JSONObject();
if (entity.equals(PerunEntity.VIRTUAL_ORGANIZATION)) {
jsonQuery.put("vo", new JSONNumber(entityId));
} else if (entity.equals(PerunEntity.GROUP)) {
jsonQuery.put("group", new JSONNumber(entityId));
} else if (entity.equals(PerunEntity.FACILITY)) {
jsonQuery.put("facility", new JSONNumber(entityId));
} else if (entity.equals(PerunEntity.SECURITY_TEAM)) {
jsonQuery.put("securityTeam", new JSONNumber(entityId));
}
jsonQuery.put("authorizedGroup", new JSONNumber(userId));
return jsonQuery;
}
use of com.google.gwt.json.client.JSONNumber in project perun by CESNET.
the class AddExtSource method addGroupExtSource.
/**
* Attempts to add external source to Group in DB - make RPC call
*
* @param groupId ID of Group, where should be ext source added
* @param extSourceId ID of external source to be added
*/
public void addGroupExtSource(final int groupId, final int extSourceId) {
this.extSourceId = extSourceId;
// create whole JSON query
JSONObject jsonQuery = new JSONObject();
jsonQuery.put("source", new JSONNumber(extSourceId));
jsonQuery.put("group", new JSONNumber(groupId));
// local events
JsonCallbackEvents newEvents = new JsonCallbackEvents() {
public void onError(PerunError error) {
session.getUiElements().setLogErrorText("Adding external source: " + extSourceId + " to group: " + groupId + " failed.");
events.onError(error);
}
;
public void onFinished(JavaScriptObject jso) {
session.getUiElements().setLogSuccessText("External source: " + extSourceId + " successfully added to group: " + groupId);
events.onFinished(jso);
}
;
public void onLoadingStart() {
events.onLoadingStart();
}
;
};
// create request
JsonPostClient request = new JsonPostClient(newEvents);
request.sendData(JSON_URL, jsonQuery);
}
use of com.google.gwt.json.client.JSONNumber in project perun by CESNET.
the class SetAttributes method prepareJSONObject.
/**
* Prepares a JSON object.
* @return JSONObject the whole query
*/
private JSONObject prepareJSONObject() {
// create whole JSON query
JSONObject jsonQuery = new JSONObject();
// create attrs field
JSONArray array = new JSONArray();
// create attributes
for (int i = 0; i < attributes.size(); i++) {
// skip attribute with empty or null value
if (attributes.get(i).getValue() == null || attributes.get(i).getValue().equalsIgnoreCase("")) {
continue;
}
// create Json object from attribute
JSONObject attr = new JSONObject(attributes.get(i));
// get only interested in properties
JSONValue id = attr.get("id");
JSONValue friendlyName = attr.get("friendlyName");
JSONValue namespace = attr.get("namespace");
JSONValue type = attr.get("type");
JSONValue description = attr.get("description");
JSONValue value = attr.get("value");
JSONValue displayName = attr.get("displayName");
// create new Attribute jsonObject
JSONObject newAttr = new JSONObject();
newAttr.put("value", value);
newAttr.put("id", id);
newAttr.put("type", type);
newAttr.put("description", description);
newAttr.put("namespace", namespace);
newAttr.put("friendlyName", friendlyName);
newAttr.put("displayName", displayName);
// put attribute into array
array.set(array.size(), newAttr);
}
for (Map.Entry<String, Integer> attrIds : this.ids.entrySet()) {
jsonQuery.put(attrIds.getKey(), new JSONNumber(attrIds.getValue()));
}
jsonQuery.put("attributes", array);
return jsonQuery;
}
use of com.google.gwt.json.client.JSONNumber in project perun by CESNET.
the class RemoveAdmin method prepareJSONObjectForGroup.
/**
* Prepares a JSON object
*
* @return JSONObject the whole query
*/
private JSONObject prepareJSONObjectForGroup() {
// whole JSON query
JSONObject jsonQuery = new JSONObject();
if (entity.equals(PerunEntity.VIRTUAL_ORGANIZATION)) {
jsonQuery.put("vo", new JSONNumber(entityId));
} else if (entity.equals(PerunEntity.GROUP)) {
jsonQuery.put("group", new JSONNumber(entityId));
} else if (entity.equals(PerunEntity.FACILITY)) {
jsonQuery.put("facility", new JSONNumber(entityId));
} else if (entity.equals(PerunEntity.SECURITY_TEAM)) {
jsonQuery.put("securityTeam", new JSONNumber(entityId));
}
jsonQuery.put("authorizedGroup", new JSONNumber(userId));
return jsonQuery;
}
Aggregations