Search in sources :

Example 46 with NotEmptyValidation

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

the class LibvirtSecretModel method validate.

public boolean validate() {
    getUsageType().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
    getUuid().validateEntity(new IValidation[] { new NotEmptyValidation(), new GuidValidation() });
    ArrayList<IValidation> valueValidations = new ArrayList<>(Collections.singletonList(new RegexValidation(ValidationUtils.BASE_64_PATTERN, ConstantsManager.getInstance().getConstants().secretValueMustBeInBase64())));
    if (isNew()) {
        valueValidations.add(new NotEmptyValidation());
        getValue().validateEntity(valueValidations.toArray(new IValidation[valueValidations.size()]));
    }
    return getUsageType().getIsValid() && getUuid().getIsValid() && getValue().getIsValid();
}
Also used : GuidValidation(org.ovirt.engine.ui.uicommonweb.validation.GuidValidation) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) RegexValidation(org.ovirt.engine.ui.uicommonweb.validation.RegexValidation) ArrayList(java.util.ArrayList) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation)

Example 47 with NotEmptyValidation

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

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

the class PosixStorageModel method validate.

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

Example 49 with NotEmptyValidation

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

the class NeutronAgentModel method validate.

public boolean validate() {
    if (getIsAvailable()) {
        getPluginType().validateSelectedItem(new IValidation[] { pluginValidator });
        getBrokerType().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
        getInterfaceMappings().validateEntity(new IValidation[] { new InterfaceMappingsValidation() });
        getMessagingServer().validateEntity(new IValidation[] { new HostAddressValidation(true, true) });
        getMessagingServerPort().validateEntity(new IValidation[] { new IntegerValidation(BusinessEntitiesDefinitions.NETWORK_MIN_LEGAL_PORT, BusinessEntitiesDefinitions.NETWORK_MAX_LEGAL_PORT) });
        setIsValid(getPluginType().getIsValid() && getInterfaceMappings().getIsValid() && getMessagingServer().getIsValid() && getMessagingServerPort().getIsValid() && getBrokerType().getIsValid());
    }
    return getIsValid();
}
Also used : InterfaceMappingsValidation(org.ovirt.engine.ui.uicommonweb.validation.InterfaceMappingsValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) HostAddressValidation(org.ovirt.engine.ui.uicommonweb.validation.HostAddressValidation) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)

Example 50 with NotEmptyValidation

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

the class ProviderModel method validate.

private boolean validate() {
    getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new AsciiNameValidation() });
    getType().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
    getNeutronAgentModel().validate();
    getVmwarePropertiesModel().validate();
    getKvmPropertiesModel().validate();
    getXenPropertiesModel().validate();
    boolean connectionSettingsValid = validateConnectionSettings();
    return connectionSettingsValid && getName().getIsValid() && getType().getIsValid() && getNeutronAgentModel().getIsValid() && getKvmPropertiesModel().getIsValid() && getXenPropertiesModel().getIsValid() && getVmwarePropertiesModel().getIsValid();
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) AsciiNameValidation(org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation)

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