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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations