Search in sources :

Example 66 with JSONObject

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

the class DeleteAuthorship method deleteAuthorship.

/**
	 * Attempts to delete Authorship, it first tests the values and then submits them.
	 *
	 * @param publicationId
	 * @param userId
	 */
public void deleteAuthorship(final int publicationId, final int userId) {
    this.publicationId = publicationId;
    this.userId = userId;
    // test arguments
    if (!this.testDeleting()) {
        return;
    }
    // json object
    JSONObject jsonQuery = prepareJSONObject();
    // local events
    JsonCallbackEvents newEvents = new JsonCallbackEvents() {

        public void onError(PerunError error) {
            session.getUiElements().setLogErrorText("Removing author " + userId + " from publication: " + publicationId + " failed.");
            events.onError(error);
        }

        ;

        public void onFinished(JavaScriptObject jso) {
            session.getUiElements().setLogSuccessText("Author " + userId + " removed from publication: " + publicationId);
            events.onFinished(jso);
        }

        ;

        public void onLoadingStart() {
            events.onLoadingStart();
        }

        ;
    };
    // create request
    JsonPostClient request = new JsonPostClient(newEvents);
    request.sendData(JSON_URL, jsonQuery);
}
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) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Example 67 with JSONObject

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

the class DeleteAuthorship method prepareJSONObject.

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

Example 68 with JSONObject

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

the class DeleteCategory method deleteCategory.

/**
	 * Attempts to delete a Category, it first tests the values and then submits them.
	 *
	 * @param categoryId ID of category to be deleted
	 */
public void deleteCategory(final int categoryId) {
    this.categoryId = categoryId;
    // test arguments
    if (!this.testDeleting()) {
        return;
    }
    // json object
    JSONObject jsonQuery = prepareJSONObject();
    // local events
    JsonCallbackEvents newEvents = new JsonCallbackEvents() {

        public void onError(PerunError error) {
            session.getUiElements().setLogErrorText("Deleting category " + categoryId + " failed.");
            events.onError(error);
        }

        ;

        public void onFinished(JavaScriptObject jso) {
            session.getUiElements().setLogSuccessText("Category " + categoryId + " deleted.");
            events.onFinished(jso);
        }

        ;

        public void onLoadingStart() {
            events.onLoadingStart();
        }

        ;
    };
    // create request
    JsonPostClient request = new JsonPostClient(newEvents);
    request.sendData(JSON_URL, jsonQuery);
}
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) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Example 69 with JSONObject

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

the class DeleteCategory method prepareJSONObject.

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

Example 70 with JSONObject

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

the class DeleteThanks method prepareJSONObject.

/**
	 * Prepares a JSON object
	 * @return JSONObject the whole query
	 */
private JSONObject prepareJSONObject() {
    // category
    JSONObject thanks = new JSONObject();
    thanks.put("id", new JSONNumber(thanksId));
    return thanks;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONNumber(com.google.gwt.json.client.JSONNumber)

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