Search in sources :

Example 51 with JSONObject

use of com.google.gwt.json.client.JSONObject in project perun by CESNET.

the class GenerateAccount method prepareJSONObject.

/**
	 * Prepares a JSON object for password reservation.
	 *
	 * @return JSONObject the whole query
	 */
private JSONObject prepareJSONObject() {
    JSONObject jsonQuery = new JSONObject();
    jsonQuery.put("namespace", new JSONString(namespace));
    JSONObject param = new JSONObject();
    if (pass != null && !pass.isEmpty()) {
        param.put("password", new JSONString(pass));
    }
    for (String key : params.keySet()) {
        param.put(key, new JSONString(params.get(key)));
    }
    jsonQuery.put("parameters", param);
    return jsonQuery;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONString(com.google.gwt.json.client.JSONString) JSONString(com.google.gwt.json.client.JSONString)

Example 52 with JSONObject

use of com.google.gwt.json.client.JSONObject in project perun by CESNET.

the class RemoveSpecificUserOwner method prepareJSONObject.

/**
	 * Prepares a JSON object
	 *
	 * @return JSONObject the whole query
	 */
private JSONObject prepareJSONObject() {
    // create whole JSON query
    JSONObject jsonQuery = new JSONObject();
    jsonQuery.put("user", new JSONNumber(user.getId()));
    jsonQuery.put("specificUser", new JSONNumber(specificUser.getId()));
    return jsonQuery;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONNumber(com.google.gwt.json.client.JSONNumber)

Example 53 with JSONObject

use of com.google.gwt.json.client.JSONObject in project perun by CESNET.

the class RemoveDestination method prepareJSONObject.

/**
	 * Prepares a JSON object
	 *
	 * @return JSONObject the whole query
	 */
private JSONObject prepareJSONObject() {
    // whole JSON query
    JSONObject jsonQuery = new JSONObject();
    jsonQuery.put("destination", new JSONString(destination));
    jsonQuery.put("type", new JSONString(type));
    jsonQuery.put("service", new JSONNumber(serviceId));
    jsonQuery.put("facility", new JSONNumber(facilityId));
    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 54 with JSONObject

use of com.google.gwt.json.client.JSONObject in project perun by CESNET.

the class UpdateServicePackage method prepareJSONObject.

/**
	 * Prepares a JSON object
	 * @return JSONObject the whole query
	 */
private JSONObject prepareJSONObject() {
    // service
    JSONObject pack = new JSONObject(servicesPackage);
    JSONObject newPack = new JSONObject();
    newPack.put("name", pack.get("name"));
    newPack.put("description", pack.get("description"));
    newPack.put("id", pack.get("id"));
    // whole JSON query
    JSONObject jsonQuery = new JSONObject();
    jsonQuery.put("servicesPackage", newPack);
    return jsonQuery;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject)

Example 55 with JSONObject

use of com.google.gwt.json.client.JSONObject in project perun by CESNET.

the class AddUserExtSource method prepareJSONObject.

/**
	 * Prepares a JSON object
	 *
	 * @return JSONObject the whole query
	 */
private JSONObject prepareJSONObject() {
    JSONNumber user = new JSONNumber(userId);
    // create Json object from webgui extSource
    JSONObject oldExtSource = new JSONObject(extSource);
    // get only interested in items
    JSONValue uesName = oldExtSource.get("name");
    JSONValue uesId = oldExtSource.get("id");
    JSONValue uesType = oldExtSource.get("type");
    // create a new form of ext source
    JSONObject newExtSource = new JSONObject();
    newExtSource.put("name", uesName);
    newExtSource.put("id", uesId);
    newExtSource.put("type", uesType);
    // create new userExtSource
    JSONObject userExtSource = new JSONObject();
    userExtSource.put("id", new JSONNumber(0));
    userExtSource.put("extSource", newExtSource);
    userExtSource.put("login", new JSONString(login));
    userExtSource.put("loa", new JSONNumber(loa));
    // create whole JSON query
    JSONObject jsonQuery = new JSONObject();
    jsonQuery.put("user", user);
    jsonQuery.put("userExtSource", userExtSource);
    return jsonQuery;
}
Also used : JSONValue(com.google.gwt.json.client.JSONValue) JSONObject(com.google.gwt.json.client.JSONObject) JSONNumber(com.google.gwt.json.client.JSONNumber) JSONString(com.google.gwt.json.client.JSONString)

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