Search in sources :

Example 26 with LengthValidation

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

the class GlusterVolumeGeoRepCreateModel method validate.

public boolean validate() {
    getSlaveVolumes().validateSelectedItem(new IValidation[] { new NotEmptyValidation(), new LengthValidation(128) });
    getSlaveHosts().validateSelectedItem(new IValidation[] { new NotEmptyValidation(), new LengthValidation(128) });
    return getSlaveVolumes().getIsValid() && getSlaveHosts().getIsValid();
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation)

Example 27 with LengthValidation

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

the class ImportVmModel method validateName.

private boolean validateName(final ImportVmData data) {
    final int maxNameLength = getMaxNameLength();
    VmImportGeneralModel model = (VmImportGeneralModel) getDetailModels().get(0);
    EntityModel<String> vmName = new EntityModel<>(data.getVm().getName());
    vmName.validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(maxNameLength), new I18NNameValidation(), new UniqueNameValidator(data), value -> isNameExistsInTheSystem(vmName.getEntity()) ? ValidationResult.fail(ConstantsManager.getInstance().getConstants().nameMustBeUniqueInvalidReason()) : ValidationResult.ok() });
    data.setError(vmName.getIsValid() ? null : ConstantsManager.getInstance().getConstants().invalidName());
    // Updating the 'name' model in general sub-tab
    model.getName().setInvalidityReasons(vmName.getInvalidityReasons());
    model.getName().setIsValid(vmName.getIsValid());
    return vmName.getIsValid();
}
Also used : EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) I18NNameValidation(org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation)

Example 28 with LengthValidation

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

the class ImportVmsModel method validateVmwareConfiguration.

private boolean validateVmwareConfiguration() {
    getvCenter().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(255), new HostAddressValidation() });
    getEsx().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(255), new HostAddressValidation() });
    getVmwareDatacenter().validateEntity(new IValidation[] { new NotEmptyValidation() });
    getUsername().validateEntity(new IValidation[] { new NotEmptyValidation(), new NameAndOptionalDomainValidation() });
    getPassword().validateEntity(new IValidation[] { new NotEmptyValidation() });
    return getvCenter().getIsValid() && getEsx().getIsValid() && getVmwareDatacenter().getIsValid() && getUsername().getIsValid() && getPassword().getIsValid();
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) HostAddressValidation(org.ovirt.engine.ui.uicommonweb.validation.HostAddressValidation) NameAndOptionalDomainValidation(org.ovirt.engine.ui.uicommonweb.validation.NameAndOptionalDomainValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation)

Example 29 with LengthValidation

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

the class ImportVmsModel method validateKvmConfiguration.

private boolean validateKvmConfiguration() {
    getKvmUri().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(255) });
    getKvmUsername().validateEntity(new IValidation[] { new NotEmptyValidation() });
    getKvmPassword().validateEntity(new IValidation[] { new NotEmptyValidation() });
    return getKvmUri().getIsValid() && getKvmUsername().getIsValid() && getKvmPassword().getIsValid();
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation)

Example 30 with LengthValidation

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

the class UnitVmModel method validateNaming.

private boolean validateNaming() {
    getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(getBehavior().getMaxNameLength()), getBehavior().getNameAllowedCharactersIValidation() });
    getDescription().validateEntity(new IValidation[] { new LengthValidation(DESCRIPTION_MAX_LIMIT), new SpecialAsciiI18NOrNoneValidation() });
    final boolean isValid = getName().getIsValid() && getDescription().getIsValid();
    setValidTab(TabName.GENERAL_TAB, isValidTab(TabName.GENERAL_TAB) && isValid);
    return isValid;
}
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)

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