Search in sources :

Example 1 with SpecialAsciiI18NOrNoneValidation

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

the class ProfileBaseModel method validate.

public boolean validate() {
    getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new SpecialAsciiI18NOrNoneValidation() });
    getDescription().validateEntity(new IValidation[] { new AsciiOrNoneValidation() });
    return getName().getIsValid();
}
Also used : AsciiOrNoneValidation(org.ovirt.engine.ui.uicommonweb.validation.AsciiOrNoneValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) SpecialAsciiI18NOrNoneValidation(org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation)

Example 2 with SpecialAsciiI18NOrNoneValidation

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

the class HostModel method validate.

public boolean validate() {
    getName().validateEntity(new IValidation[] { new HostnameValidation() });
    getComment().validateEntity(new IValidation[] { new SpecialAsciiI18NOrNoneValidation() });
    getHost().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(255), new HostAddressValidation() });
    if (Boolean.TRUE.equals(getIsDiscoveredHosts().getEntity())) {
        getUserPassword().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(255) });
        getExternalComputeResource().setIsValid(getExternalComputeResource().getSelectedItem() != null);
        getExternalHostGroups().setIsValid(getExternalHostGroups().getSelectedItem() != null);
    } else {
        getExternalComputeResource().setIsValid(true);
        getExternalHostGroups().setIsValid(true);
    }
    if (getExternalHostProviderEnabled().getEntity() && getProviders().getSelectedItem() == null) {
        getProviders().getInvalidityReasons().add(constants.validateSelectExternalProvider());
        getProviders().setIsValid(false);
    }
    getAuthSshPort().validateEntity(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(1, 65535) });
    if (getConsoleAddressEnabled().getEntity()) {
        getConsoleAddress().validateEntity(new IValidation[] { new NotEmptyValidation(), new HostAddressValidation() });
    } else {
        // the console address is ignored so can not be invalid
        getConsoleAddress().setIsValid(true);
    }
    setValidTab(TabName.CONSOLE_TAB, getConsoleAddress().getIsValid());
    getDataCenter().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
    getCluster().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
    boolean fenceAgentsValid = true;
    if (getIsPm().getEntity()) {
        fenceAgentsValid = getFenceAgentListModel().validate();
    }
    setValidTab(TabName.GENERAL_TAB, getName().getIsValid() && getComment().getIsValid() && getHost().getIsValid() && getAuthSshPort().getIsValid() && getCluster().getIsValid() && getExternalHostGroups().getIsValid() && getExternalComputeResource().getIsValid() && getUserPassword().getIsValid() && getProviders().getIsValid());
    setValidTab(TabName.POWER_MANAGEMENT_TAB, fenceAgentsValid);
    getNetworkProviderModel().validate();
    ValidationCompleteEvent.fire(getEventBus(), this);
    return isValidTab(TabName.GENERAL_TAB) && isValidTab(TabName.POWER_MANAGEMENT_TAB) && getConsoleAddress().getIsValid() && getNetworkProviderModel().getIsValid();
}
Also used : HostnameValidation(org.ovirt.engine.ui.uicommonweb.validation.HostnameValidation) SpecialAsciiI18NOrNoneValidation(org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) HostAddressValidation(org.ovirt.engine.ui.uicommonweb.validation.HostAddressValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)

Example 3 with SpecialAsciiI18NOrNoneValidation

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

the class AbstractDiskModel method validate.

public boolean validate() {
    getDescription().validateEntity(new IValidation[] { new SpecialAsciiI18NOrNoneValidation(), new LengthValidation(BusinessEntitiesDefinitions.DISK_DESCRIPTION_MAX_SIZE) });
    getAlias().validateEntity(getDiskAliasValidations());
    StoragePool dataCenter = getDataCenter().getSelectedItem();
    if (dataCenter != null && dataCenter.getQuotaEnforcementType() == QuotaEnforcementTypeEnum.HARD_ENFORCEMENT) {
        getQuota().validateSelectedItem(new IValidation[] { new NotEmptyQuotaValidation() });
    }
    if (getCinderVolumeType().getIsAvailable()) {
        getCinderVolumeType().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
    }
    return getAlias().getIsValid() && getDescription().getIsValid() && getQuota().getIsValid() && getDiskInterface().getIsValid() && getCinderVolumeType().getIsValid();
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) SpecialAsciiI18NOrNoneValidation(org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) NotEmptyQuotaValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyQuotaValidation)

Example 4 with SpecialAsciiI18NOrNoneValidation

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

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

Aggregations

SpecialAsciiI18NOrNoneValidation (org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation)10 NotEmptyValidation (org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation)9 LengthValidation (org.ovirt.engine.ui.uicommonweb.validation.LengthValidation)7 IntegerValidation (org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation)3 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)2 AsciiNameValidation (org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation)2 AsciiOrNoneValidation (org.ovirt.engine.ui.uicommonweb.validation.AsciiOrNoneValidation)2 NotEmptyQuotaValidation (org.ovirt.engine.ui.uicommonweb.validation.NotEmptyQuotaValidation)2 NewVnicProfileModel (org.ovirt.engine.ui.uicommonweb.models.profiles.NewVnicProfileModel)1 VnicProfileModel (org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel)1 GuidValidation (org.ovirt.engine.ui.uicommonweb.validation.GuidValidation)1 HostAddressValidation (org.ovirt.engine.ui.uicommonweb.validation.HostAddressValidation)1 HostnameValidation (org.ovirt.engine.ui.uicommonweb.validation.HostnameValidation)1 I18NNameValidation (org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation)1 IconWithOsDefaultValidation (org.ovirt.engine.ui.uicommonweb.validation.IconWithOsDefaultValidation)1 NoTrimmingWhitespacesValidation (org.ovirt.engine.ui.uicommonweb.validation.NoTrimmingWhitespacesValidation)1 RegexValidation (org.ovirt.engine.ui.uicommonweb.validation.RegexValidation)1