Search in sources :

Example 11 with PerunError

use of cz.metacentrum.perun.webgui.model.PerunError in project perun by CESNET.

the class CopyOwners method copyFacilityOwners.

/**
	 * Attempts to copy owners from one facility to another
	 *
	 * @param sourceFacility ID of source facility to get owners from
	 * @param destinationFacility ID of destination facility to copy owners to
	 */
public void copyFacilityOwners(int sourceFacility, int destinationFacility) {
    this.sourceFacility = sourceFacility;
    this.destinationFacility = destinationFacility;
    // test arguments
    if (!this.testCreating()) {
        return;
    }
    // json object
    JSONObject jsonQuery = prepareJSONObject();
    // local events
    JsonCallbackEvents newEvents = new JsonCallbackEvents() {

        public void onError(PerunError error) {
            session.getUiElements().setLogErrorText("Copying facility owners failed.");
            events.onError(error);
        }

        ;

        public void onFinished(JavaScriptObject jso) {
            session.getUiElements().setLogSuccessText("Facility owners copied.");
            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 12 with PerunError

use of cz.metacentrum.perun.webgui.model.PerunError in project perun by CESNET.

the class DeleteFacility method deleteFacility.

/**
	 * Attempts to delete the facility.
	 * @param facilityId - ID of the facility which should be deleted
	 */
public void deleteFacility(final int facilityId) {
    this.facilityId = facilityId;
    // 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 facility: " + facilityId + " failed.");
            events.onError(error);
        }

        ;

        public void onFinished(JavaScriptObject jso) {
            session.getUiElements().setLogSuccessText("Faicility: " + facilityId + " sucessfully 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 13 with PerunError

use of cz.metacentrum.perun.webgui.model.PerunError in project perun by CESNET.

the class DeleteExecService method deleteExecService.

/**
	 * Deletes Exec Service from DB
	 *
	 * @param serviceId id of exec service to be deleted
	 */
public void deleteExecService(final int serviceId) {
    this.execServiceId = serviceId;
    // test arguments
    if (!this.testArguments()) {
        return;
    }
    // whole JSON query
    JSONObject jsonQuery = new JSONObject();
    jsonQuery.put("execService", new JSONNumber(serviceId));
    // new events
    JsonCallbackEvents newEvents = new JsonCallbackEvents() {

        public void onError(PerunError error) {
            session.getUiElements().setLogErrorText("Deleting of ExecService: " + execServiceId + " failed.");
            events.onError(error);
        }

        ;

        public void onFinished(JavaScriptObject jso) {
            session.getUiElements().setLogSuccessText("ExecService: " + execServiceId + " deleted successfully.");
            events.onFinished(jso);
        }

        ;

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

        ;
    };
    // sending data
    JsonPostClient jspc = new JsonPostClient(newEvents);
    jspc.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) JSONNumber(com.google.gwt.json.client.JSONNumber) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Example 14 with PerunError

use of cz.metacentrum.perun.webgui.model.PerunError in project perun by CESNET.

the class FreeDenialOfExecServiceOnFacility method freeDenialOfExecService.

/**
	 * Attempts to free denial of selected exec service on facility
	 *
	 * @param execServiceId
	 */
public void freeDenialOfExecService(final int execServiceId) {
    this.execServiceId = execServiceId;
    // test arguments
    if (!this.testCreating()) {
        return;
    }
    // new events
    JsonCallbackEvents newEvents = new JsonCallbackEvents() {

        public void onError(PerunError error) {
            session.getUiElements().setLogErrorText("Allowing of exec service " + execServiceId + " failed.");
            events.onError(error);
        }

        ;

        public void onFinished(JavaScriptObject jso) {
            session.getUiElements().setLogSuccessText("Exec service " + execServiceId + " allowed on facility.");
            events.onFinished(jso);
        }

        ;

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

        ;
    };
    // sending data
    JsonPostClient jspc = new JsonPostClient(newEvents);
    jspc.sendData(JSON_URL, prepareJSONObject());
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) JsonPostClient(cz.metacentrum.perun.webgui.json.JsonPostClient) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Example 15 with PerunError

use of cz.metacentrum.perun.webgui.model.PerunError in project perun by CESNET.

the class RemoveDependency method removeDependency.

/**
	 * Remove dependency for exec service on another exec service
	 *
	 * @param execService remove dependency for
	 * @param dependsOn remove dependency on
	 */
public void removeDependency(int execService, int dependsOn) {
    this.execService = execService;
    this.dependsOn = dependsOn;
    if (!this.testArguments()) {
        return;
    }
    JSONObject jsonQuery = new JSONObject();
    jsonQuery.put("execService", new JSONNumber(execService));
    jsonQuery.put("dependantExecService", new JSONNumber(dependsOn));
    // new events
    JsonCallbackEvents newEvents = new JsonCallbackEvents() {

        public void onError(PerunError error) {
            session.getUiElements().setLogErrorText("Removing dependancy failed.");
            events.onError(error);
        }

        ;

        public void onFinished(JavaScriptObject jso) {
            session.getUiElements().setLogSuccessText("Dependancy sucesfully removed!");
            events.onFinished(jso);
        }

        ;

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

        ;
    };
    // sending data
    JsonPostClient jspc = new JsonPostClient(newEvents);
    jspc.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) JSONNumber(com.google.gwt.json.client.JSONNumber) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Aggregations

PerunError (cz.metacentrum.perun.webgui.model.PerunError)177 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)173 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)167 JsonPostClient (cz.metacentrum.perun.webgui.json.JsonPostClient)126 JSONObject (com.google.gwt.json.client.JSONObject)55 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)36 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)36 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)30 ArrayList (java.util.ArrayList)30 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)27 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)21 JSONNumber (com.google.gwt.json.client.JSONNumber)17 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)16 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)16 ListBoxWithObjects (cz.metacentrum.perun.webgui.widgets.ListBoxWithObjects)15 AjaxLoaderImage (cz.metacentrum.perun.webgui.widgets.AjaxLoaderImage)11 Attribute (cz.metacentrum.perun.webgui.model.Attribute)10 HashMap (java.util.HashMap)10 JSONString (com.google.gwt.json.client.JSONString)8 ExtendedTextBox (cz.metacentrum.perun.webgui.widgets.ExtendedTextBox)8