Search in sources :

Example 1 with NotEmptyValidation

use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.

the class ClusterModel method validate.

public boolean validate() {
    validateName();
    getDataCenter().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
    getCustomPropertySheet().setIsValid(getCustomPropertySheet().validate());
    setValidTab(TabName.CLUSTER_POLICY_TAB, getCustomPropertySheet().getIsValid());
    final IValidation[] versionValidations = new IValidation[] { new NotEmptyValidation() };
    getVersion().validateSelectedItem(versionValidations);
    getManagementNetwork().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
    getRngHwrngSourceRequired().setIsValid(true);
    boolean validService = true;
    if (getEnableOvirtService().getIsAvailable() && getEnableGlusterService().getIsAvailable()) {
        validService = getEnableOvirtService().getEntity() || getEnableGlusterService().getEntity();
    }
    getGlusterHostAddress().validateEntity(new IValidation[] { new NotEmptyValidation() });
    getGlusterHostPassword().validateEntity(new IValidation[] { new NotEmptyValidation() });
    if (!validService) {
        setMessage(ConstantsManager.getInstance().getConstants().clusterServiceValidationMsg());
    } else if (getIsImportGlusterConfiguration().getEntity() && getGlusterHostAddress().getIsValid() && getGlusterHostPassword().getIsValid() && !isFingerprintVerified()) {
        setMessage(ConstantsManager.getInstance().getConstants().fingerprintNotVerified());
    } else {
        setMessage(null);
    }
    if (getSpiceProxyEnabled().getEntity()) {
        getSpiceProxy().validateEntity(new IValidation[] { new HostWithProtocolAndPortAddressValidation() });
    } else {
        getSpiceProxy().setIsValid(true);
    }
    setValidTab(TabName.CONSOLE_TAB, getSpiceProxy().getIsValid());
    if (getSerialNumberPolicy().getSelectedSerialNumberPolicy() == SerialNumberPolicy.CUSTOM) {
        getSerialNumberPolicy().getCustomSerialNumber().validateEntity(new IValidation[] { new NotEmptyValidation() });
    } else {
        getSerialNumberPolicy().getCustomSerialNumber().setIsValid(true);
    }
    getMacPoolModel().validate();
    boolean generalTabValid = getName().getIsValid() && getDataCenter().getIsValid() && getCPU().getIsValid() && getManagementNetwork().getIsValid() && getVersion().getIsValid() && validService && getGlusterHostAddress().getIsValid() && getRngHwrngSourceRequired().getIsValid() && getGlusterHostPassword().getIsValid() && (!getIsImportGlusterConfiguration().getEntity() || (getGlusterHostAddress().getIsValid() && getGlusterHostPassword().getIsValid() && getSerialNumberPolicy().getCustomSerialNumber().getIsValid() && isFingerprintVerified()));
    setValidTab(TabName.GENERAL_TAB, generalTabValid);
    if (getVersion().getSelectedItem() != null) {
        if (AsyncDataProvider.getInstance().isMigrationPoliciesSupported(getVersion().getSelectedItem()) && MigrationBandwidthLimitType.CUSTOM.equals(getMigrationBandwidthLimitType().getSelectedItem())) {
            getCustomMigrationNetworkBandwidth().validateEntity(new IValidation[] { new NotNullIntegerValidation(0, Integer.MAX_VALUE) });
        } else {
            getCustomMigrationNetworkBandwidth().setIsValid(true);
        }
    }
    final boolean migrationTabValid = getMigrationBandwidthLimitType().getIsValid() && getCustomMigrationNetworkBandwidth().getIsValid();
    setValidTab(TabName.MIGRATION_TAB, migrationTabValid);
    boolean macPoolTabValid = getMacPoolModel().getIsValid();
    setValidTab(TabName.MAC_POOL_TAB, macPoolTabValid);
    ValidationCompleteEvent.fire(getEventBus(), this);
    return generalTabValid && macPoolTabValid && getCustomPropertySheet().getIsValid() && getSpiceProxy().getIsValid() && migrationTabValid;
}
Also used : IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) HostWithProtocolAndPortAddressValidation(org.ovirt.engine.ui.uicommonweb.validation.HostWithProtocolAndPortAddressValidation) NotNullIntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.NotNullIntegerValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation)

Example 2 with NotEmptyValidation

use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.

the class BookmarkModel method validate.

public boolean validate() {
    LengthValidation tempVar = new LengthValidation();
    tempVar.setMaxLength(40);
    getName().validateEntity(new IValidation[] { new NotEmptyValidation(), tempVar });
    LengthValidation tempVar2 = new LengthValidation();
    tempVar2.setMaxLength(300);
    getSearchString().validateEntity(new IValidation[] { new NotEmptyValidation(), tempVar2 });
    return getName().getIsValid() && getSearchString().getIsValid();
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation)

Example 3 with NotEmptyValidation

use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.

the class LoginModel method validate.

protected boolean validate() {
    getUserName().validateEntity(new IValidation[] { new NotEmptyValidation() });
    getProfile().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
    return getUserName().getIsValid() && getProfile().getIsValid();
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation)

Example 4 with NotEmptyValidation

use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.

the class DisksAllocationModel method validateEntity.

@Override
public void validateEntity(IValidation[] validations) {
    super.validateEntity(validations);
    if (getDisks() == null) {
        return;
    }
    boolean isModelValid = true;
    for (DiskModel diskModel : getDisks()) {
        ListModel<StorageDomain> diskStorageDomains = diskModel.getStorageDomain();
        if (!diskStorageDomains.getItems().iterator().hasNext() || diskStorageDomains.getSelectedItem() == null) {
            diskModel.getStorageDomain().getInvalidityReasons().add(constants.storageDomainMustBeSpecifiedInvalidReason());
            diskModel.getStorageDomain().setIsValid(false);
            isModelValid = false;
        }
        diskModel.getAlias().validateEntity(new IValidation[] { new NotEmptyValidation(), new I18NNameValidation() });
        isModelValid = isModelValid && diskModel.getAlias().getIsValid();
    }
    setIsValid(isModelValid);
}
Also used : DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) I18NNameValidation(org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation)

Example 5 with NotEmptyValidation

use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.

the class GlusterStorageModel method validate.

@Override
public boolean validate() {
    getGlusterVolumes().validateSelectedItem(new IValidation[] { new NotEmptyValidation(), new LengthValidation(128) });
    getVfsType().validateEntity(new IValidation[] { new NotEmptyValidation(), new AsciiNameValidation() });
    if (getLinkGlusterVolume().getEntity()) {
        return getGlusterVolumes().getIsValid() && getVfsType().getIsValid();
    } else {
        return super.validate();
    }
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) AsciiNameValidation(org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation)

Aggregations

NotEmptyValidation (org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation)66 LengthValidation (org.ovirt.engine.ui.uicommonweb.validation.LengthValidation)31 IntegerValidation (org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)21 AsciiNameValidation (org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation)11 SpecialAsciiI18NOrNoneValidation (org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation)9 HostAddressValidation (org.ovirt.engine.ui.uicommonweb.validation.HostAddressValidation)7 IValidation (org.ovirt.engine.ui.uicommonweb.validation.IValidation)7 AsciiOrNoneValidation (org.ovirt.engine.ui.uicommonweb.validation.AsciiOrNoneValidation)6 RegexValidation (org.ovirt.engine.ui.uicommonweb.validation.RegexValidation)6 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)4 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)4 I18NNameValidation (org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation)4 ArrayList (java.util.ArrayList)3 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)3 Arrays (java.util.Arrays)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Set (java.util.Set)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)2