<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
This is regarding the following validation method we have in
ValidationUtils:<br>
<br>
<i>public static <T extends VdcActionParametersBase>
ArrayList<String> validateInputs(List<Class<?>>
validationGroupList, T parameters);</i><br>
<br>
I there any particular reason for supporting the validations only on
objects of classes derived from VdcActionParametersBase? I guess
this was done because this method is primarily intended to validate
the action parameters passed to a BLL action, using the validation
annotations on the parameter class. However I think this method can
be useful for general use as well. e.g. I cannot add a "@Valid"
annotation on a "list" or a "map" in a parameter class. So I need to
iterate over the list/map, and validate each element inside the
loop. The validation inside the loop can also utilize the above
method if the restriction "extends VdcActionParametersBase" is
removed. This will allow me to do the following in the canDoAction
method:<br>
<br>
protected boolean canDoAction() {<br>
...<br>
for(GlusterBrickEntity brick :
getParameters().getGlusterVolume().getBricks()) {<br>
List<String> errors =
ValidationUtils.validateInputs(getValidationGroups(), brick);<br>
if(errors != null) {<br>
for(String error : errors) {<br>
addCanDoActionMessage(error);<br>
}<br>
}<br>
}<br>
...<br>
}<br>
<br>
Regards,<br>
Shireesh<br>
</body>
</html>