use of com.google.gwt.json.client.JSONObject in project perun by CESNET.
the class CreateSecurityTeam method prepareJSONObject.
/**
* Prepares a JSON object.
* @return JSONObject - the whole query
*/
private JSONObject prepareJSONObject() {
// vo
JSONObject team = new JSONObject();
team.put("name", new JSONString(name));
team.put("description", new JSONString(description));
// whole JSON query
JSONObject jsonQuery = new JSONObject();
jsonQuery.put("securityTeam", team);
return jsonQuery;
}
use of com.google.gwt.json.client.JSONObject in project perun by CESNET.
the class DeleteSecurityTeam method prepareJSONObject.
/**
* Prepares a JSON object
*
* @return JSONObject the whole query
*/
private JSONObject prepareJSONObject() {
JSONObject jsonQuery = new JSONObject();
jsonQuery.put("securityTeam", new JSONNumber(securityTeamId));
if (force) {
jsonQuery.put("force", null);
}
return jsonQuery;
}
use of com.google.gwt.json.client.JSONObject in project perun by CESNET.
the class ResendNotification method prepareJSONObject.
/**
* Prepares a JSON object.
* @return JSONObject - the whole query
*/
private JSONObject prepareJSONObject() {
// query
JSONObject query = new JSONObject();
query.put("appId", new JSONNumber(appId));
query.put("mailType", new JSONString(mailType));
if (mailType.equals("APP_REJECTED_USER")) {
query.put("reason", new JSONString(reason));
}
return query;
}
use of com.google.gwt.json.client.JSONObject in project perun by CESNET.
the class SendInvitation method inviteUser.
/**
* Send request to invite user
*/
public void inviteUser(String email, String name, String language) {
if (email == null || email.isEmpty()) {
UiElements.generateAlert("Input error", "Email address to send invitation to is empty.");
return;
}
if (!JsonUtils.isValidEmail(email)) {
UiElements.generateAlert("Input error", "Email address format is not valid.");
return;
}
/*
if (name == null || name.isEmpty()) {
UiElements.generateAlert("Input error", "Name of user to invite can't be empty.");
return;
}
*/
// new events
JsonCallbackEvents newEvents = new JsonCallbackEvents() {
public void onError(PerunError error) {
session.getUiElements().setLogErrorText("Inviting user failed.");
events.onError(error);
}
public void onFinished(JavaScriptObject jso) {
session.getUiElements().setLogSuccessText("User invited.");
events.onFinished(jso);
}
public void onLoadingStart() {
events.onLoadingStart();
}
};
// query
JSONObject query = new JSONObject();
query.put("voId", new JSONNumber(voId));
if (groupId != 0) {
query.put("groupId", new JSONNumber(groupId));
}
if (name != null && !name.isEmpty())
query.put("name", new JSONString(name));
query.put("email", new JSONString(email));
if (language != null && !language.isEmpty()) {
query.put("language", new JSONString(language));
} else {
query.put("language", new JSONObject(null));
}
// sending data
JsonPostClient jspc = new JsonPostClient(newEvents);
jspc.sendData(JSON_URL, query);
}
use of com.google.gwt.json.client.JSONObject in project perun by CESNET.
the class UpdateForm method prepareJSONObject.
/**
* Prepares a JSON object.
* @return JSONObject - the whole query
*/
private JSONObject prepareJSONObject() {
// query
JSONObject query = new JSONObject(form);
JSONObject result = new JSONObject();
result.put("form", query);
return result;
}
Aggregations