Lior Vernia has posted comments on this change.

Change subject: webadmin: Add CIDR format validation
......................................................................


Patch Set 1:

(2 comments)

....................................................
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java
Line 455:             if (getSubnetIpVersion().getSelectedItem() == 
IpVersion.IPV4) {
Line 456:                 cidrValidations.add(new CidrValidation());
Line 457:             }
Line 458: 
Line 459:             
getSubnetCidr().validateEntity(cidrValidations.toArray(new IValidation[0]));
Since CidrValidation doesn't allow empty string, I think this entire paragraph 
could be replaced by:

getSubnetCidr().validateEntity(new IValidation[] { 
getSubnetIpVersion().getSelectedItem() == IpVersion.IPV4 ? new CidrValidation() 
: new NotEmptyValidation() });
Line 460:             getSubnetIpVersion().validateSelectedItem(new 
IValidation[] { new NotEmptyValidation() });
Line 461:         }
Line 462: 
Line 463: 


....................................................
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/CidrValidation.java
Line 1: package org.ovirt.engine.ui.uicommonweb.validation;
Line 2: 
Line 3: import org.ovirt.engine.ui.uicompat.ConstantsManager;
Line 4: 
Line 5: public class CidrValidation extends IpAddressValidation {
Not sure there's a case for inheritance here, seems more like a composition 
scenario. You could inherit from RegexValidation and make the IP address 
regular expression public static.
Line 6: 
Line 7:     public CidrValidation() {
Line 8:         setExpression("^" + IP_ADDRESS_REGEX + 
"(?:/3[0-2]|[12]?[0-9])$"); //$NON-NLS-1$ $NON-NLS-2$
Line 9:         
setMessage(ConstantsManager.getInstance().getConstants().thisFieldMustContainCidrInFormatMsg());


-- 
To view, visit http://gerrit.ovirt.org/22691
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id847a7970113cbb5214cf20720f578fdd3911597
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Mike Kolesnik <[email protected]>
Gerrit-Reviewer: Lior Vernia <[email protected]>
Gerrit-Reviewer: Moti Asayag <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to