use of org.ovirt.engine.ui.uicommonweb.validation.HostWithProtocolAndPortAddressValidation 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.HostWithProtocolAndPortAddressValidation in project ovirt-engine by oVirt.
the class PoolModelBehaviorBase method validate.
@Override
public boolean validate() {
boolean isNew = getModel().getIsNew();
int maxAllowedVms = getMaxVmsInPool();
int assignedVms = getModel().getAssignedVms().asConvertible().integer();
int futureNumOfDesktops = (isNew ? 0 : assignedVms) + getModel().getNumOfDesktops().getEntity();
getModel().getNumOfDesktops().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(4), new IntegerValidation(isNew ? 1 : 0, isNew ? maxAllowedVms : maxAllowedVms - assignedVms) });
getModel().getPrestartedVms().validateEntity(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, futureNumOfDesktops) });
getModel().getMaxAssignedVmsPerUser().validateEntity(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(1, futureNumOfDesktops) });
getModel().setValidTab(TabName.GENERAL_TAB, getModel().isValidTab(TabName.GENERAL_TAB) && getModel().getName().getIsValid() && getModel().getNumOfDesktops().getIsValid() && getModel().getPrestartedVms().getIsValid() && getModel().getMaxAssignedVmsPerUser().getIsValid());
getModel().setValidTab(TabName.POOL_TAB, true);
if (getModel().getSpiceProxyEnabled().getEntity()) {
getModel().getSpiceProxy().validateEntity(new IValidation[] { new HostWithProtocolAndPortAddressValidation() });
} else {
getModel().getSpiceProxy().setIsValid(true);
}
return super.validate() && getModel().getName().getIsValid() && getModel().getNumOfDesktops().getIsValid() && getModel().getPrestartedVms().getIsValid() && getModel().getMaxAssignedVmsPerUser().getIsValid() && getModel().getSpiceProxy().getIsValid();
}
Aggregations