Search in sources :

Example 16 with IntegerValidation

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

the class StorageDRModel method validate.

public boolean validate() {
    getGeoRepSession().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
    getFrequency().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
    getHour().validateSelectedItem(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, MAX_HOUR) });
    getMins().validateSelectedItem(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, MAX_MINUTE) });
    boolean ret = getGeoRepSession().getIsValid() && getFrequency().getIsValid();
    if (!getFrequency().getSelectedItem().equals(Frequency.NONE)) {
        return ret && getHour().getIsValid() && getMins().getIsValid();
    }
    return ret;
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)

Example 17 with IntegerValidation

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

the class QuotaModel method validate.

public boolean validate() {
    LengthValidation lenValidation = new LengthValidation();
    lenValidation.setMaxLength(60);
    getName().setIsValid(true);
    getName().validateEntity(new IValidation[] { new NotEmptyValidation(), lenValidation });
    IValidation[] graceValidationArr = new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, Integer.MAX_VALUE) };
    IValidation[] thresholdValidationArr = new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, 100) };
    getGraceCluster().validateEntity(graceValidationArr);
    getGraceStorage().validateEntity(graceValidationArr);
    getThresholdCluster().validateEntity(thresholdValidationArr);
    getThresholdStorage().validateEntity(thresholdValidationArr);
    boolean graceThreshold = getGraceCluster().getIsValid() & getGraceStorage().getIsValid() & getThresholdCluster().getIsValid() & getThresholdStorage().getIsValid();
    return getName().getIsValid() & graceThreshold & validateNotEmpty();
}
Also used : IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)

Example 18 with IntegerValidation

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

the class NeutronAgentModel method validate.

public boolean validate() {
    if (getIsAvailable()) {
        getPluginType().validateSelectedItem(new IValidation[] { pluginValidator });
        getBrokerType().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
        getInterfaceMappings().validateEntity(new IValidation[] { new InterfaceMappingsValidation() });
        getMessagingServer().validateEntity(new IValidation[] { new HostAddressValidation(true, true) });
        getMessagingServerPort().validateEntity(new IValidation[] { new IntegerValidation(BusinessEntitiesDefinitions.NETWORK_MIN_LEGAL_PORT, BusinessEntitiesDefinitions.NETWORK_MAX_LEGAL_PORT) });
        setIsValid(getPluginType().getIsValid() && getInterfaceMappings().getIsValid() && getMessagingServer().getIsValid() && getMessagingServerPort().getIsValid() && getBrokerType().getIsValid());
    }
    return getIsValid();
}
Also used : InterfaceMappingsValidation(org.ovirt.engine.ui.uicommonweb.validation.InterfaceMappingsValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) HostAddressValidation(org.ovirt.engine.ui.uicommonweb.validation.HostAddressValidation) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)

Example 19 with IntegerValidation

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

the class EditDiskModel method validate.

@Override
public boolean validate() {
    StorageType storageType = getStorageDomain().getSelectedItem() == null ? StorageType.UNKNOWN : getStorageDomain().getSelectedItem().getStorageType();
    IntegerValidation sizeValidation = new IntegerValidation();
    if (storageType.isBlockDomain()) {
        Integer maxBlockDiskSize = (Integer) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigValues.MaxBlockDiskSize);
        sizeValidation.setMaximum(maxBlockDiskSize - getSize().getEntity());
    }
    getSizeExtend().validateEntity(new IValidation[] { new NotEmptyValidation(), new NonNegativeLongNumberValidation(), sizeValidation });
    return super.validate() && getSizeExtend().getIsValid();
}
Also used : StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) NonNegativeLongNumberValidation(org.ovirt.engine.ui.uicommonweb.validation.NonNegativeLongNumberValidation) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)

Example 20 with IntegerValidation

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

the class CreateBrickModel method validate.

public boolean validate() {
    getLvName().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(50), new AsciiNameValidation() });
    if (!getLvName().getIsValid()) {
        return false;
    }
    getMountPoint().validateEntity(new IValidation[] { new NotEmptyValidation(), new BrickMountPointValidation() });
    if (!getMountPoint().getIsValid()) {
        return false;
    }
    IntegerValidation noOfPhysicalDiscsValidation = new IntegerValidation();
    noOfPhysicalDiscsValidation.setMinimum(1);
    getNoOfPhysicalDisksInRaidVolume().validateEntity(new IValidation[] { new NotEmptyValidation(), noOfPhysicalDiscsValidation });
    if (!getNoOfPhysicalDisksInRaidVolume().getIsValid()) {
        return false;
    }
    IntegerValidation stripSizeValidation = new IntegerValidation();
    stripSizeValidation.setMinimum(1);
    getStripeSize().validateEntity(new IValidation[] { new NotEmptyValidation(), stripSizeValidation });
    if (!getStripeSize().getIsValid()) {
        return false;
    }
    return true;
}
Also used : BrickMountPointValidation(org.ovirt.engine.ui.uicommonweb.validation.BrickMountPointValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) AsciiNameValidation(org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)

Aggregations

IntegerValidation (org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)22 NotEmptyValidation (org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation)21 LengthValidation (org.ovirt.engine.ui.uicommonweb.validation.LengthValidation)9 HostAddressValidation (org.ovirt.engine.ui.uicommonweb.validation.HostAddressValidation)4 IValidation (org.ovirt.engine.ui.uicommonweb.validation.IValidation)3 SpecialAsciiI18NOrNoneValidation (org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation)3 DiskStorageType (org.ovirt.engine.core.common.businessentities.storage.DiskStorageType)2 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)2 AsciiNameValidation (org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation)2 HostnameValidation (org.ovirt.engine.ui.uicommonweb.validation.HostnameValidation)2 Ipv4AddressValidation (org.ovirt.engine.ui.uicommonweb.validation.Ipv4AddressValidation)2 Ipv6AddressValidation (org.ovirt.engine.ui.uicommonweb.validation.Ipv6AddressValidation)2 SubnetMaskValidation (org.ovirt.engine.ui.uicommonweb.validation.SubnetMaskValidation)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 SortedMap (java.util.SortedMap)1 TreeMap (java.util.TreeMap)1 VmInitNetwork (org.ovirt.engine.core.common.businessentities.VmInitNetwork)1 NewVnicProfileModel (org.ovirt.engine.ui.uicommonweb.models.profiles.NewVnicProfileModel)1 VnicProfileModel (org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel)1