[jboss-cvs] jboss-seam/src/main/org/jboss/seam/faces ...
Gavin King
gavin.king at jboss.com
Sun Jun 24 18:24:50 EDT 2007
User: gavin
Date: 07/06/24 18:24:50
Modified: src/main/org/jboss/seam/faces FacesExpressions.java
Log:
redesign model-based validation, according to advice of Jacob
JBSEAM-1593
Revision Changes Path
1.4 +1 -35 jboss-seam/src/main/org/jboss/seam/faces/FacesExpressions.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FacesExpressions.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/faces/FacesExpressions.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- FacesExpressions.java 21 Jun 2007 05:27:28 -0000 1.3
+++ FacesExpressions.java 24 Jun 2007 22:24:50 -0000 1.4
@@ -1,15 +1,12 @@
-//$Id: FacesExpressions.java,v 1.3 2007/06/21 05:27:28 gavin Exp $
+//$Id: FacesExpressions.java,v 1.4 2007/06/24 22:24:50 gavin Exp $
package org.jboss.seam.faces;
import static org.jboss.seam.annotations.Install.FRAMEWORK;
import static org.jboss.seam.el.EL.EL_CONTEXT;
import javax.el.ELContext;
-import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
-import javax.faces.validator.ValidatorException;
-import org.hibernate.validator.InvalidValue;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
@@ -40,41 +37,10 @@
return facesContext==null ? EL_CONTEXT : facesContext.getELContext();
}
- /**
- * Validate that a value can be assigned to the property
- * identified by a value expression.
- *
- * @param propertyExpression a value expression
- * @param value the value that is to be assigned
- *
- * @throws ValidatorException is validation fails
- */
- public void validate(String propertyExpression, Object value)
- {
- InvalidValue[] ivs;
- try
- {
- ivs = getInvalidValues(propertyExpression, value );
- }
- catch (Exception e)
- {
- throw new ValidatorException( new FacesMessage(FacesMessage.SEVERITY_ERROR, "model validation failed:" + e.getMessage(), null), e );
- }
- if ( ivs.length>0 )
- {
- throw new ValidatorException( FacesMessages.createFacesMessage( FacesMessage.SEVERITY_ERROR, ivs[0].getMessage() ) );
- }
- }
-
@Override
protected boolean isFacesContextActive()
{
return FacesContext.getCurrentInstance()==null;
}
- public static FacesExpressions instance()
- {
- return (FacesExpressions) Expressions.instance();
- }
-
}
More information about the jboss-cvs-commits
mailing list