husted 02/01/01 05:44:36 Modified: contrib/scaffold/src/framework/main/org/apache/scaffold/sql ResultSetUtils.java StatementUtils.java Log: + Modified ModelHelper to extend BaseHelperAction + Added BaseHelperAction + ModelDetailHelper - update JavaDocs. + Added SetModelHelper - standard action to set ModelBean as session attribute. + Added RemoveModelHelper - standard action to remove session attribute. + Added FindForwardAction - Scan parameters for a matching forward name. + ModelResult, ModelResultBase - Change parameter names in signature. Revision Changes Path 1.3 +31 -33 jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/sql/ResultSetUtils.java Index: ResultSetUtils.java =================================================================== RCS file: /home/cvs/jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/sql/ResultSetUtils.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ResultSetUtils.java 28 Dec 2001 13:34:58 -0000 1.2 +++ ResultSetUtils.java 1 Jan 2002 13:44:36 -0000 1.3 @@ -22,17 +22,15 @@ import java.util.Map; import org.apache.commons.beanutils.BeanUtils; -// import org.apache.commons.beanutil.BeanUtils; import org.apache.commons.beanutils.PropertyUtils; -// import org.apache.commons.beanutil.PropertyUtils; -/** - * General purpose utility methods related to ResultSets - * <p> - * @author Ted Husted - * @version $Revision: 1.2 $ $Date: 2001/12/28 13:34:58 $ - */ + /** + * General purpose utility methods related to ResultSets + * <p> + * @author Ted Husted + * @version $Revision: 1.3 $ $Date: 2002/01/01 13:44:36 $ + **/ public class ResultSetUtils { /** @@ -69,7 +67,7 @@ * access to the property accessor method * @exception InvocationTargetException if the property accessor method * throws an exception - */ + **/ public static void setProperties(Object bean, Map properties) throws IllegalAccessException, InvocationTargetException { @@ -80,7 +78,7 @@ if (debug >= 1) System.out.println("BeanUtils.populate(" + bean + ", " + properties + ")"); - */ + **/ // Loop through the property name/value pairs to be set Iterator names = properties.keySet().iterator(); @@ -99,14 +97,14 @@ /* if (debug >= 1) System.out.println(" getPropertyDescriptor: " + t); - */ + **/ descriptor = null; } if (descriptor == null) { /* if (debug >= 1) System.out.println(" No such property, skipping"); - */ + **/ continue; } @@ -114,7 +112,7 @@ if (debug >= 1) System.out.println(" Property descriptor is '" + descriptor + "'"); - */ + **/ // Identify the relevant setter method (if there is one) Method setter = descriptor.getWriteMethod(); @@ -122,7 +120,7 @@ /* if (debug >= 1) System.out.println(" No setter method, skipping"); - */ + **/ continue; } @@ -135,13 +133,13 @@ System.out.println(" name='" + name + "', value.class='" + (value == null ? "NONE" : value.getClass().getName()) + "'"); - */ + **/ /* if (debug >= 1) System.out.println(" Setting to " + (parameters[0] == null ? "NULL" : "'" + parameters[0] + "'")); - */ + **/ // Invoke the setter method setter.invoke(bean,args); @@ -150,7 +148,7 @@ /* if (debug >= 1) System.out.println("============================================"); - */ + **/ } @@ -162,7 +160,7 @@ * @param target An instance of the bean to populate * @exception SQLException if an exception is thrown while setting * property values, populating the bean, or accessing the ResultSet - */ + **/ public static Collection getCollection(Object target, ResultSet resultSet) throws SQLException { @@ -297,20 +295,20 @@ return ((Collection) list); } - /** - * Return a ArrayList of beans populated form a ResultSet, - * transferring all properties as Strings. - * If resultSet is empty, then an empty list will be returned. - * If properties of target and resultSet do not match, a list of - * blank target beans will be returned. - * Otherwise, a list of target beans populated from matching - * properties (columns) in resultSet will be returned. - * @param resultSet The ResultSet whose parameters are to be used - * to populate bean properties - * @param target An instance of the bean to populate - * @exception SQLException if an exception is thrown while setting - * property values, populating the bean, or accessing the ResultSet - */ + /** + * Return a ArrayList of beans populated form a ResultSet, + * transferring all properties as Strings. + * If resultSet is empty, then an empty list will be returned. + * If properties of target and resultSet do not match, a list of + * blank target beans will be returned. + * Otherwise, a list of target beans populated from matching + * properties (columns) in resultSet will be returned. + * @param resultSet The ResultSet whose parameters are to be used + * to populate bean properties + * @param target An instance of the bean to populate + * @exception SQLException if an exception is thrown while setting + * property values, populating the bean, or accessing the ResultSet + **/ public static Collection getCollectionString(Object target, ResultSet resultSet) throws SQLException { @@ -406,4 +404,4 @@ * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * - */ +**/ 1.3 +30 -31 jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/sql/StatementUtils.java Index: StatementUtils.java =================================================================== RCS file: /home/cvs/jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/sql/StatementUtils.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- StatementUtils.java 28 Dec 2001 13:34:58 -0000 1.2 +++ StatementUtils.java 1 Jan 2002 13:44:36 -0000 1.3 @@ -15,8 +15,8 @@ * :FIXME: getCollection returns blank string exceptions when used with multiple parameters (single OK). * :TODO: Refactor executeUpdate methods like getCollection methods. * @author Ted Husted - * @version $Revision: 1.2 $ $Date: 2001/12/28 13:34:58 $ - */ + * @version $Revision: 1.3 $ $Date: 2002/01/01 13:44:36 $ +**/ public final class StatementUtils { @@ -30,7 +30,7 @@ * <p> * @param command The SQL statement to execute. * @exception SQLException if SQL error occurs - */ + **/ public static final int executeUpdate(String resource, String command) throws SQLException { @@ -71,7 +71,7 @@ * @param command The SQL statement to execute. * @param key The parameter * @exception SQLException if SQL error occurs - */ + **/ public static final int executeUpdate(String resource, String command, String key) throws SQLException { @@ -115,7 +115,7 @@ * @param command The SQL statement to execute. * @param key The parameter * @exception SQLException if SQL error occurs - */ + **/ public static final int executeUpdate(String resource, String command, Integer key) throws SQLException { @@ -148,7 +148,6 @@ } // ---- End executeUpdate ---- - /** * Prepares statement using SQL statement and executes * with DBMS configured with the ConnectionPool. @@ -160,7 +159,7 @@ * @param command The SQL statement to execute. * @param parameters An array of parameter objects * @exception SQLException if SQL error occurs - */ + **/ public static final int executeUpdate(String resource, String command, Object[] parameters) throws SQLException { @@ -209,7 +208,7 @@ * fields and indices * @return Result of statement.execute() * @exception SQL Exception if SQL error occurs - */ + **/ public static final int createTable( String resource, String tableName, String tableCreate) throws SQLException { @@ -220,18 +219,18 @@ } // ---- End createTable ---- - /** - * Prepares the given statement using key, and executes - * it with DBMS configured with the ConnectionPool to return - * a ResultSet. The ResultSet is transferred to a Collection - * using the getCollection() method of the Object object. - * The ResultSet is released, and the Collection returned. - * <p> - * @param key The replaceable parameter, if any. - * @param command The SQL statement to prepare and execute. - * @param target The Object class to create collection from ResultSet - * @exception SQLException if SQL error occurs - */ + /** + * Prepares the given statement using key, and executes + * it with DBMS configured with the ConnectionPool to return + * a ResultSet. The ResultSet is transferred to a Collection + * using the getCollection() method of the Object object. + * The ResultSet is released, and the Collection returned. + * <p> + * @param key The replaceable parameter, if any. + * @param command The SQL statement to prepare and execute. + * @param target The Object class to create collection from ResultSet + * @exception SQLException if SQL error occurs + **/ public static final Collection getCollection(String resource, Object target, String command, Object[] parameters) throws SQLException { @@ -298,15 +297,15 @@ } - /** - * Variation of <code>getCollection()</code> for commands - * that use LIKE operator. - * @param key The replaceable parameter to use with LIKE. - * @param command The SQL statement to prepare and execute. - * @param target The ResultList class to create list from ResultSet - * @exception SQLException if SQL error occurs - * @see getResultList - */ + /** + * Variation of <code>getCollection()</code> for commands + * that use LIKE operator. + * @param key The replaceable parameter to use with LIKE. + * @param command The SQL statement to prepare and execute. + * @param target The ResultList class to create list from ResultSet + * @exception SQLException if SQL error occurs + * @see getResultList + **/ public static final Collection getCollectionLike(String resource, Object target, String command, String key) throws SQLException { Object[] parameters = new Object[1]; @@ -346,7 +345,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Scaffold", and "Apache Software + * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -374,5 +373,5 @@ * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * - */ +**/
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>