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);
}
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;
}
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);
}
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;
}
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;
}
Aggregations