Search in sources :

Example 6 with NotEmptyValidation

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

the class NfsStorageModel method validate.

@Override
public boolean validate() {
    getPath().validateEntity(new IValidation[] { new NotEmptyValidation(), new LinuxMountPointValidation(), new NonUtfValidation(), new NoSpacesValidation() });
    if (getRetransmissions().getIsValid()) {
        getRetransmissions().validateEntity(new IValidation[] { new IntegerValidation(0, RETRANS_MAX) });
    }
    if (getTimeout().getIsValid()) {
        getTimeout().validateEntity(new IValidation[] { new IntegerValidation(1, TIMEOUT_MAX) });
    }
    getMountOptions().validateEntity(new IValidation[] { new NonUtfValidation() });
    return getPath().getIsValid() && getRetransmissions().getIsValid() && getTimeout().getIsValid() && getMountOptions().getIsValid();
}
Also used : LinuxMountPointValidation(org.ovirt.engine.ui.uicommonweb.validation.LinuxMountPointValidation) NoSpacesValidation(org.ovirt.engine.ui.uicommonweb.validation.NoSpacesValidation) NonUtfValidation(org.ovirt.engine.ui.uicommonweb.validation.NonUtfValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)

Example 7 with NotEmptyValidation

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

the class ProviderModel method validateConnectionSettings.

private boolean validateConnectionSettings() {
    getUsername().validateEntity(new IValidation[] { new NotEmptyValidation() });
    getPassword().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(200) });
    if (getType().getSelectedItem().isTenantRequired()) {
        getTenantName().validateEntity(new IValidation[] { new NotEmptyValidation() });
    }
    getAuthUrl().validateEntity(new IValidation[] { new NotEmptyValidation(), new UrlValidation(Uri.SCHEME_HTTP, Uri.SCHEME_HTTPS) });
    getUrl().validateEntity(new IValidation[] { new NotEmptyValidation(), new UrlValidation(Uri.SCHEME_HTTP, Uri.SCHEME_HTTPS) });
    return (getUrl().getEntity() == null || getUrl().getIsValid() || getUrl().getEntity().isEmpty()) && getUsername().getIsValid() && getPassword().getIsValid() && getTenantName().getIsValid() && getAuthUrl().getIsValid();
}
Also used : UrlValidation(org.ovirt.engine.ui.uicommonweb.validation.UrlValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation)

Example 8 with NotEmptyValidation

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

the class VmwarePropertiesModel method validate.

public boolean validate() {
    if (!getIsAvailable()) {
        setIsValid(true);
    } else {
        getvCenter().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(255), new HostAddressValidation() });
        getEsx().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(255), new HostAddressValidation() });
        vmwareDatacenter.validateEntity(new IValidation[] { new NotEmptyValidation() });
        setIsValid(getvCenter().getIsValid() && getEsx().getIsValid() && getVmwareDatacenter().getIsValid());
    }
    return getIsValid();
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) HostAddressValidation(org.ovirt.engine.ui.uicommonweb.validation.HostAddressValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation)

Example 9 with NotEmptyValidation

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

the class ProfileBaseModel method validate.

public boolean validate() {
    getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new SpecialAsciiI18NOrNoneValidation() });
    getDescription().validateEntity(new IValidation[] { new AsciiOrNoneValidation() });
    return getName().getIsValid();
}
Also used : AsciiOrNoneValidation(org.ovirt.engine.ui.uicommonweb.validation.AsciiOrNoneValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) SpecialAsciiI18NOrNoneValidation(org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation)

Example 10 with NotEmptyValidation

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

the class ExternalSubnetModel method validate.

public boolean validate() {
    getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new AsciiNameValidation() });
    boolean ipv4 = getIpVersion().getSelectedItem() == IpVersion.IPV4;
    getCidr().validateEntity(new IValidation[] { ipv4 ? new CidrValidation() : new NotEmptyValidation() });
    getIpVersion().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
    getGateway().setIsValid(true);
    if (StringHelper.isNotNullOrEmpty(getGateway().getEntity()) && ipv4) {
        getGateway().validateEntity(new IValidation[] { new Ipv4AddressValidation() });
    }
    boolean dnsServersValid = true;
    for (EntityModel<String> dnsServer : getDnsServers().getItems()) {
        dnsServer.setIsValid(true);
        if (StringHelper.isNotNullOrEmpty(dnsServer.getEntity()) && ipv4) {
            dnsServer.validateEntity(new IValidation[] { new Ipv4AddressValidation() });
        }
        dnsServersValid &= dnsServer.getIsValid();
    }
    return getName().getIsValid() && getCidr().getIsValid() && getIpVersion().getIsValid() && getGateway().getIsValid() && dnsServersValid;
}
Also used : CidrValidation(org.ovirt.engine.ui.uicommonweb.validation.CidrValidation) Ipv4AddressValidation(org.ovirt.engine.ui.uicommonweb.validation.Ipv4AddressValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) AsciiNameValidation(org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation)

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