use of org.ovirt.engine.ui.uicommonweb.validation.RegexValidation in project ovirt-engine by oVirt.
the class NetworkFilterParameterModel method validate.
public void validate() {
RegexValidation nameValidation = new RegexValidation();
// $NON-NLS-1$
nameValidation.setExpression("^[a-zA-Z0-9_]+$");
RegexValidation valueValidation = new RegexValidation();
// $NON-NLS-1$
valueValidation.setExpression("^[a-zA-Z0-9_\\.:]+$");
name.validateEntity(new IValidation[] { new NotEmptyValidation(), nameValidation });
value.validateEntity(new IValidation[] { new NotEmptyValidation(), valueValidation });
setIsValid(name.getIsValid() && value.getIsValid());
}
use of org.ovirt.engine.ui.uicommonweb.validation.RegexValidation in project ovirt-engine by oVirt.
the class ConfigureLocalStorageModel method validate.
public boolean validate() {
RegexValidation validation = new RegexValidation();
// $NON-NLS-1$
validation.setExpression("^[A-Za-z0-9_-]+$");
validation.setMessage(ConstantsManager.getInstance().getConstants().asciiNameValidationMsg());
getFormattedStorageName().validateEntity(new IValidation[] { validation });
if (getFormattedStorageName().getEntity() != null && Linq.firstOrNull(context.storageList, new Linq.NamePredicate(getFormattedStorageName().getEntity())) != null) {
getFormattedStorageName().setIsValid(false);
getFormattedStorageName().getInvalidityReasons().add(ConstantsManager.getInstance().getConstants().nameMustBeUniqueInvalidReason());
}
boolean isStorageValid = getStorage().validate() && getFormattedStorageName().getIsValid();
boolean isDataCenterValid = true;
if (getCandidateDataCenter() == null) {
isDataCenterValid = getDataCenter().validate();
}
boolean isClusterValid = true;
if (getCandidateCluster() == null) {
getCluster().validateName();
isClusterValid = getCluster().getName().getIsValid();
}
setValidTab(TabName.GENERAL_TAB, isStorageValid && isDataCenterValid && isClusterValid);
ValidationCompleteEvent.fire(getEventBus(), this);
return isStorageValid && isDataCenterValid && isClusterValid;
}
use of org.ovirt.engine.ui.uicommonweb.validation.RegexValidation in project ovirt-engine by oVirt.
the class RoleModel method validate.
public boolean validate() {
RegexValidation tempVar = new RegexValidation();
// $NON-NLS-1$
tempVar.setExpression("^\\w.{0,125}$");
tempVar.setMessage(ConstantsManager.getInstance().getConstants().nameMustBeUpToAndStartWithMsg());
RegexValidation tempVar2 = new RegexValidation();
// $NON-NLS-1$
tempVar2.setExpression("^[A-Za-z0-9_-]+$");
tempVar2.setMessage(ConstantsManager.getInstance().getConstants().asciiNameValidationMsg());
getName().validateEntity(new IValidation[] { new NotEmptyValidation(), tempVar, tempVar2 });
LengthValidation lengthValidation = new LengthValidation();
lengthValidation.setMaxLength(4000);
getDescription().validateEntity(new IValidation[] { lengthValidation });
return getName().getIsValid() && getDescription().getIsValid();
}
use of org.ovirt.engine.ui.uicommonweb.validation.RegexValidation in project ovirt-engine by oVirt.
the class LibvirtSecretModel method validate.
public boolean validate() {
getUsageType().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
getUuid().validateEntity(new IValidation[] { new NotEmptyValidation(), new GuidValidation() });
ArrayList<IValidation> valueValidations = new ArrayList<>(Collections.singletonList(new RegexValidation(ValidationUtils.BASE_64_PATTERN, ConstantsManager.getInstance().getConstants().secretValueMustBeInBase64())));
if (isNew()) {
valueValidations.add(new NotEmptyValidation());
getValue().validateEntity(valueValidations.toArray(new IValidation[valueValidations.size()]));
}
return getUsageType().getIsValid() && getUuid().getIsValid() && getValue().getIsValid();
}
Aggregations