Search in sources :

Example 6 with IntegerValidation

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

the class StorageModel method validate.

public boolean validate() {
    validateListItems(getHost());
    validateListItems(getAvailableStorageDomainTypeItems());
    validateListItems(getAvailableStorageTypeItems());
    getDescription().validateEntity(new IValidation[] { new LengthValidation(BusinessEntitiesDefinitions.GENERAL_MAX_SIZE), new SpecialAsciiI18NOrNoneValidation() });
    getComment().validateEntity(new IValidation[] { new SpecialAsciiI18NOrNoneValidation() });
    getWarningLowSpaceIndicator().validateEntity(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, StorageConstants.LOW_SPACE_THRESHOLD) });
    getCriticalSpaceActionBlocker().validateEntity(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, Integer.MAX_VALUE) });
    validateDiscardAfterDelete();
    return getName().getIsValid() && getHost().getIsValid() && getIsValid() && getCurrentStorageItem().validate() && getDescription().getIsValid() && getComment().getIsValid() && getWarningLowSpaceIndicator().getIsValid() && getCriticalSpaceActionBlocker().getIsValid() && getDiscardAfterDelete().getIsValid() && getBackup().getIsValid();
}
Also used : SpecialAsciiI18NOrNoneValidation(org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation) 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 7 with IntegerValidation

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

the class NetworkModel method validate.

private boolean validate() {
    LengthValidation tempVar = new LengthValidation();
    tempVar.setMaxLength(BusinessEntitiesDefinitions.NETWORK_NAME_SIZE);
    RegexValidation tempVar2 = new RegexValidation();
    tempVar2.setIsNegate(true);
    // $NON-NLS-1$
    tempVar2.setExpression("^(bond)");
    tempVar2.setMessage(ConstantsManager.getInstance().getConstants().networkNameStartMsg());
    getName().validateEntity(new IValidation[] { new NotEmptyValidation(), tempVar, tempVar2 });
    LengthValidation tempVar3 = new LengthValidation();
    tempVar3.setMaxLength(40);
    getDescription().validateEntity(new IValidation[] { tempVar3 });
    getComment().validateEntity(new IValidation[] { new SpecialAsciiI18NOrNoneValidation() });
    getVLanTag().setIsValid(true);
    if (getHasVLanTag().getEntity()) {
        IntegerValidation tempVar4 = new IntegerValidation();
        tempVar4.setMinimum(0);
        tempVar4.setMaximum(4094);
        getVLanTag().validateEntity(new IValidation[] { new NotEmptyValidation(), tempVar4 });
    }
    IntegerValidation tempVar5 = new IntegerValidation();
    tempVar5.setMinimum(68);
    getMtu().validateEntity(new IValidation[] { new NotEmptyValidation(), tempVar5 });
    getDnsConfigurationModel().validate();
    getExternalProviders().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
    boolean subnetValid = true;
    if (getExternal().getEntity() && getCreateSubnet().getEntity()) {
        subnetValid = getSubnetModel().validate();
    }
    boolean profilesValid = true;
    Iterable<VnicProfileModel> profiles = getProfiles().getItems();
    for (VnicProfileModel profileModel : profiles) {
        if (!profileModel.validate()) {
            profilesValid = false;
        }
    }
    getNetworkLabel().validateSelectedItem(new IValidation[] { new AsciiNameValidation() });
    setValidTab(TabName.GENERAL_TAB, isGeneralTabValid());
    setValidTab(TabName.SUBNET_TAB, subnetValid);
    setValidTab(TabName.PROFILES_TAB, profilesValid);
    ValidationCompleteEvent.fire(getEventBus(), this);
    return allTabsValid();
}
Also used : RegexValidation(org.ovirt.engine.ui.uicommonweb.validation.RegexValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) SpecialAsciiI18NOrNoneValidation(org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation) NewVnicProfileModel(org.ovirt.engine.ui.uicommonweb.models.profiles.NewVnicProfileModel) VnicProfileModel(org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel) AsciiNameValidation(org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)

Example 8 with IntegerValidation

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

the class VolumeBrickModel method validate.

public boolean validate() {
    getReplicaCount().setIsValid(true);
    getStripeCount().setIsValid(true);
    if (getReplicaCount().getIsAvailable()) {
        IntegerValidation replicaCountValidation = new IntegerValidation();
        replicaCountValidation.setMinimum(2);
        replicaCountValidation.setMaximum(16);
        getReplicaCount().validateEntity(new IValidation[] { new NotEmptyValidation(), replicaCountValidation });
    }
    if (getStripeCount().getIsAvailable()) {
        IntegerValidation stripeCountValidation = new IntegerValidation();
        stripeCountValidation.setMinimum(4);
        stripeCountValidation.setMaximum(16);
        getStripeCount().validateEntity(new IValidation[] { new NotEmptyValidation(), stripeCountValidation });
    }
    return getReplicaCount().getIsValid() && getStripeCount().getIsValid();
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)

Example 9 with IntegerValidation

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

the class NetworkQosParametersModel method validate.

public boolean validate() {
    if (!getEnabled().getEntity()) {
        return true;
    }
    getAverage().validateEntity(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, (Integer) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigValues.MaxAverageNetworkQoSValue)) });
    getPeak().validateEntity(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, (Integer) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigValues.MaxPeakNetworkQoSValue)) });
    getBurst().validateEntity(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, (Integer) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigValues.MaxBurstNetworkQoSValue)) });
    setIsValid(getAverage().getIsValid() && getPeak().getIsValid() && getBurst().getIsValid());
    return getIsValid();
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)

Example 10 with IntegerValidation

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

Aggregations

IntegerValidation (org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)22 NotEmptyValidation (org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation)21 LengthValidation (org.ovirt.engine.ui.uicommonweb.validation.LengthValidation)9 HostAddressValidation (org.ovirt.engine.ui.uicommonweb.validation.HostAddressValidation)4 IValidation (org.ovirt.engine.ui.uicommonweb.validation.IValidation)3 SpecialAsciiI18NOrNoneValidation (org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation)3 DiskStorageType (org.ovirt.engine.core.common.businessentities.storage.DiskStorageType)2 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)2 AsciiNameValidation (org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation)2 HostnameValidation (org.ovirt.engine.ui.uicommonweb.validation.HostnameValidation)2 Ipv4AddressValidation (org.ovirt.engine.ui.uicommonweb.validation.Ipv4AddressValidation)2 Ipv6AddressValidation (org.ovirt.engine.ui.uicommonweb.validation.Ipv6AddressValidation)2 SubnetMaskValidation (org.ovirt.engine.ui.uicommonweb.validation.SubnetMaskValidation)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 SortedMap (java.util.SortedMap)1 TreeMap (java.util.TreeMap)1 VmInitNetwork (org.ovirt.engine.core.common.businessentities.VmInitNetwork)1 NewVnicProfileModel (org.ovirt.engine.ui.uicommonweb.models.profiles.NewVnicProfileModel)1 VnicProfileModel (org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel)1