Search in sources :

Example 51 with NotEmptyValidation

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

the class StorageModel method validateListItems.

private void validateListItems(ListModel<?> listModel) {
    ValidationResult result = new NotEmptyValidation().validate(listModel.getSelectedItem());
    listModel.setIsValid(result.getSuccess());
    listModel.getInvalidityReasons().addAll(result.getReasons());
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) ValidationResult(org.ovirt.engine.ui.uicommonweb.validation.ValidationResult)

Example 52 with NotEmptyValidation

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

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

the class ExportOvaModel method validate.

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

Example 54 with NotEmptyValidation

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

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

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