Search in sources :

Example 1 with FormValidationException

use of pl.edu.icm.unity.webui.common.FormValidationException in project unity by unity-idm.

the class EditTranslationProfileSubView method initUI.

private void initUI() {
    VerticalLayout main = new VerticalLayout();
    main.addComponent(editor);
    main.addComponent(StandardButtonsHelper.buildConfirmEditButtonsBar(msg, () -> {
        try {
            onConfirm.accept(editor.getProfile());
        } catch (FormValidationException e) {
            NotificationPopup.showError(msg, msg.getMessage("EditTranslationProfileSubView.inconsistentConfiguration"), e);
        }
    }, onCancel));
    setCompositionRoot(main);
}
Also used : FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 2 with FormValidationException

use of pl.edu.icm.unity.webui.common.FormValidationException in project unity by unity-idm.

the class RestAdminServiceEditorComponent method getServiceDefiniton.

ServiceDefinition getServiceDefiniton() throws FormValidationException {
    boolean hasErrors = serviceBinder.validate().hasErrors();
    hasErrors |= restBinder.validate().hasErrors();
    if (hasErrors) {
        setErrorInTabs();
        throw new FormValidationException();
    }
    DefaultServiceDefinition service = serviceBinder.getBean();
    service.setConfiguration(restBinder.getBean().toProperties());
    return service;
}
Also used : FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) DefaultServiceDefinition(pl.edu.icm.unity.webui.console.services.DefaultServiceDefinition)

Example 3 with FormValidationException

use of pl.edu.icm.unity.webui.common.FormValidationException in project unity by unity-idm.

the class EntityCreationDialog method onConfirm.

@Override
protected void onConfirm() {
    final IdentityParam toAdd;
    try {
        toAdd = identityEditor.getValue();
    } catch (IllegalIdentityValueException e) {
        return;
    }
    try {
        newEntityCredentialsPanel.getCredentials();
    } catch (FormValidationRTException e) {
        tabs.setSelectedTab(1);
        NotificationPopup.showFormError(msg, msg.getMessage("EntityCreation.invalidCredential"));
        return;
    }
    Set<String> requiredInRoot;
    try {
        requiredInRoot = groupHelper.getRequiredAttributes("/");
    } catch (EngineException e) {
        return;
    }
    List<Attribute> attrsToAddInRoot;
    try {
        attrsToAddInRoot = getPresetAttributes();
    } catch (FormValidationException e) {
        return;
    }
    for (Attribute a : attrsToAddInRoot) requiredInRoot.remove(a.getName());
    if (requiredInRoot.isEmpty()) {
        doCreate(toAdd, attrsToAddInRoot);
    } else {
        RequiredAttributesDialog attrDialog = new RequiredAttributesDialog(msg, msg.getMessage("EntityCreation.requiredAttributesInfo"), requiredInRoot, groupHelper.getAttrHandlerRegistry(), allTypes, "/", new RequiredAttributesDialog.Callback() {

            @Override
            public void onConfirm(List<Attribute> attributes) {
                doCreate(toAdd, attributes);
            }

            @Override
            public void onCancel() {
            }
        });
        attrDialog.show();
    }
}
Also used : IdentityParam(pl.edu.icm.unity.types.basic.IdentityParam) Attribute(pl.edu.icm.unity.types.basic.Attribute) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) EngineException(pl.edu.icm.unity.exceptions.EngineException) RequiredAttributesDialog(io.imunity.webconsole.directorySetup.attributeClasses.RequiredAttributesDialog) IllegalIdentityValueException(pl.edu.icm.unity.exceptions.IllegalIdentityValueException) FormValidationRTException(pl.edu.icm.unity.webui.common.FormValidationRTException)

Example 4 with FormValidationException

use of pl.edu.icm.unity.webui.common.FormValidationException in project unity by unity-idm.

the class EditAttributeClassView method onConfirm.

private void onConfirm() {
    AttributesClass attrClass;
    try {
        attrClass = editor.getAttributesClass();
    } catch (FormValidationException e) {
        return;
    }
    if (attrClass == null)
        return;
    try {
        controller.updateAttributeClass(attrClass);
    } catch (ControllerException e) {
        NotificationPopup.showError(msg, e);
        return;
    }
    NavigationHelper.goToView(AttributeClassesView.VIEW_NAME);
}
Also used : ControllerException(pl.edu.icm.unity.webui.exceptions.ControllerException) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) AttributesClass(pl.edu.icm.unity.types.basic.AttributesClass)

Example 5 with FormValidationException

use of pl.edu.icm.unity.webui.common.FormValidationException in project unity by unity-idm.

the class NewAttributeClassView method onConfirm.

private void onConfirm() {
    AttributesClass attrClass;
    try {
        attrClass = editor.getAttributesClass();
    } catch (FormValidationException e) {
        return;
    }
    if (attrClass == null)
        return;
    try {
        controller.addAttributeClass(attrClass);
    } catch (ControllerException e) {
        NotificationPopup.showError(msg, e);
        return;
    }
    NavigationHelper.goToView(AttributeClassesView.VIEW_NAME);
}
Also used : ControllerException(pl.edu.icm.unity.webui.exceptions.ControllerException) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) AttributesClass(pl.edu.icm.unity.types.basic.AttributesClass)

Aggregations

FormValidationException (pl.edu.icm.unity.webui.common.FormValidationException)50 ControllerException (pl.edu.icm.unity.webui.exceptions.ControllerException)17 DefaultServiceDefinition (pl.edu.icm.unity.webui.console.services.DefaultServiceDefinition)7 ArrayList (java.util.ArrayList)5 Attribute (pl.edu.icm.unity.types.basic.Attribute)5 VaadinEndpointProperties (pl.edu.icm.unity.webui.VaadinEndpointProperties)5 UserError (com.vaadin.server.UserError)4 TranslationRule (pl.edu.icm.unity.types.translation.TranslationRule)4 EngineException (pl.edu.icm.unity.exceptions.EngineException)3 ScheduledProcessingRuleParam (pl.edu.icm.unity.types.bulkops.ScheduledProcessingRuleParam)3 EnquiryForm (pl.edu.icm.unity.types.registration.EnquiryForm)3 RegistrationForm (pl.edu.icm.unity.types.registration.RegistrationForm)3 TranslationProfile (pl.edu.icm.unity.types.translation.TranslationProfile)3 AuthenticatorDefinition (pl.edu.icm.unity.types.authn.AuthenticatorDefinition)2 AttributesClass (pl.edu.icm.unity.types.basic.AttributesClass)2 IdentityParam (pl.edu.icm.unity.types.basic.IdentityParam)2 IdentityType (pl.edu.icm.unity.types.basic.IdentityType)2 FixedAttributeEditor (pl.edu.icm.unity.webui.common.attributes.edit.FixedAttributeEditor)2 AbstractOrderedLayout (com.vaadin.ui.AbstractOrderedLayout)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1