use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation 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.NotEmptyValidation 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.NotEmptyValidation in project ovirt-engine by oVirt.
the class DataCenterGuideModel method onAddStorage.
public void onAddStorage() {
StorageModel model = (StorageModel) getWindow();
String storageName = model.getName().getEntity();
AsyncDataProvider.getInstance().isStorageDomainNameUnique(new AsyncQuery<>(isNameUnique -> {
StorageModel storageModel = (StorageModel) getWindow();
String name = storageModel.getName().getEntity();
String tempVar = storageModel.getOriginalName();
// $NON-NLS-1$
String originalName = (tempVar != null) ? tempVar : "";
if (!isNameUnique && name.compareToIgnoreCase(originalName) != 0) {
storageModel.getName().getInvalidityReasons().add(ConstantsManager.getInstance().getConstants().nameMustBeUniqueInvalidReason());
storageModel.getName().setIsValid(false);
}
AsyncDataProvider.getInstance().getStorageDomainMaxNameLength(new AsyncQuery<>(nameMaxLength -> {
StorageModel storageModel1 = (StorageModel) getWindow();
RegexValidation tempVar2 = new RegexValidation();
// $NON-NLS-1$ //$NON-NLS-2$
tempVar2.setExpression("^[A-Za-z0-9_-]{1," + nameMaxLength + "}$");
tempVar2.setMessage(ConstantsManager.getInstance().getMessages().nameCanContainOnlyMsg(nameMaxLength));
storageModel1.getName().validateEntity(new IValidation[] { new NotEmptyValidation(), tempVar2 });
postOnAddStorage();
}));
}), storageName);
}
use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation 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();
}
use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class VolumeBrickModel method validate.
public boolean validate() {
getReplicaCount().setIsValid(true);
getStripeCount().setIsValid(true);
if (getReplicaCount().getIsAvailable()) {
IntegerValidation replicaCountValidation = new IntegerValidation();
replicaCountValidation.setMinimum(2);
replicaCountValidation.setMaximum(16);
getReplicaCount().validateEntity(new IValidation[] { new NotEmptyValidation(), replicaCountValidation });
}
if (getStripeCount().getIsAvailable()) {
IntegerValidation stripeCountValidation = new IntegerValidation();
stripeCountValidation.setMinimum(4);
stripeCountValidation.setMaximum(16);
getStripeCount().validateEntity(new IValidation[] { new NotEmptyValidation(), stripeCountValidation });
}
return getReplicaCount().getIsValid() && getStripeCount().getIsValid();
}
Aggregations