View Javadoc

1   /*
2       Jameleon - An automation testing tool..
3       Copyright (C) 2003 Christian W. Hargraves (engrean@hotmail.com)
4       
5       This library is free software; you can redistribute it and/or
6       modify it under the terms of the GNU Lesser General Public
7       License as published by the Free Software Foundation; either
8       version 2.1 of the License, or (at your option) any later version.
9   
10      This library is distributed in the hope that it will be useful,
11      but WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13      Lesser General Public License for more details.
14  
15      You should have received a copy of the GNU Lesser General Public
16      License along with this library; if not, write to the Free Software
17      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19  package net.sf.jameleon.sql;
20  
21  import net.sf.jameleon.ParamValueTag;
22  
23  import org.apache.commons.jelly.JellyTagException;
24  import org.apache.commons.jelly.Tag;
25  
26  /***
27   * Used for set value of a sql-param.
28   * 
29   * An example might be:
30   * <pre><source>
31   * &lt;sql-update 
32   *   functionId="Insert a row into test table via a prepared statement with multiple param values"
33   *     sqlUpdateSql="insert into test(test_str, test_str2) values(?,?)"/&gt;
34   *       &lt;sql-param&gt;
35   *         &lt;sql-param-value&gt;text2&gt;/sql-param-value&gt;
36   *         &lt;sql-param-value&gt;text3&gt;/sql-param-value&gt;
37   *       &lt;/sql-param&gt;
38   * &lt;/sql-update&gt;
39   * </source></pre>
40   *
41   * @jameleon.function name="sql-param-value"
42   */
43  public class SqlParamValueTag extends ParamValueTag {
44      
45      protected void validateParentTag() throws JellyTagException{
46          Tag tag = getParent();
47          if ( ! (tag instanceof SqlParamTag) ) {
48              throw new JellyTagException("This tag can only be imbedded in a sql-param tag.");
49          }
50      }
51  
52  }