use of org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation in project ovirt-engine by oVirt.
the class GlusterStorageModel method validate.
@Override
public boolean validate() {
getGlusterVolumes().validateSelectedItem(new IValidation[] { new NotEmptyValidation(), new LengthValidation(128) });
getVfsType().validateEntity(new IValidation[] { new NotEmptyValidation(), new AsciiNameValidation() });
if (getLinkGlusterVolume().getEntity()) {
return getGlusterVolumes().getIsValid() && getVfsType().getIsValid();
} else {
return super.validate();
}
}
use of org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation in project ovirt-engine by oVirt.
the class ExternalSubnetModel method validate.
public boolean validate() {
getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new AsciiNameValidation() });
boolean ipv4 = getIpVersion().getSelectedItem() == IpVersion.IPV4;
getCidr().validateEntity(new IValidation[] { ipv4 ? new CidrValidation() : new NotEmptyValidation() });
getIpVersion().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
getGateway().setIsValid(true);
if (StringHelper.isNotNullOrEmpty(getGateway().getEntity()) && ipv4) {
getGateway().validateEntity(new IValidation[] { new Ipv4AddressValidation() });
}
boolean dnsServersValid = true;
for (EntityModel<String> dnsServer : getDnsServers().getItems()) {
dnsServer.setIsValid(true);
if (StringHelper.isNotNullOrEmpty(dnsServer.getEntity()) && ipv4) {
dnsServer.validateEntity(new IValidation[] { new Ipv4AddressValidation() });
}
dnsServersValid &= dnsServer.getIsValid();
}
return getName().getIsValid() && getCidr().getIsValid() && getIpVersion().getIsValid() && getGateway().getIsValid() && dnsServersValid;
}
use of org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation 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.AsciiNameValidation 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.AsciiNameValidation in project ovirt-engine by oVirt.
the class VfsNicLabelModel method validate.
public void validate() {
boolean res = true;
Set<String> editedLabels = new HashSet<>();
for (ListModel<String> labelModel : getItems()) {
labelModel.validateSelectedItem(new IValidation[] { new AsciiNameValidation() });
String label = labelModel.getSelectedItem();
if (editedLabels.contains(label)) {
labelModel.getInvalidityReasons().add(ConstantsManager.getInstance().getConstants().duplicateLabel());
labelModel.setIsValid(false);
}
editedLabels.add(label);
res &= labelModel.getIsValid();
}
setIsValid(res);
}
Aggregations