Search in sources :

Example 41 with JSONObject

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

Example 42 with JSONObject

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

Example 43 with JSONObject

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

Example 44 with JSONObject

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);
}
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 45 with JSONObject

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

Aggregations

JSONObject (com.google.gwt.json.client.JSONObject)227 JSONNumber (com.google.gwt.json.client.JSONNumber)109 JSONString (com.google.gwt.json.client.JSONString)74 JSONArray (com.google.gwt.json.client.JSONArray)62 PerunError (cz.metacentrum.perun.webgui.model.PerunError)55 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)54 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)54 JsonPostClient (cz.metacentrum.perun.webgui.json.JsonPostClient)50 JSONValue (com.google.gwt.json.client.JSONValue)13 HashMap (java.util.HashMap)12 Map (java.util.Map)8 ArrayList (java.util.ArrayList)6 JsArrayString (com.google.gwt.core.client.JsArrayString)3 User (cz.metacentrum.perun.webgui.model.User)3 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 Command (com.google.gwt.user.client.Command)2 Contact (com.googlecode.gwtphonegap.client.contacts.Contact)2 ContactField (com.googlecode.gwtphonegap.client.contacts.ContactField)2 StringCallback (com.gwtmobile.phonegap.client.plugins.Bluetooth.StringCallback)2