[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-1596) Unique Constraint Validator

Diego Ballve (JIRA) jira-events at lists.jboss.org
Wed Oct 3 05:15:03 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBSEAM-1596?page=comments#action_12380088 ] 
            
Diego Ballve commented on JBSEAM-1596:
--------------------------------------

While the issue is open, I'm extending seam Validators and adding custom validators to the ValidatingResolver.setValue(). What they do is to find getter, look for specific annotations, query database if needed, return extra customInvalidValues). The code below could event be added to seam Validators to make this kind of extension more straightforward:

public class Validators {
	...
	class ValidatingResolver extends ELResolver {
		...
		@Override
		public void setValue(ELContext context, Object base, Object property, Object value)
		        throws NullPointerException, PropertyNotFoundException,
		        PropertyNotWritableException, ELException {
			if (base != null && property != null) {
				context.setPropertyResolved(true);
				invalidValues = getValidator(base).getPotentialInvalidValues(property.toString(), value);
				InvalidValue[] customInvalidValues = getCustomInvalidValues(base, property.toString(), value);
				invalidValues = (InvalidValue[]) ArrayUtils.addAll(invalidValues, customInvalidValues);
			}
		}
	}
	
	/** Extension point for custom non-hibernate validators. */
	protected InvalidValue[] getCustomInvalidValues(Object base, String property, Object value) {
		// lookup and calls to my custom validators goes here
	}
}

> Unique Constraint Validator
> ---------------------------
>
>                 Key: JBSEAM-1596
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1596
>             Project: JBoss Seam
>          Issue Type: Feature Request
>          Components: JSF
>    Affects Versions: 2.0.0.BETA1
>            Reporter: Pete Muir
>            Priority: Minor
>
> We could have a generic unique constrain validator as part of the model validation.
>  
> http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059691#4059691

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list