Search in sources :

Example 36 with JSONNumber

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;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONNumber(com.google.gwt.json.client.JSONNumber) JSONString(com.google.gwt.json.client.JSONString)

Example 37 with JSONNumber

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;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONNumber(com.google.gwt.json.client.JSONNumber)

Example 38 with JSONNumber

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;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONNumber(com.google.gwt.json.client.JSONNumber) JSONString(com.google.gwt.json.client.JSONString)

Example 39 with JSONNumber

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);
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) JSONObject(com.google.gwt.json.client.JSONObject) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) JsonPostClient(cz.metacentrum.perun.webgui.json.JsonPostClient) JSONNumber(com.google.gwt.json.client.JSONNumber) PerunError(cz.metacentrum.perun.webgui.model.PerunError) JSONString(com.google.gwt.json.client.JSONString)

Example 40 with JSONNumber

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;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONArray(com.google.gwt.json.client.JSONArray) JSONNumber(com.google.gwt.json.client.JSONNumber)

Aggregations

JSONNumber (com.google.gwt.json.client.JSONNumber)164 JSONObject (com.google.gwt.json.client.JSONObject)109 JSONString (com.google.gwt.json.client.JSONString)72 JSONArray (com.google.gwt.json.client.JSONArray)69 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)19 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)18 JsonPostClient (cz.metacentrum.perun.webgui.json.JsonPostClient)18 PerunError (cz.metacentrum.perun.webgui.model.PerunError)17 HashMap (java.util.HashMap)4 Map (java.util.Map)4 JSONValue (com.google.gwt.json.client.JSONValue)3 ArrayList (java.util.ArrayList)3 Token (org.rstudio.core.client.Invalidation.Token)3 ServerError (org.rstudio.studio.client.server.ServerError)3 Breakpoint (org.rstudio.studio.client.common.debugging.model.Breakpoint)2 DiffResult (org.rstudio.studio.client.common.vcs.DiffResult)2 StatusAndPath (org.rstudio.studio.client.common.vcs.StatusAndPath)2 Point (org.rstudio.studio.client.workbench.views.plots.model.Point)2 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1