Search in sources :

Example 21 with LengthValidation

use of org.ovirt.engine.ui.uicommonweb.validation.LengthValidation 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 22 with LengthValidation

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

the class DataCenterModel method validate.

public boolean validate() {
    getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(40), new LengthValidation(getMaxNameLength()), new AsciiNameValidation() });
    getVersion().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
    getDescription().validateEntity(new IValidation[] { new AsciiOrNoneValidation() });
    getComment().validateEntity(new IValidation[] { new SpecialAsciiI18NOrNoneValidation() });
    boolean validationResult = getName().getIsValid() && getDescription().getIsValid() && getComment().getIsValid() && getVersion().getIsValid();
    return validationResult;
}
Also used : AsciiOrNoneValidation(org.ovirt.engine.ui.uicommonweb.validation.AsciiOrNoneValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) AsciiNameValidation(org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation) SpecialAsciiI18NOrNoneValidation(org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation)

Example 23 with LengthValidation

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

the class IscsiBondModel method validate.

private boolean validate() {
    getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new I18NNameValidation(), new LengthValidation(50) });
    getDescription().validateEntity(new IValidation[] { new SpecialAsciiI18NOrNoneValidation(), new LengthValidation(4000) });
    if (getNetworks().getSelectedItems() == null || getNetworks().getSelectedItems().isEmpty()) {
        getInvalidityReasons().add(constants.noNetworksSelected());
        setIsValid(false);
    } else {
        setIsValid(true);
    }
    return getName().getIsValid() && getDescription().getIsValid() && getIsValid();
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) SpecialAsciiI18NOrNoneValidation(org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) I18NNameValidation(org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation)

Example 24 with LengthValidation

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

the class VolumeModel method validate.

public boolean validate() {
    if (!validateBrickCount()) {
        setMessage(VolumeBrickModel.getValidationFailedMsg(getTypeList().getSelectedItem(), true));
        return false;
    }
    getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(50), new AsciiNameValidation() });
    setMessage(null);
    boolean validTransportTypes = true;
    if (!getTcpTransportType().getEntity() && !getRdmaTransportType().getEntity()) {
        validTransportTypes = false;
        setMessage(ConstantsManager.getInstance().getConstants().volumeTransportTypesValidationMsg());
    }
    return getName().getIsValid() && validTransportTypes;
}
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)

Example 25 with LengthValidation

use of org.ovirt.engine.ui.uicommonweb.validation.LengthValidation 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

LengthValidation (org.ovirt.engine.ui.uicommonweb.validation.LengthValidation)31 NotEmptyValidation (org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation)31 IntegerValidation (org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)9 SpecialAsciiI18NOrNoneValidation (org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation)7 AsciiNameValidation (org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation)6 HostAddressValidation (org.ovirt.engine.ui.uicommonweb.validation.HostAddressValidation)6 I18NNameValidation (org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation)4 AsciiOrNoneValidation (org.ovirt.engine.ui.uicommonweb.validation.AsciiOrNoneValidation)3 HostnameValidation (org.ovirt.engine.ui.uicommonweb.validation.HostnameValidation)2 I18NExtraNameOrNoneValidation (org.ovirt.engine.ui.uicommonweb.validation.I18NExtraNameOrNoneValidation)2 IValidation (org.ovirt.engine.ui.uicommonweb.validation.IValidation)2 MatchFieldsValidator (org.ovirt.engine.ui.uicommonweb.validation.MatchFieldsValidator)2 RegexValidation (org.ovirt.engine.ui.uicommonweb.validation.RegexValidation)2 Map (java.util.Map)1 SortedMap (java.util.SortedMap)1 TreeMap (java.util.TreeMap)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 VmInitNetwork (org.ovirt.engine.core.common.businessentities.VmInitNetwork)1 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)1 NewVnicProfileModel (org.ovirt.engine.ui.uicommonweb.models.profiles.NewVnicProfileModel)1