Search in sources :

Example 1 with CreateApplication

use of cz.metacentrum.perun.webgui.json.registrarManager.CreateApplication in project perun by CESNET.

the class ApplicationFormPage method sendForm.

/**
	 * Send form
	 */
protected void sendForm(final CustomButton button) {
    PerunPrincipal pp = session.getPerunPrincipal();
    // fed info
    String fedInfo = "";
    fedInfo += "{";
    fedInfo += " displayName=\"" + pp.getAdditionInformations("displayName") + "\"";
    fedInfo += " commonName=\"" + pp.getAdditionInformations("cn") + "\"";
    fedInfo += " givenName=\"" + pp.getAdditionInformations("givenName") + "\"";
    fedInfo += " sureName=\"" + pp.getAdditionInformations("sn") + "\"";
    fedInfo += " loa=\"" + pp.getAdditionInformations("loa") + "\"";
    fedInfo += " mail=\"" + pp.getAdditionInformations("mail") + "\"";
    fedInfo += " organization=\"" + pp.getAdditionInformations("o") + "\"";
    fedInfo += " }";
    Application app = Application.construct(vo, group, type, fedInfo, pp.getActor(), pp.getExtSource(), pp.getExtSourceType(), pp.getExtSourceLoa());
    if (session.getUser() != null) {
        // set user association if known from perun
        app.setUser(session.getUser());
    }
    // loading
    final PopupPanel loadingBox = session.getUiElements().perunLoadingBox(ApplicationMessages.INSTANCE.processing());
    // Create application request
    CreateApplication ca = new CreateApplication(JsonCallbackEvents.disableButtonEvents(button, new JsonCallbackEvents() {

        @Override
        public void onLoadingStart() {
            // show loading box
            loadingBox.show();
        }

        @Override
        public void onFinished(JavaScriptObject jso) {
            loadingBox.hide();
            formOk(jso);
        }

        @Override
        public void onError(PerunError err) {
            loadingBox.hide();
            formError(err);
        }
    }));
    // Send the request
    ca.createApplication(app, data);
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) CreateApplication(cz.metacentrum.perun.webgui.json.registrarManager.CreateApplication) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) JSONString(com.google.gwt.json.client.JSONString) CreateApplication(cz.metacentrum.perun.webgui.json.registrarManager.CreateApplication)

Aggregations

JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)1 JSONString (com.google.gwt.json.client.JSONString)1 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)1 CreateApplication (cz.metacentrum.perun.webgui.json.registrarManager.CreateApplication)1