Search in sources :

Example 1 with I18NNameValidation

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

the class DisksAllocationModel method validateEntity.

@Override
public void validateEntity(IValidation[] validations) {
    super.validateEntity(validations);
    if (getDisks() == null) {
        return;
    }
    boolean isModelValid = true;
    for (DiskModel diskModel : getDisks()) {
        ListModel<StorageDomain> diskStorageDomains = diskModel.getStorageDomain();
        if (!diskStorageDomains.getItems().iterator().hasNext() || diskStorageDomains.getSelectedItem() == null) {
            diskModel.getStorageDomain().getInvalidityReasons().add(constants.storageDomainMustBeSpecifiedInvalidReason());
            diskModel.getStorageDomain().setIsValid(false);
            isModelValid = false;
        }
        diskModel.getAlias().validateEntity(new IValidation[] { new NotEmptyValidation(), new I18NNameValidation() });
        isModelValid = isModelValid && diskModel.getAlias().getIsValid();
    }
    setIsValid(isModelValid);
}
Also used : DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) I18NNameValidation(org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation)

Example 2 with I18NNameValidation

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

the class TagModel method validate.

public boolean validate() {
    LengthValidation tempVar = new LengthValidation();
    tempVar.setMaxLength(40);
    getName().validateEntity(new IValidation[] { new NotEmptyValidation(), tempVar, new I18NNameValidation() });
    return getName().getIsValid();
}
Also used : 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 3 with I18NNameValidation

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

the class AffinityGroupModel method validate.

protected boolean validate() {
    getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(255), new I18NNameValidation() });
    getDescription().validateEntity(new IValidation[] { new AsciiOrNoneValidation() });
    return getName().getIsValid() && getDescription().getIsValid();
}
Also used : AsciiOrNoneValidation(org.ovirt.engine.ui.uicommonweb.validation.AsciiOrNoneValidation) 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 4 with I18NNameValidation

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

the class MoveOrCopyDiskModel method validate.

public boolean validate() {
    boolean quotaValidated = true;
    if (getQuotaEnforcementType() == QuotaEnforcementTypeEnum.DISABLED || getQuotaEnforcementType() == QuotaEnforcementTypeEnum.SOFT_ENFORCEMENT) {
        quotaValidated = false;
    }
    boolean isValid = true;
    for (DiskModel diskModel : getDisks()) {
        if (quotaValidated) {
            diskModel.getQuota().validateSelectedItem(new IValidation[] { new SelectedQuotaValidation() });
            isValid &= diskModel.getQuota().getIsValid();
        }
        diskModel.getAlias().validateEntity(new IValidation[] { new NotEmptyValidation(), new I18NNameValidation() });
        isValid &= diskModel.getAlias().getIsValid();
    }
    return isValid;
}
Also used : DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) SelectedQuotaValidation(org.ovirt.engine.ui.uicommonweb.validation.SelectedQuotaValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) I18NNameValidation(org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation)

Example 5 with I18NNameValidation

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

I18NNameValidation (org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation)6 NotEmptyValidation (org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation)6 LengthValidation (org.ovirt.engine.ui.uicommonweb.validation.LengthValidation)4 DiskModel (org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)1 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)1 AsciiOrNoneValidation (org.ovirt.engine.ui.uicommonweb.validation.AsciiOrNoneValidation)1 SelectedQuotaValidation (org.ovirt.engine.ui.uicommonweb.validation.SelectedQuotaValidation)1 SpecialAsciiI18NOrNoneValidation (org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation)1