use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class VolumeParameterModel method validate.
public boolean validate() {
NotEmptyValidation valueValidation = new NotEmptyValidation();
getValue().validateEntity(new IValidation[] { valueValidation });
getKeyList().validateSelectedItem(new IValidation[] { valueValidation });
return getKeyList().getIsValid() && getValue().getIsValid();
}
use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class SharedHostNetworkQosParametersModel method getOutLinkshareValidations.
@Override
protected Collection<IValidation> getOutLinkshareValidations() {
Collection<IValidation> validations = super.getOutLinkshareValidations();
validations.add(new NotEmptyValidation());
return validations;
}
use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation 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();
}
use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class QosModel method validate.
public boolean validate() {
getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new AsciiNameValidation() });
getDescription().validateEntity(new IValidation[] { new AsciiOrNoneValidation() });
getQosParametersModel().validate();
setIsValid(getName().getIsValid() && getDescription().getIsValid() && getQosParametersModel().getIsValid());
return getIsValid();
}
use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class UnitVmModel method validateHwPart.
public boolean validateHwPart() {
getMigrationDowntime().validateEntity(new IValidation[] { new NotNullIntegerValidation(0, Integer.MAX_VALUE) });
getTotalCPUCores().validateEntity(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(1, behavior.maxCpus), new TotalCpuCoresComposableValidation() });
if (getIsAutoAssign().getEntity() != null && !getIsAutoAssign().getEntity()) {
getDefaultHost().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
} else {
getDefaultHost().setIsValid(true);
}
if (getCpuSharesAmount().getIsAvailable()) {
getCpuSharesAmount().validateEntity(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, 262144) });
}
boolean customPropertySheetValid = getCustomPropertySheet().validate();
setValidTab(TabName.CUSTOM_PROPERTIES_TAB, customPropertySheetValid);
if (getSerialNumberPolicy().getSelectedSerialNumberPolicy() == SerialNumberPolicy.CUSTOM) {
getSerialNumberPolicy().getCustomSerialNumber().validateEntity(new IValidation[] { new NotEmptyValidation() });
} else {
getSerialNumberPolicy().getCustomSerialNumber().setIsValid(true);
}
getEmulatedMachine().validateSelectedItem(new IValidation[] { new I18NExtraNameOrNoneValidation(), new LengthValidation(BusinessEntitiesDefinitions.VM_EMULATED_MACHINE_SIZE) });
getCustomCpu().validateSelectedItem(new IValidation[] { new I18NExtraNameOrNoneValidation(), new LengthValidation(BusinessEntitiesDefinitions.VM_CPU_NAME_SIZE) });
setValidTab(TabName.CONSOLE_TAB, getUsbPolicy().getIsValid() && getNumOfMonitors().getIsValid() && getSpiceProxy().getIsValid());
setValidTab(TabName.HOST_TAB, getMigrationDowntime().getIsValid());
getRngBytes().validateEntity(new IValidation[] { new IntegerValidation(0, Integer.MAX_VALUE), new RngDevValidation() });
getRngPeriod().validateEntity(new IValidation[] { new IntegerValidation(0, Integer.MAX_VALUE) });
setValidTab(TabName.TAB_RNG, getRngBytes().getIsValid() && getRngPeriod().getIsValid());
// Minimum 'Physical Memory Guaranteed' is 1MB
validateMemorySize(getMemSize(), Integer.MAX_VALUE, 1);
if (getMemSize().getIsValid()) {
validateMemorySize(getMinAllocatedMemory(), getMemSize().getEntity(), 1);
}
validateMaxMemorySize();
validateMemoryAlignment(getMemSize());
setValidTab(TabName.RESOURCE_ALLOCATION_TAB, getMinAllocatedMemory().getIsValid());
setValidTab(TabName.SYSTEM_TAB, getMemSize().getIsValid() && getMaxMemorySize().getIsValid() && getTotalCPUCores().getIsValid() && getSerialNumberPolicy().getCustomSerialNumber().getIsValid() && getEmulatedMachine().getIsValid() && getCustomCpu().getIsValid());
/*
* This should be run at very end of the validation process otherwise general validation can override more
* strict checks in behaviors
*/
boolean behaviorValid = behavior.validate();
boolean isValid = behaviorValid && allTabsValid();
return isValid;
}
Aggregations