use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class HostModel method fetchSSHFingerprint.
private void fetchSSHFingerprint() {
// Cleaning up fields for initialization
// $NON-NLS-1$
getFetchSshFingerprint().setEntity("");
// $NON-NLS-1$
getFetchResult().setEntity("");
AsyncQuery<String> aQuery = new AsyncQuery<>(fingerprint -> {
if (fingerprint != null && fingerprint.length() > 0) {
getFetchSshFingerprint().setEntity(fingerprint);
getFetchResult().setEntity(ConstantsManager.getInstance().getConstants().successLoadingFingerprint());
} else {
getFetchResult().setEntity(ConstantsManager.getInstance().getConstants().errorLoadingFingerprint());
}
});
getHost().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(255), new HostAddressValidation() });
if (!getHost().getIsValid()) {
getFetchResult().setEntity(ConstantsManager.getInstance().getConstants().fingerprintAddressError() + getHost().getInvalidityReasons().get(0));
} else {
getFetchResult().setEntity(ConstantsManager.getInstance().getConstants().loadingFingerprint());
AsyncDataProvider.getInstance().getHostFingerprint(aQuery, getHost().getEntity(), getAuthSshPort().getEntity());
}
}
use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class SharedMacPoolModel method validate.
@Override
public boolean validate() {
super.validate();
getName().validateEntity(new IValidation[] { new NotEmptyValidation() });
getDescription().validateEntity(new IValidation[] { new AsciiOrNoneValidation() });
setIsValid(getIsValid() && getName().getIsValid());
return getIsValid();
}
use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class VfsConfigModel method validate.
public boolean validate() {
numOfVfs.validateEntity(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, getMaxNumOfVfs().getEntity()) });
labelsModel.validate();
return labelsModel.getIsValid() && numOfVfs.getIsValid();
}
use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class StorageListModel method storageNameValidation.
public void storageNameValidation() {
StorageModel model = (StorageModel) getWindow();
String name = model.getName().getEntity();
model.getName().setIsValid(true);
AsyncDataProvider.getInstance().isStorageDomainNameUnique(new AsyncQuery<>(isNameUnique -> {
final StorageModel storageModel = (StorageModel) getWindow();
String name1 = storageModel.getName().getEntity();
String tempVar = storageModel.getOriginalName();
// $NON-NLS-1$
String originalName = (tempVar != null) ? tempVar : "";
if (!isNameUnique && name1.compareToIgnoreCase(originalName) != 0) {
storageModel.getName().getInvalidityReasons().add(ConstantsManager.getInstance().getConstants().nameMustBeUniqueInvalidReason());
storageModel.getName().setIsValid(false);
postStorageNameValidation();
} else {
AsyncDataProvider.getInstance().getStorageDomainMaxNameLength(new AsyncQuery<>(nameMaxLength -> {
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));
storageModel.getName().validateEntity(new IValidation[] { new NotEmptyValidation(), tempVar2 });
postStorageNameValidation();
}));
}
}), name);
}
use of org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation in project ovirt-engine by oVirt.
the class TagModel method validate.
public boolean validate() {
LengthValidation tempVar = new LengthValidation();
tempVar.setMaxLength(40);
getName().validateEntity(new IValidation[] { new NotEmptyValidation(), tempVar, new I18NNameValidation() });
return getName().getIsValid();
}
Aggregations