use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class ClusterModel method validate.
public boolean validate() {
validateName();
getDataCenter().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
getCustomPropertySheet().setIsValid(getCustomPropertySheet().validate());
setValidTab(TabName.CLUSTER_POLICY_TAB, getCustomPropertySheet().getIsValid());
final IValidation[] versionValidations = new IValidation[] { new NotEmptyValidation() };
getVersion().validateSelectedItem(versionValidations);
getManagementNetwork().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
getRngHwrngSourceRequired().setIsValid(true);
boolean validService = true;
if (getEnableOvirtService().getIsAvailable() && getEnableGlusterService().getIsAvailable()) {
validService = getEnableOvirtService().getEntity() || getEnableGlusterService().getEntity();
}
getGlusterHostAddress().validateEntity(new IValidation[] { new NotEmptyValidation() });
getGlusterHostPassword().validateEntity(new IValidation[] { new NotEmptyValidation() });
if (!validService) {
setMessage(ConstantsManager.getInstance().getConstants().clusterServiceValidationMsg());
} else if (getIsImportGlusterConfiguration().getEntity() && getGlusterHostAddress().getIsValid() && getGlusterHostPassword().getIsValid() && !isFingerprintVerified()) {
setMessage(ConstantsManager.getInstance().getConstants().fingerprintNotVerified());
} else {
setMessage(null);
}
if (getSpiceProxyEnabled().getEntity()) {
getSpiceProxy().validateEntity(new IValidation[] { new HostWithProtocolAndPortAddressValidation() });
} else {
getSpiceProxy().setIsValid(true);
}
setValidTab(TabName.CONSOLE_TAB, getSpiceProxy().getIsValid());
if (getSerialNumberPolicy().getSelectedSerialNumberPolicy() == SerialNumberPolicy.CUSTOM) {
getSerialNumberPolicy().getCustomSerialNumber().validateEntity(new IValidation[] { new NotEmptyValidation() });
} else {
getSerialNumberPolicy().getCustomSerialNumber().setIsValid(true);
}
getMacPoolModel().validate();
boolean generalTabValid = getName().getIsValid() && getDataCenter().getIsValid() && getCPU().getIsValid() && getManagementNetwork().getIsValid() && getVersion().getIsValid() && validService && getGlusterHostAddress().getIsValid() && getRngHwrngSourceRequired().getIsValid() && getGlusterHostPassword().getIsValid() && (!getIsImportGlusterConfiguration().getEntity() || (getGlusterHostAddress().getIsValid() && getGlusterHostPassword().getIsValid() && getSerialNumberPolicy().getCustomSerialNumber().getIsValid() && isFingerprintVerified()));
setValidTab(TabName.GENERAL_TAB, generalTabValid);
if (getVersion().getSelectedItem() != null) {
if (AsyncDataProvider.getInstance().isMigrationPoliciesSupported(getVersion().getSelectedItem()) && MigrationBandwidthLimitType.CUSTOM.equals(getMigrationBandwidthLimitType().getSelectedItem())) {
getCustomMigrationNetworkBandwidth().validateEntity(new IValidation[] { new NotNullIntegerValidation(0, Integer.MAX_VALUE) });
} else {
getCustomMigrationNetworkBandwidth().setIsValid(true);
}
}
final boolean migrationTabValid = getMigrationBandwidthLimitType().getIsValid() && getCustomMigrationNetworkBandwidth().getIsValid();
setValidTab(TabName.MIGRATION_TAB, migrationTabValid);
boolean macPoolTabValid = getMacPoolModel().getIsValid();
setValidTab(TabName.MAC_POOL_TAB, macPoolTabValid);
ValidationCompleteEvent.fire(getEventBus(), this);
return generalTabValid && macPoolTabValid && getCustomPropertySheet().getIsValid() && getSpiceProxy().getIsValid() && migrationTabValid;
}
use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class BookmarkModel method validate.
public boolean validate() {
LengthValidation tempVar = new LengthValidation();
tempVar.setMaxLength(40);
getName().validateEntity(new IValidation[] { new NotEmptyValidation(), tempVar });
LengthValidation tempVar2 = new LengthValidation();
tempVar2.setMaxLength(300);
getSearchString().validateEntity(new IValidation[] { new NotEmptyValidation(), tempVar2 });
return getName().getIsValid() && getSearchString().getIsValid();
}
use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class LoginModel method validate.
protected boolean validate() {
getUserName().validateEntity(new IValidation[] { new NotEmptyValidation() });
getProfile().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
return getUserName().getIsValid() && getProfile().getIsValid();
}
use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class DisksAllocationModel method validateEntity.
@Override
public void validateEntity(IValidation[] validations) {
super.validateEntity(validations);
if (getDisks() == null) {
return;
}
boolean isModelValid = true;
for (DiskModel diskModel : getDisks()) {
ListModel<StorageDomain> diskStorageDomains = diskModel.getStorageDomain();
if (!diskStorageDomains.getItems().iterator().hasNext() || diskStorageDomains.getSelectedItem() == null) {
diskModel.getStorageDomain().getInvalidityReasons().add(constants.storageDomainMustBeSpecifiedInvalidReason());
diskModel.getStorageDomain().setIsValid(false);
isModelValid = false;
}
diskModel.getAlias().validateEntity(new IValidation[] { new NotEmptyValidation(), new I18NNameValidation() });
isModelValid = isModelValid && diskModel.getAlias().getIsValid();
}
setIsValid(isModelValid);
}
use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class GlusterStorageModel method validate.
@Override
public boolean validate() {
getGlusterVolumes().validateSelectedItem(new IValidation[] { new NotEmptyValidation(), new LengthValidation(128) });
getVfsType().validateEntity(new IValidation[] { new NotEmptyValidation(), new AsciiNameValidation() });
if (getLinkGlusterVolume().getEntity()) {
return getGlusterVolumes().getIsValid() && getVfsType().getIsValid();
} else {
return super.validate();
}
}
Aggregations