use of com.google.gwt.json.client.JSONNumber in project perun by CESNET.
the class CreateGroup method createGroupInVo.
/**
* Create a new group in a VO
* @param voId VO ID
* @param name Group name
* @param description Group description
*/
public void createGroupInVo(int voId, final String name, String description) {
this.groupName = name;
this.groupDescription = description;
// test arguments
if (!this.testCreating()) {
return;
}
// GROUP OBJECT
JSONObject group = new JSONObject();
group.put("name", new JSONString(name));
group.put("description", new JSONString(description));
// whole JSON query
JSONObject jsonQuery = new JSONObject();
jsonQuery.put("vo", new JSONNumber(voId));
jsonQuery.put("group", group);
this.createGroup(jsonQuery);
}
use of com.google.gwt.json.client.JSONNumber in project perun by CESNET.
the class CreateGroup method createGroupInGroup.
/**
* Creates a new subgroup in group
* @param groupId Parent group id
* @param name New group name
* @param description New group description
*/
public void createGroupInGroup(final int groupId, final String name, String description) {
this.groupName = name;
this.groupDescription = description;
// test arguments
if (!this.testCreating()) {
return;
}
// GROUP OBJECT
JSONObject group = new JSONObject();
group.put("name", new JSONString(name));
group.put("description", new JSONString(description));
// whole JSON query
JSONObject jsonQuery = new JSONObject();
jsonQuery.put("parentGroup", new JSONNumber(groupId));
jsonQuery.put("group", group);
this.createGroup(jsonQuery);
}
use of com.google.gwt.json.client.JSONNumber in project perun by CESNET.
the class DeleteGroups method deleteGroups.
/**
* Delete (sub)groups of any group or VO.
*
* @param groups groups to be deleted
* @param force TRUE = forced delete (remove all members, remove from resources) / FALSE = not delete if group has members
*/
public void deleteGroups(final ArrayList<? extends Group> groups, boolean force) {
// whole JSON query
JSONObject jsonQuery = new JSONObject();
JSONArray grps = new JSONArray();
for (int i = 0; i < groups.size(); i++) {
grps.set(i, new JSONNumber(groups.get(i).getId()));
}
jsonQuery.put("groups", grps);
jsonQuery.put("forceDelete", new JSONNumber((force) ? 1 : 0));
// new events
JsonCallbackEvents newEvents = new JsonCallbackEvents() {
public void onError(PerunError error) {
session.getUiElements().setLogErrorText("Deleting groups failed.");
events.onError(error);
}
;
public void onFinished(JavaScriptObject jso) {
session.getUiElements().setLogSuccessText("Groups successfully deleted!");
events.onFinished(jso);
}
;
public void onLoadingStart() {
events.onLoadingStart();
}
;
};
// sending data
JsonPostClient jspc = new JsonPostClient(newEvents);
jspc.sendData(JSON_URL, jsonQuery);
}
use of com.google.gwt.json.client.JSONNumber in project perun by CESNET.
the class ForceServicePropagation method forcePropagation.
/**
* Starts Force service propagation for specified service and facility
*
* @param facilityId ID of facility to propagate service to
* @param serviceId ID of service to be propagated
*/
public void forcePropagation(final int facilityId, final int serviceId) {
this.facilityId = facilityId;
this.serviceId = serviceId;
// test arguments
if (!this.testArguments()) {
return;
}
// whole JSON query
JSONObject jsonQuery = new JSONObject();
jsonQuery.put("facility", new JSONNumber(facilityId));
jsonQuery.put("service", new JSONNumber(serviceId));
// new events
JsonCallbackEvents newEvents = new JsonCallbackEvents() {
public void onError(PerunError error) {
session.getUiElements().setLogErrorText("Propagation initialization of service: " + serviceId + " failed.");
events.onError(error);
}
;
public void onFinished(JavaScriptObject jso) {
session.getUiElements().setLogSuccessText("Propagation of service: " + serviceId + " initiated.");
events.onFinished(jso);
}
;
public void onLoadingStart() {
events.onLoadingStart();
}
;
};
// sending data
JsonPostClient jspc = new JsonPostClient(newEvents);
jspc.sendData(JSON_URL, jsonQuery);
}
use of com.google.gwt.json.client.JSONNumber in project perun by CESNET.
the class FreeDenialOfExecServiceOnFacility method prepareJSONObject.
/**
* Prepares a JSON object
*
* @return JSONObject the whole query
*/
private JSONObject prepareJSONObject() {
JSONObject jsonQuery = new JSONObject();
jsonQuery.put("facility", new JSONNumber(facilityId));
jsonQuery.put("execService", new JSONNumber(execServiceId));
return jsonQuery;
}
Aggregations