use of com.google.gwt.json.client.JSONObject in project perun by CESNET.
the class ValidateMemberAsync method prepareJSONObject.
/**
* Prepares a JSON object
*
* @return JSONObject the whole query
*/
private JSONObject prepareJSONObject() {
// create whole JSON query
JSONObject jsonQuery = new JSONObject();
jsonQuery.put("member", new JSONNumber(member.getId()));
return jsonQuery;
}
use of com.google.gwt.json.client.JSONObject in project perun by CESNET.
the class CreateOwner method prepareJSONObject.
/**
* Prepares a JSON object
*
* @return JSONObject the whole query
*/
private JSONObject prepareJSONObject() {
JSONObject owner = new JSONObject();
owner.put("name", new JSONString(ownerName));
owner.put("contact", new JSONString(ownerContact));
owner.put("type", new JSONString(ownerType));
JSONObject jsonQuery = new JSONObject();
jsonQuery.put("owner", owner);
return jsonQuery;
}
use of com.google.gwt.json.client.JSONObject in project perun by CESNET.
the class DeleteOwner method prepareJSONObject.
/**
* Prepares a JSON object
*
* @return JSONObject the whole query
*/
private JSONObject prepareJSONObject() {
JSONObject jsonQuery = new JSONObject();
jsonQuery.put("owner", new JSONNumber(ownerId));
return jsonQuery;
}
use of com.google.gwt.json.client.JSONObject in project perun by CESNET.
the class UpdateUser method updateUser.
/**
* Updates user details
* @param user User with updated details
*/
public void updateUser(User user) {
if (user == null) {
UiElements.generateAlert("Parameter error", "User to update can't be null");
return;
}
// OBJECT
JSONObject oldUser = new JSONObject(user);
// RECONSTRUCT OBJECT
JSONObject newUser = new JSONObject();
newUser.put("id", oldUser.get("id"));
newUser.put("firstName", oldUser.get("firstName"));
newUser.put("middleName", oldUser.get("middleName"));
newUser.put("lastName", oldUser.get("lastName"));
newUser.put("titleBefore", oldUser.get("titleBefore"));
newUser.put("titleAfter", oldUser.get("titleAfter"));
newUser.put("serviceUser", oldUser.get("serviceUser"));
newUser.put("sponsoredUser", oldUser.get("sponsoredUser"));
// whole JSON query
JSONObject jsonQuery = new JSONObject();
jsonQuery.put("user", newUser);
// new events
JsonCallbackEvents newEvents = new JsonCallbackEvents() {
public void onError(PerunError error) {
session.getUiElements().setLogErrorText("Updating user failed.");
events.onError(error);
}
;
public void onFinished(JavaScriptObject jso) {
User u = jso.cast();
session.getUiElements().setLogSuccessText("User " + u.getFullNameWithTitles() + " successfully updated!");
events.onFinished(jso);
}
;
public void onLoadingStart() {
events.onLoadingStart();
}
;
};
// sending data
JsonPostClient jspc = new JsonPostClient(newEvents);
jspc.sendData(JSON_URL, jsonQuery);
}
use of com.google.gwt.json.client.JSONObject in project perun by CESNET.
the class CreateVo method prepareJSONObject.
/**
* Prepares a JSON object.
* @return JSONObject - the whole query
*/
private JSONObject prepareJSONObject() {
// vo
JSONObject vo = new JSONObject();
vo.put("name", new JSONString(name));
vo.put("shortName", new JSONString(shortName));
// whole JSON query
JSONObject jsonQuery = new JSONObject();
jsonQuery.put("vo", vo);
return jsonQuery;
}
Aggregations