Search in sources :

Example 1 with NonNegativeLongNumberValidation

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

Aggregations

DiskStorageType (org.ovirt.engine.core.common.businessentities.storage.DiskStorageType)1 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)1 IntegerValidation (org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)1 NonNegativeLongNumberValidation (org.ovirt.engine.ui.uicommonweb.validation.NonNegativeLongNumberValidation)1 NotEmptyValidation (org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation)1