1   /*
2    * $Id: TestFormValidator1.java,v 1.1 2004/04/09 09:47:35 eelco12 Exp $
3    * $Revision: 1.1 $
4    * $Date: 2004/04/09 09:47:35 $
5    *
6    * ====================================================================
7    * Copyright (c) 2003
8    * All rights reserved.
9    */
10  package nl.openedge.baritus.test;
11  
12  import nl.openedge.baritus.FormBeanContext;
13  import nl.openedge.baritus.validation.AbstractFormValidator;
14  
15  import org.infohazard.maverick.flow.ControllerContext;
16  
17  /***
18   * @author hillenius
19   */
20  public class TestFormValidator1 extends AbstractFormValidator
21  {
22  
23  	/***
24  	 * @param cctx
25  	 * @param formBeanContext
26  	 * @return
27  	 * @see nl.openedge.baritus.validation.FormValidator#isValid(org.infohazard.maverick.flow.ControllerContext, nl.openedge.baritus.FormBeanContext)
28  	 */
29  	public boolean isValid(
30  		ControllerContext cctx,
31  		FormBeanContext formBeanContext)
32  	{
33  		boolean valid = true;
34  		TestBean bean = (TestBean)formBeanContext.getBean();
35  		
36  		// test runtime exception
37  		if(bean.getToValidate4().equals("kill"))
38  		{
39  			throw new RuntimeException("big mistake");
40  		}
41  		
42  		valid = bean.getToValidate4().equals("validValue");
43  		if(!valid)
44  		{
45  			formBeanContext.setError("toValidate4", "wrong input");
46  		}
47  		
48  		return valid;
49  	}
50  
51  }