Search in sources :

Example 6 with IValidation

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

the class HostNetworkQosParametersModel method getOutLinkshareValidations.

protected Collection<IValidation> getOutLinkshareValidations() {
    Collection<IValidation> validations = new ArrayList<>();
    validations.add(new IntegerValidation(1, (Integer) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigValues.MaxHostNetworkQosShares)));
    return validations;
}
Also used : IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) ArrayList(java.util.ArrayList) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)

Example 7 with IValidation

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

the class QuotaModel method validate.

public boolean validate() {
    LengthValidation lenValidation = new LengthValidation();
    lenValidation.setMaxLength(60);
    getName().setIsValid(true);
    getName().validateEntity(new IValidation[] { new NotEmptyValidation(), lenValidation });
    IValidation[] graceValidationArr = new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, Integer.MAX_VALUE) };
    IValidation[] thresholdValidationArr = new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, 100) };
    getGraceCluster().validateEntity(graceValidationArr);
    getGraceStorage().validateEntity(graceValidationArr);
    getThresholdCluster().validateEntity(thresholdValidationArr);
    getThresholdStorage().validateEntity(thresholdValidationArr);
    boolean graceThreshold = getGraceCluster().getIsValid() & getGraceStorage().getIsValid() & getThresholdCluster().getIsValid() & getThresholdStorage().getIsValid();
    return getName().getIsValid() & graceThreshold & validateNotEmpty();
}
Also used : IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)

Example 8 with IValidation

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

Aggregations

IValidation (org.ovirt.engine.ui.uicommonweb.validation.IValidation)8 NotEmptyValidation (org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation)7 ArrayList (java.util.ArrayList)4 IntegerValidation (org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)3 RegexValidation (org.ovirt.engine.ui.uicommonweb.validation.RegexValidation)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 ActionType (org.ovirt.engine.core.common.action.ActionType)2 AddSANStorageDomainParameters (org.ovirt.engine.core.common.action.AddSANStorageDomainParameters)2 AttachStorageDomainToPoolParameters (org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters)2 StorageDomainManagementParameter (org.ovirt.engine.core.common.action.StorageDomainManagementParameter)2 StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 StorageDomainSharedStatus (org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus)2 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)2 StorageDomainStatus (org.ovirt.engine.core.common.businessentities.StorageDomainStatus)2