use of com.google.gwt.json.client.JSONNumber in project perun by CESNET.
the class AddUserToBlacklist method prepareJSONObject.
/**
* Prepares a JSON object
*
* @return JSONObject the whole query
*/
private JSONObject prepareJSONObject() {
JSONObject jsonQuery = new JSONObject();
jsonQuery.put("securityTeam", new JSONNumber(securityTeamId));
jsonQuery.put("user", new JSONNumber(userId));
jsonQuery.put("description", new JSONString(description));
return jsonQuery;
}
use of com.google.gwt.json.client.JSONNumber 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.JSONNumber 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.JSONNumber 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.JSONNumber 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;
}
Aggregations