You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2010/10/02 18:51:33 UTC
svn commit: r1003834 [2/2] - in /db/torque/torque4/trunk:
torque-runtime/src/main/java/org/apache/torque/dsfactory/
torque-runtime/src/main/java/org/apache/torque/map/
torque-runtime/src/main/java/org/apache/torque/oid/
torque-runtime/src/main/java/org...
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java Sat Oct 2 16:51:32 2010
@@ -88,10 +88,11 @@ import com.workingdogs.village.Value;
*/
public class SummaryHelper
{
- static Log logger = LogFactory.getLog(SummaryHelper.class);
+ /** The class log. */
+ private static Log logger = LogFactory.getLog(SummaryHelper.class);
/** A list of the group by columns names (e.g. TABLE.COLUMN) */
- private List groupByColumns;
+ private List<String> groupByColumns;
/** A OrderMap<String,Aggregate.Function> with the aggregate functions
* to use in generating results. */
private OrderedMap aggregates;
@@ -116,10 +117,10 @@ public class SummaryHelper
* @throws TorqueException
* @throws DataSetException
*/
- public List summarize( Criteria crit )
+ public List<OrderedMap> summarize(Criteria crit)
throws TorqueException, DataSetException
{
- return summarize( crit, null );
+ return summarize(crit, null);
}
/**
@@ -133,37 +134,35 @@ public class SummaryHelper
* @throws TorqueException
* @throws DataSetException
*/
- public List summarize( Criteria crit, Connection conn )
+ public List<OrderedMap> summarize(Criteria crit, Connection conn)
throws TorqueException, DataSetException
{
- Criteria c = buildCriteria( crit );
+ Criteria c = buildCriteria(crit);
- List results;
+ List<Record> results;
if (conn == null)
{
- results = BasePeer.doSelect(c);
+ results = BasePeer.doSelectVillageRecords(c);
}
else
{
- results = BasePeer.doSelect(c, conn);
+ results = BasePeer.doSelectVillageRecords(c, conn);
}
- Iterator r = results.iterator();
-
- Vector resultsList = new Vector(results.size());
- while ( r.hasNext() )
+ Vector<OrderedMap> resultsList = new Vector<OrderedMap>(results.size());
+ for (Record rec : results)
{
ListOrderedMap recordMap = new ListOrderedMap();
- Record rec = (Record) r.next();
String cName = null;
Value value = null;
- for ( int i = 1; i <= rec.size(); i++ )
+ for (int i = 1; i <= rec.size(); i++)
{
value = rec.getValue(i);
cName = rec.schema().column(i).name();
- if ( cName == null || cName.equals("") )
+ if (cName == null || cName.equals(""))
{
- if ( excludeExprColumns() ) {
+ if (excludeExprColumns())
+ {
continue;
}
cName = "Expr" + i;
@@ -183,12 +182,12 @@ public class SummaryHelper
* @return A criteria to use in summarizing the information.
* @throws TorqueException
*/
- public Criteria buildCriteria( Criteria c ) throws TorqueException {
-
+ public Criteria buildCriteria(Criteria c) throws TorqueException
+ {
c.getSelectColumns().clear();
c.getGroupByColumns().clear();
- UniqueList criteriaSelectModifiers;
+ UniqueList<String> criteriaSelectModifiers;
criteriaSelectModifiers = c.getSelectModifiers();
if (criteriaSelectModifiers != null
@@ -199,23 +198,22 @@ public class SummaryHelper
}
c.setIgnoreCase(false);
- List cols = null;
- Iterator i = null;
+ List<String> cols = null;
cols = getGroupByColumns();
- i = cols.iterator();
- boolean haveFromTable = i.hasNext(); // Group By cols define src table.
- while ( i.hasNext() )
+ boolean haveFromTable = !cols.isEmpty(); // Group By cols define src table.
+ for (String col : cols)
{
- String col = (String) i.next();
- c.addGroupByColumn( col );
+ c.addGroupByColumn(col);
c.addSelectColumn(col);
}
- if ( haveFromTable )
+ if (haveFromTable)
+ {
logger.debug("From table defined by Group By Cols");
+ }
// Check if the from table is set via a where clause.
- if ( ! haveFromTable && c.keys().hasMoreElements() )
+ if (!haveFromTable && c.keys().hasMoreElements())
{
haveFromTable = true;
logger.debug("From table defined by a where clause");
@@ -223,32 +221,32 @@ public class SummaryHelper
OrderedMap cMap = getAggregates();
OrderedMapIterator iMap = cMap.orderedMapIterator();
- while ( iMap.hasNext() )
+ while (iMap.hasNext())
{
String key = (String) iMap.next();
SQLFunction f = (SQLFunction) iMap.getValue();
- c.addAsColumn( key, f.toSQL() );
- if ( ! haveFromTable ) // Last chance. Get it from the func.
+ c.addAsColumn(key, f.toSQL());
+ if (!haveFromTable) // Last chance. Get it from the func.
{
String col = f.getArgument(0).toString();
- if ( col.indexOf('.') >= 0)
+ if (col.indexOf('.') >= 0)
{
// Kludgy Where table.col = table.col clause to force
// from table identification.
- c.add( col,(Object)(col + "=" + col), SqlEnum.CUSTOM );
+ c.add(col, (Object) (col + "=" + col), SqlEnum.CUSTOM);
haveFromTable = true;
- String table = col.substring(0,col.indexOf('.'));
- logger.debug("From table, '" + table +
- "', defined from aggregate column");
+ String table = col.substring(0, col.indexOf('.'));
+ logger.debug("From table, '" + table
+ + "', defined from aggregate column");
}
}
}
- if ( ! haveFromTable )
+ if (!haveFromTable)
{
throw new TorqueException(
- "No FROM table defined by the GroupBy set, " +
- "criteria.setAlias, or specified function column!");
+ "No FROM table defined by the GroupBy set, "
+ + "criteria.setAlias, or specified function column!");
}
return c;
}
@@ -267,7 +265,7 @@ public class SummaryHelper
*
* @param column
*/
- public void addGroupBy( String column )
+ public void addGroupBy(String column)
{
getGroupByColumns().add(column);
}
@@ -279,9 +277,9 @@ public class SummaryHelper
* no key words, e.g. function names.
* @param function One of the inner classes from the Aggregate class.
*/
- public void addAggregate( String alias, SQLFunction function )
+ public void addAggregate(String alias, SQLFunction function)
{
- getAggregates().put( alias, function );
+ getAggregates().put(alias, function);
}
/**
@@ -295,11 +293,11 @@ public class SummaryHelper
setExcludeExprColumns(false);
}
- public List getGroupByColumns()
+ public List<String> getGroupByColumns()
{
- if ( groupByColumns == null )
+ if (groupByColumns == null)
{
- groupByColumns = new Vector();
+ groupByColumns = new Vector<String>();
}
return groupByColumns;
}
@@ -313,7 +311,7 @@ public class SummaryHelper
*/
public OrderedMap getAggregates()
{
- if ( aggregates == null )
+ if (aggregates == null)
{
aggregates = new ListOrderedMap();
}
@@ -330,31 +328,31 @@ public class SummaryHelper
* @param includeHeader
* @throws IOException
*/
- public void dumpResults(Writer out, List results, boolean includeHeader )
+ public void dumpResults(Writer out, List<?> results, boolean includeHeader)
throws IOException
{
- Iterator i = results.iterator();
+ Iterator<?> i = results.iterator();
boolean first = includeHeader;
- while ( i.hasNext() )
+ while (i.hasNext())
{
- OrderedMap rec = (OrderedMap ) i.next();
+ OrderedMap rec = (OrderedMap) i.next();
OrderedMapIterator rI = rec.orderedMapIterator();
String heading = "";
String recString = "";
- while ( rI.hasNext() )
+ while (rI.hasNext())
{
String colId = (String) rI.next();
- if ( first )
+ if (first)
{
heading += "\"" + colId + "\"";
- if ( rI.hasNext() )
+ if (rI.hasNext())
{
heading += ", ";
}
}
Value v = (Value) rI.getValue();
- if ( v.isString() )
+ if (v.isString())
{
recString += "\"" + v.toString() + "\"";
}
@@ -362,12 +360,12 @@ public class SummaryHelper
{
recString += v.toString();
}
- if ( rI.hasNext() )
+ if (rI.hasNext())
{
recString += ", ";
}
}
- if ( first )
+ if (first)
{
first = false;
out.write(heading);
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/UniqueList.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/UniqueList.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/UniqueList.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/UniqueList.java Sat Oct 2 16:51:32 2010
@@ -24,10 +24,12 @@ import java.util.ArrayList;
/**
* List with unique entries. UniqueList does not allow null nor duplicates.
*
+ * @param <T> the type of objects contained in the List.
+ *
* @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
* @version $Id$
*/
-public class UniqueList extends ArrayList
+public class UniqueList<T> extends ArrayList<T>
{
/**
* Serial version
@@ -45,7 +47,7 @@ public class UniqueList extends ArrayLis
* Copy-constructor. Creates a shallow copy of an UniqueList.
* @param list the uniqueList to copy
*/
- public UniqueList(UniqueList list)
+ public UniqueList(UniqueList<T> list)
{
this.addAll(list);
}
@@ -56,7 +58,7 @@ public class UniqueList extends ArrayLis
* @param o the Object to add
* @return true if the Object is added
*/
- public boolean add(Object o)
+ public boolean add(T o)
{
if (o != null && !contains(o))
{
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AbstractFunction.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AbstractFunction.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AbstractFunction.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AbstractFunction.java Sat Oct 2 16:51:32 2010
@@ -34,14 +34,15 @@ import org.apache.torque.Torque;
public abstract class AbstractFunction implements SQLFunction
{
/** The arguments being used by this function */
- private List argumentList;
+ private List<Object> argumentList;
/** The Torque DB connector name this function is associated with */
private String dbName;
/**
* Functions should only be created via the FunctionFactory class.
*/
- protected AbstractFunction() {
+ protected AbstractFunction()
+ {
super();
}
@@ -62,7 +63,7 @@ public abstract class AbstractFunction i
* @return A String representation of the parameter. Null if one does not
* exist.
*/
- public abstract String getArgument( int i );
+ public abstract String getArgument(int i);
/**
* Return all the parameters as an object array. This allow for
@@ -76,7 +77,7 @@ public abstract class AbstractFunction i
public Object[] getArguments()
{
Object[] args = getArgumentList().toArray();
- if ( args == null )
+ if (args == null)
{
args = new Object[0];
}
@@ -90,12 +91,14 @@ public abstract class AbstractFunction i
* @exception IllegalStateException If Torque has not been initialized and
* the default DB name can not be determined.
*/
- public String getDBName() throws IllegalStateException
+ public String getDBName()
{
- if ( this.dbName == null ) {
+ if (this.dbName == null)
+ {
this.dbName = Torque.getDefaultDB();
}
- if ( this.dbName == null ) {
+ if (this.dbName == null)
+ {
throw new IllegalStateException(
"Could not get DB Name! Torque may not be initialized yet!");
}
@@ -110,10 +113,10 @@ public abstract class AbstractFunction i
* @return The parameter object. Null if one does not
* exist.
*/
- protected Object getArgumentObject( int index )
+ protected Object getArgumentObject(int index)
{
- List argList = getArgumentList();
- if ( index >= argList.size() )
+ List<Object> argList = getArgumentList();
+ if (index >= argList.size())
{
return null;
}
@@ -125,8 +128,9 @@ public abstract class AbstractFunction i
*
* @param arg The argument object.
*/
- protected void addArgument( Object arg ) {
- getArgumentList().add( arg );
+ protected void addArgument(Object arg)
+ {
+ getArgumentList().add(arg);
}
/**
@@ -134,7 +138,8 @@ public abstract class AbstractFunction i
*
* @param args The new argument list
*/
- protected void setArgumentList( List args ) {
+ protected void setArgumentList(List<Object> args)
+ {
this.argumentList = args;
}
@@ -143,9 +148,11 @@ public abstract class AbstractFunction i
*
* @return The argument list
*/
- protected List getArgumentList( ) {
- if ( this.argumentList == null ) {
- this.argumentList = new Vector();
+ protected List<Object> getArgumentList()
+ {
+ if (this.argumentList == null)
+ {
+ this.argumentList = new Vector<Object>();
}
return this.argumentList;
}
@@ -157,5 +164,4 @@ public abstract class AbstractFunction i
{
this.dbName = dbName;
}
-
}
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Aggregate.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Aggregate.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Aggregate.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Aggregate.java Sat Oct 2 16:51:32 2010
@@ -62,7 +62,7 @@ public class Aggregate
* @see FunctionFactory
* @see DB
*/
- protected AgregateFunction ( )
+ protected AgregateFunction()
{
super();
}
@@ -78,29 +78,28 @@ public class Aggregate
* been supplied or the second argument
* object is not Boolean.
*/
- public void setArguments( Object[] args )
- throws IllegalArgumentException
+ public void setArguments(Object[] args)
{
- if ( args.length < 1 )
+ if (args.length < 1)
{
throw new IllegalArgumentException(
"There must be at least one argument object specified!");
}
- if ( args.length < 2 )
+ if (args.length < 2)
{
this.distinct = false;
}
else
{
- if ( ! ( args[1] instanceof Boolean ) )
+ if (!(args[1] instanceof Boolean))
{
throw new IllegalArgumentException(
"Second argument object is not type Boolean!");
}
this.distinct = ((Boolean) args[1]).booleanValue();
}
- addArgument( args[0].toString() );
+ addArgument(args[0].toString());
this.argumentsSet = true;
}
@@ -129,29 +128,30 @@ public class Aggregate
*
* @param value The function to use.
*/
- public void setFunction( String value )
+ public void setFunction(String value)
{
this.function = value;
}
/**
* Generate the SQL for this function.
+ *
+ * @throws IllegalStateException if the arguments are not set
*/
public String toSQL()
- throws IllegalStateException
{
- if ( ! argumentsSet )
+ if (!argumentsSet)
{
throw new IllegalStateException (
"Function arguments have not been set!");
}
StringBuffer sb = new StringBuffer();
sb.append(getFunction()).append("(");
- if ( isDistinct() )
+ if (isDistinct())
{
sb.append("DISTINCT ");
}
- sb.append( getArgument(0).toString() ).append( ")" );
+ sb.append(getArgument(0).toString()).append(")");
return sb.toString();
}
@@ -230,7 +230,7 @@ public class Aggregate
* @see FunctionFactory
* @see Aggregate.AgregateFunction
*/
- protected Max( )
+ protected Max()
{
super();
setFunction("MAX");
@@ -248,7 +248,7 @@ public class Aggregate
* @see FunctionFactory
* @see Aggregate.AgregateFunction
*/
- protected Sum( )
+ protected Sum()
{
super();
setFunction("SUM");
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/FunctionFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/FunctionFactory.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/FunctionFactory.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/FunctionFactory.java Sat Oct 2 16:51:32 2010
@@ -62,12 +62,12 @@ public class FunctionFactory
* @return The function object to use.
* @throws Exception
*/
- public static final SQLFunction avg ( String dbName, Object expr1,
- boolean distinct )
+ public static final SQLFunction avg (String dbName, Object expr1,
+ boolean distinct)
throws Exception
{
- return functionInstance( dbName, FunctionEnum.AVG,
- new Object[]{ expr1, new Boolean(distinct) });
+ return functionInstance(dbName, FunctionEnum.AVG,
+ new Object[]{expr1, new Boolean(distinct)});
}
/**
* Convenience method for creating a non-distinct function that uses
@@ -80,10 +80,10 @@ public class FunctionFactory
* @return The function object to use.
* @throws Exception
*/
- public static final SQLFunction avg ( Object expr1 )
+ public static final SQLFunction avg (Object expr1)
throws Exception
{
- return avg ( null, expr1, false );
+ return avg (null, expr1, false);
}
/**
@@ -99,12 +99,12 @@ public class FunctionFactory
* @return The function object to use.
* @throws Exception
*/
- public static final SQLFunction count ( String dbName, Object expr1,
- boolean distinct )
+ public static final SQLFunction count (String dbName, Object expr1,
+ boolean distinct)
throws Exception
{
- return functionInstance( dbName, FunctionEnum.COUNT,
- new Object[]{ expr1, new Boolean(distinct) });
+ return functionInstance(dbName, FunctionEnum.COUNT,
+ new Object[]{expr1, new Boolean(distinct)});
}
/**
* Convenience method for creating a non-distinct function that uses
@@ -117,10 +117,10 @@ public class FunctionFactory
* @return The function object to use.
* @throws Exception
*/
- public static final SQLFunction count ( Object expr1 )
+ public static final SQLFunction count (Object expr1)
throws Exception
{
- return count ( null, expr1, false );
+ return count(null, expr1, false);
}
/**
@@ -136,12 +136,12 @@ public class FunctionFactory
* @return The function object to use.
* @throws Exception
*/
- public static final SQLFunction max ( String dbName, Object expr1,
- boolean distinct )
+ public static final SQLFunction max(String dbName, Object expr1,
+ boolean distinct)
throws Exception
{
- return functionInstance( dbName, FunctionEnum.MAX,
- new Object[]{ expr1, new Boolean(distinct) });
+ return functionInstance(dbName, FunctionEnum.MAX,
+ new Object[]{expr1, new Boolean(distinct)});
}
/**
* Convenience method for creating a non-distinct function that uses
@@ -154,10 +154,10 @@ public class FunctionFactory
* @return The function object to use.
* @throws Exception
*/
- public static final SQLFunction max ( Object expr1 )
+ public static final SQLFunction max(Object expr1)
throws Exception
{
- return max ( null, expr1, false );
+ return max(null, expr1, false);
}
/**
@@ -173,12 +173,12 @@ public class FunctionFactory
* @return The function object to use.
* @throws Exception
*/
- public static final SQLFunction min ( String dbName, Object expr1,
- boolean distinct )
+ public static final SQLFunction min(String dbName, Object expr1,
+ boolean distinct)
throws Exception
{
- return functionInstance( dbName, FunctionEnum.MIN,
- new Object[]{ expr1, new Boolean(distinct) });
+ return functionInstance(dbName, FunctionEnum.MIN,
+ new Object[]{expr1, new Boolean(distinct)});
}
/**
* Convenience method for creating a non-distinct function that uses
@@ -191,10 +191,10 @@ public class FunctionFactory
* @return The function object to use.
* @throws Exception
*/
- public static final SQLFunction min ( Object expr1 )
+ public static final SQLFunction min (Object expr1)
throws Exception
{
- return min ( null, expr1, false );
+ return min (null, expr1, false);
}
/**
@@ -210,12 +210,12 @@ public class FunctionFactory
* @return The function object to use.
* @throws Exception
*/
- public static final SQLFunction sum ( String dbName, Object expr1,
- boolean distinct )
+ public static final SQLFunction sum (String dbName, Object expr1,
+ boolean distinct)
throws Exception
{
- return functionInstance( dbName, FunctionEnum.SUM,
- new Object[]{ expr1, new Boolean(distinct) });
+ return functionInstance(dbName, FunctionEnum.SUM,
+ new Object[]{expr1, new Boolean(distinct)});
}
/**
* Convenience method for creating a non-distinct function that uses
@@ -228,10 +228,10 @@ public class FunctionFactory
* @return The function object to use.
* @throws Exception
*/
- public static final SQLFunction sum ( Object expr1 )
+ public static final SQLFunction sum (Object expr1)
throws Exception
{
- return sum ( null, expr1, false );
+ return sum (null, expr1, false);
}
/**
@@ -244,52 +244,54 @@ public class FunctionFactory
* @return A SQLFunction implementation that for the specified DB server.
* @throws Exception
*/
- public static final SQLFunction functionInstance ( String dbName,
+ public static final SQLFunction functionInstance (String dbName,
FunctionEnum function,
- Object[] arguments )
+ Object[] arguments)
throws Exception
{
DB dbAdaptor = null;
- if ( dbName != null ) {
+ if (dbName != null)
+ {
dbAdaptor = Torque.getDB(dbName);
}
else
{
dbAdaptor = Torque.getDB(Torque.getDefaultDB());
}
- Class fClass = dbAdaptor.getFunctionClass( function );
- if ( fClass == null )
+ Class<?> fClass = dbAdaptor.getFunctionClass(function);
+ if (fClass == null)
{
throw new IllegalArgumentException(
- "Could not find function class for '"+ function.toString() +"'");
+ "Could not find function class for '"
+ + function.toString() + "'");
}
Object fInstance = null;
// Check if class is an inner class
- Class outerClass = fClass.getDeclaringClass();
- if ( outerClass != null )
+ Class<?> outerClass = fClass.getDeclaringClass();
+ if (outerClass != null)
{
Object oInstance = outerClass.newInstance();
- Constructor iConstructor =
- fClass.getDeclaredConstructor( new Class[] { outerClass } );
- fInstance = iConstructor.newInstance( new Object[] { oInstance });
+ Constructor<?> iConstructor =
+ fClass.getDeclaredConstructor(new Class[] {outerClass});
+ fInstance = iConstructor.newInstance(new Object[] {oInstance});
}
else
{
fInstance = fClass.newInstance();
}
SQLFunction func = (SQLFunction) fInstance;
- func.setArguments( arguments );
- func.setDBName( dbName );
+ func.setArguments(arguments);
+ func.setDBName(dbName);
return func;
}
- public static final SQLFunction functionInstance ( FunctionEnum function,
- Object[] arguments )
+ public static final SQLFunction functionInstance (FunctionEnum function,
+ Object[] arguments)
throws Exception
{
- return functionInstance ( null, function, arguments );
+ return functionInstance (null, function, arguments);
}
}
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/SQLFunction.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/SQLFunction.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/SQLFunction.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/SQLFunction.java Sat Oct 2 16:51:32 2010
@@ -50,7 +50,7 @@ public interface SQLFunction
* @return A String representation of the parameter. Null if one does not
* exist.
*/
- public abstract String getArgument( int i );
+ public abstract String getArgument(int i);
/**
* Return all the parameters as an object array. This allow for
@@ -69,7 +69,7 @@ public interface SQLFunction
*
* @param args The function specific arguments.
*/
- public abstract void setArguments( Object[] args );
+ public abstract void setArguments(Object[] args);
/**
* Get the name of the Torque Database associated with this function.
@@ -86,6 +86,6 @@ public interface SQLFunction
* @param dbName The DB name, if null, the getDBName will return default DB
* name (if it can be determined).
*/
- public abstract void setDBName( String dbName );
+ public abstract void setDBName(String dbName);
}
Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java Sat Oct 2 16:51:32 2010
@@ -122,13 +122,6 @@ public class OMForeignKeyTransformer
private static final String FOREIGN_FIELD_INIT_TYPE_OPTION
= "torque.om.complexObjectModel.foreignFieldInitType";
- /**
- * The name of the option which determines whether to generate
- * java5 generics.
- */
- private static final String JAVA5_OPTION
- = "torque.om.java5";
-
public void transform(
SourceElement foreignKey,
ControllerState controllerState)
@@ -237,11 +230,8 @@ public class OMForeignKeyTransformer
fieldContainedType);
String fieldType = (String) controllerState.getOption(
- FOREIGN_FIELD_TYPE_OPTION);
- if ("true".equals(controllerState.getOption(JAVA5_OPTION)))
- {
- fieldType = fieldType + "<" + fieldContainedType + ">";
- }
+ FOREIGN_FIELD_TYPE_OPTION)
+ + "<" + fieldContainedType + ">";
foreignFieldElement.setAttribute(
JavaFieldAttributeName.FIELD_TYPE,
fieldType);
@@ -283,11 +273,8 @@ public class OMForeignKeyTransformer
}
{
String initType = (String) controllerState.getOption(
- FOREIGN_FIELD_INIT_TYPE_OPTION);
- if ("true".equals(controllerState.getOption(JAVA5_OPTION)))
- {
- initType = initType + "<" + fieldContainedType + ">";
- }
+ FOREIGN_FIELD_INIT_TYPE_OPTION)
+ + "<" + fieldContainedType + ">";
foreignFieldElement.setAttribute(
JavaFieldAttributeName.INITIALIZER_TYPE,
initType);
@@ -409,22 +396,16 @@ public class OMForeignKeyTransformer
fieldContainedType);
String fieldType = (String) controllerState.getOption(
- FOREIGN_FIELD_TYPE_OPTION);
- if ("true".equals(controllerState.getOption(JAVA5_OPTION)))
- {
- fieldType = fieldType + "<" + fieldContainedType + ">";
- }
+ FOREIGN_FIELD_TYPE_OPTION)
+ + "<" + fieldContainedType + ">";
foreignFieldInBeanElement.setAttribute(
JavaFieldAttributeName.FIELD_TYPE,
fieldType);
{
String initType = (String) controllerState.getOption(
- FOREIGN_FIELD_INIT_TYPE_OPTION);
- if ("true".equals(controllerState.getOption(JAVA5_OPTION)))
- {
- initType = initType + "<" + fieldContainedType + ">";
- }
+ FOREIGN_FIELD_INIT_TYPE_OPTION)
+ + "<" + fieldContainedType + ">";
foreignFieldInBeanElement.setAttribute(
JavaFieldAttributeName.INITIALIZER_TYPE,
initType);
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties Sat Oct 2 16:51:32 2010
@@ -28,8 +28,6 @@ torque.om.objectIsCaching = true
torque.om.silentDbFetch = true
-torque.om.java5 = true
-
torque.om.addGetByNameMethods = true
torque.om.generateBeans = false
@@ -66,7 +64,7 @@ torque.om.complexObjectModel.foreignFiel
torque.om.complexObjectModel.foreignFieldNameRelatedBy = RelatedBy
# Type of the instance variable on the "foreign" side of the fk
-# This type will be generified if java5 is enabled
+# This type will be generified.
torque.om.complexObjectModel.foreignFieldType = List
# The type of the object the variable on the "foreign" side will be
# initialized with in the init method
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml Sat Oct 2 16:51:32 2010
@@ -133,9 +133,6 @@
<mergepoint name="setDbName">
<action xsi:type="applyAction" outlet="torque.om.peer.base.setDbName"/>
</mergepoint>
- <mergepoint name="java5Wrappers">
- <action xsi:type="applyAction" outlet="torque.om.peer.base.java5Wrappers"/>
- </mergepoint>
<mergepoint name="extensions" />
</outlet>
@@ -311,8 +308,4 @@
path="peer/base/setDbName.vm">
</outlet>
- <outlet name="torque.om.peer.base.java5Wrappers"
- xsi:type="velocityOutlet"
- path="peer/base/java5Wrappers.vm">
- </outlet>
</outlets>
\ No newline at end of file
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/bean/objectBeanMethods.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/bean/objectBeanMethods.vm?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/bean/objectBeanMethods.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/bean/objectBeanMethods.vm Sat Oct 2 16:51:32 2010
@@ -85,9 +85,9 @@
if ($field != null)
{
${beanFieldType} relatedBeans = new ${beanFieldInitializerType}(${field}.size());
- for (Iterator#if($java5 == "true")<$fieldContainedType>#end ${field}It = ${field}.iterator(); ${field}It.hasNext(); )
+ for (Iterator<$fieldContainedType> ${field}It = ${field}.iterator(); ${field}It.hasNext(); )
{
- ${fieldContainedType} related = #if($java5 != "true")($fieldContainedType) #end${field}It.next();
+ ${fieldContainedType} related = ${field}It.next();
${foreignBeanClassName} relatedBean = related.getBean(createdBeans);
relatedBeans.add(relatedBean);
}
@@ -200,12 +200,12 @@
#set ( $beanGetter = $beanFieldElement.getAttribute("getter") )
#set ( $adder = $fieldElement.getAttribute("adder") )
{
- List#if($java5 == "true")<$foreignBeanClassName>#end relatedBeans = bean.${beanGetter}();
+ List<$foreignBeanClassName> relatedBeans = bean.${beanGetter}();
if (relatedBeans != null)
{
- for (Iterator#if($java5 == "true")<$foreignBeanClassName>#end relatedBeansIt = relatedBeans.iterator(); relatedBeansIt.hasNext(); )
+ for (Iterator<$foreignBeanClassName> relatedBeansIt = relatedBeans.iterator(); relatedBeansIt.hasNext(); )
{
- $foreignBeanClassName relatedBean = #if($java5 != "true")($foreignBeanClassName)#end relatedBeansIt.next();
+ $foreignBeanClassName relatedBean = relatedBeansIt.next();
${foreignClassName} related = ${foreignClassName}.create${foreignClassName}(relatedBean, createdObjects);
result.${adder}FromBean(related);
}
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm Sat Oct 2 16:51:32 2010
@@ -219,7 +219,7 @@
{
for (int i = 0; i < ${field}.size(); i++)
{
- ${fieldContainedType} obj = #if($java5 != "true")($fieldContainedType)#end ${field}.get(i);
+ ${fieldContainedType} obj = ${field}.get(i);
copyObj.${adder}(obj.copy());
}
}
@@ -286,7 +286,7 @@
$getter(con);
for (int i = 0; i < ${field}.size(); i++)
{
- ${fieldContainedType} obj = #if($java5 != "true")($fieldContainedType) #end${field}.get(i);
+ ${fieldContainedType} obj = ${field}.get(i);
copyObj.${adder}(obj.copy());
}
#end
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/getByNameMethods.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/getByNameMethods.vm?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/getByNameMethods.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/getByNameMethods.vm Sat Oct 2 16:51:32 2010
@@ -23,16 +23,15 @@
## This template expects as input a "table" element from the torque schema
## which was processed by the OMTransformer.
##
-#set ( $java5 = $torqueGen.booleanOption("torque.om.java5") )
#set ( $columnElements = $torqueGen.getChildren("column") )
#set ( $peerName = "${peerPackage}.${peerClassName}" )
- private static final List#if($java5)<String>#end FIELD_NAMES;
+ private static final List<String> FIELD_NAMES;
static
{
- List#if($java5)<String>#end fieldNames
- = new ArrayList#if($enableJava5Features)<String>#end();
+ List<String> fieldNames
+ = new ArrayList<String>();
#foreach ($columnElement in $columnElements)
fieldNames.add("${columnElement.getAttribute("javaName")}");
#end
@@ -44,7 +43,7 @@
*
* @return a list of field names
*/
- public static List#if($java5)<String>#end getFieldNames()
+ public static List<String> getFieldNames()
{
return FIELD_NAMES;
}
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/base/baseManager.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/base/baseManager.vm?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/base/baseManager.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/manager/base/baseManager.vm Sat Oct 2 16:51:32 2010
@@ -169,7 +169,7 @@ $torqueGen.mergepoint("serialVersionUid"
* @return a <code>List</code> value
* @exception TorqueException if an error occurs
*/
- public static List#if($java5 == "true")<$dbObjectClassName>#end getInstances(List#if($java5 == "true")<ObjectKey>#end ids)
+ public static List<${dbObjectClassName}> getInstances(List<ObjectKey> ids)
throws TorqueException
{
return getManager().getInstancesImpl(ids);
@@ -184,7 +184,7 @@ $torqueGen.mergepoint("serialVersionUid"
* @return a <code>List</code> value
* @exception TorqueException if an error occurs
*/
- public static List#if($java5 == "true")<$dbObjectClassName>#end getInstances(List#if($java5 == "true")<ObjectKey>#end ids, boolean fromCache)
+ public static List<${dbObjectClassName}> getInstances(List<ObjectKey> ids, boolean fromCache)
throws TorqueException
{
return getManager().getInstancesImpl(ids, fromCache);
@@ -290,7 +290,7 @@ $torqueGen.mergepoint("serialVersionUid"
* @return a <code>List</code> of ${dbObjectClassName}s
* @exception TorqueException if an error occurs
*/
- protected List#if($java5 == "true")<$dbObjectClassName>#end getInstancesImpl(List#if($java5 == "true")<ObjectKey>#end ids)
+ protected List<${dbObjectClassName}> getInstancesImpl(List<ObjectKey> ids)
throws TorqueException
{
return getOMs(ids);
@@ -305,7 +305,7 @@ $torqueGen.mergepoint("serialVersionUid"
* @return a <code>List</code> of ${dbObjectClassName}s
* @exception TorqueException if an error occurs
*/
- protected List#if($java5 == "true")<$dbObjectClassName>#end getInstancesImpl(List#if($java5 == "true")<ObjectKey>#end ids, boolean fromCache)
+ protected List<${dbObjectClassName}> getInstancesImpl(List<ObjectKey> ids, boolean fromCache)
throws TorqueException
{
return getOMs(ids, fromCache);
@@ -335,7 +335,7 @@ $torqueGen.mergepoint("serialVersionUid"
* @return a <code>List</code> value
* @exception TorqueException if an error occurs
*/
- protected List#if($java5 == "true")<$dbObjectClassName>#end retrieveStoredOMs(List ids)
+ protected List<${dbObjectClassName}> retrieveStoredOMs(List ids)
throws TorqueException
{
return ${peerClassName}.retrieveByPKs(ids);
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm Sat Oct 2 16:51:32 2010
@@ -72,8 +72,5 @@ $torqueGen.mergepoint("doSelectJoinAllEx
#end
$torqueGen.mergepoint("getTableMap")
$torqueGen.mergepoint("setDbName")
-#if ($java5 == "true")
-$torqueGen.mergepoint("java5Wrappers")
-#end
$torqueGen.mergepoint("extensions")
}
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/dbObjectClassConstants.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/dbObjectClassConstants.vm?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/dbObjectClassConstants.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/dbObjectClassConstants.vm Sat Oct 2 16:51:32 2010
@@ -32,7 +32,7 @@
"${dbObjectPackage}.${dbObjectClassName}";
/** A class that can be returned by this peer. */
- protected static final Class#if($java5 == "true")<?>#end CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
+ protected static final Class<?> CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
#set ($inheritanceColumnBaseElement = $torqueGen.getChild("inheritance-column"))
#if ($inheritanceColumnBaseElement)
@@ -61,7 +61,7 @@
"${dbObjectPackage}.$class";
/** A class that can be returned by this peer. */
- public static final Class#if($java5 == "true")<?>#end $classConstant =
+ public static final Class<?> $classConstant =
initClass($classnameConstant);
#end
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelect.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelect.vm?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelect.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelect.vm Sat Oct 2 16:51:32 2010
@@ -35,7 +35,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List#if($java5 == "true")<${dbObjectClassName}>#end doSelect(Criteria criteria) throws TorqueException
+ public static List<${dbObjectClassName}> doSelect(Criteria criteria) throws TorqueException
{
return ${peerClassName}.populateObjects(
${peerClassName}.doSelectVillageRecords(criteria));
@@ -50,7 +50,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List#if($java5 == "true")<${dbObjectClassName}>#end doSelect(Criteria criteria, Connection con)
+ public static List<${dbObjectClassName}> doSelect(Criteria criteria, Connection con)
throws TorqueException
{
return ${peerClassName}.populateObjects(
@@ -63,7 +63,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List#if($java5 == "true")<${dbObjectClassName}>#end doSelect($dbObjectClassName obj) throws TorqueException
+ public static List<${dbObjectClassName}> doSelect($dbObjectClassName obj) throws TorqueException
{
return ${peerClassName}.doSelect(${peerClassName}.buildSelectCriteria(obj));
}
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoin.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoin.vm?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoin.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoin.vm Sat Oct 2 16:51:32 2010
@@ -51,7 +51,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- protected static List#if($java5 == "true")<$dbObjectClassName>#end ${peerJoinSelectMethod}(Criteria criteria)
+ protected static List<${dbObjectClassName}> ${peerJoinSelectMethod}(Criteria criteria)
throws TorqueException
{
return $peerClassName.${peerJoinSelectMethod}(criteria, null);
@@ -68,7 +68,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- protected static List#if($java5 == "true")<$dbObjectClassName>#end ${peerJoinSelectMethod}(Criteria criteria, Connection conn)
+ protected static List<$dbObjectClassName> ${peerJoinSelectMethod}(Criteria criteria, Connection conn)
throws TorqueException
{
setDbName(criteria);
@@ -88,21 +88,21 @@
correctBooleans(criteria);
- List#if($java5 == "true")<Record>#end rows;
+ List<Record> rows;
if (conn == null)
{
- rows = BasePeer.doSelect(criteria);
+ rows = BasePeer.doSelectVillageRecords(criteria);
}
else
{
- rows = BasePeer.doSelect(criteria, conn);
+ rows = BasePeer.doSelectVillageRecords(criteria, conn);
}
- List#if($java5 == "true")<$dbObjectClassName>#end results = new ArrayList#if($java5 == "true")<$dbObjectClassName>#end();
+ List<$dbObjectClassName> results = new ArrayList<$dbObjectClassName>();
for (int i = 0; i < rows.size(); i++)
{
- Record row = #if($java5 != "true")(Record)#end rows.get(i);
+ Record row = rows.get(i);
#if ($tableElement.getChild("inheritance-column"))
Class omClass = ${peerClassName}.getOMClass(row, 1);
@@ -122,7 +122,7 @@
boolean newObject = true;
for (int j = 0; j < results.size(); j++)
{
- $dbObjectClassName temp_obj1 = #if($java5 != "true")($dbObjectClassName)#end results.get(j);
+ $dbObjectClassName temp_obj1 = results.get(j);
$joinedDbObject temp_obj2 = temp_obj1.${getterForJoinedDbObject}();
if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
{
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoinAllExcept.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoinAllExcept.vm?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoinAllExcept.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoinAllExcept.vm Sat Oct 2 16:51:32 2010
@@ -49,7 +49,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- protected static List#if($java5 == "true")<${dbObjectClassName}>#end ${peerJoinAllExceptSelectMethod}(Criteria criteria)
+ protected static List<${dbObjectClassName}> ${peerJoinAllExceptSelectMethod}(Criteria criteria)
throws TorqueException
{
return ${peerJoinAllExceptSelectMethod}(criteria, null);
@@ -66,7 +66,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- protected static List#if($java5 == "true")<${dbObjectClassName}>#end ${peerJoinAllExceptSelectMethod}(Criteria criteria, Connection conn)
+ protected static List<${dbObjectClassName}> ${peerJoinAllExceptSelectMethod}(Criteria criteria, Connection conn)
throws TorqueException
{
setDbName(criteria);
@@ -104,21 +104,21 @@
correctBooleans(criteria);
- List#if($java5 == "true")<Record>#end rows;
+ List<Record> rows;
if (conn == null)
{
- rows = BasePeer.doSelect(criteria);
+ rows = BasePeer.doSelectVillageRecords(criteria);
}
else
{
- rows = BasePeer.doSelect(criteria,conn);
+ rows = BasePeer.doSelectVillageRecords(criteria,conn);
}
- List#if($java5 == "true")<${dbObjectClassName}>#end results = new ArrayList#if($java5 == "true")<${dbObjectClassName}>#end();
+ List<${dbObjectClassName}> results = new ArrayList<${dbObjectClassName}>();
for (int i = 0; i < rows.size(); i++)
{
- Record row = #if(!$java5 == "true")(Record)#end rows.get(i);
+ Record row = rows.get(i);
#if ($tableElement.getChild("inheritance-column"))
Class omClass = ${peer}.getOMClass(row, 1);
@@ -162,7 +162,7 @@
${boolean}newObject = true;
for (int j = 0; j < results.size(); j++)
{
- $dbObject temp_obj1 = #if(!$java5 == "true")($dbObject)#end results.get(j);
+ $dbObject temp_obj1 = results.get(j);
$joinedDbObject temp_obj$index = temp_obj1.${getter}();
if (temp_obj${index}.getPrimaryKey().equals(obj${index}.getPrimaryKey()))
{
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectVillageRecords.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectVillageRecords.vm?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectVillageRecords.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectVillageRecords.vm Sat Oct 2 16:51:32 2010
@@ -37,7 +37,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List#if($java5 == "true")<Record>#end doSelectVillageRecords(Criteria criteria)
+ public static List<Record> doSelectVillageRecords(Criteria criteria)
throws TorqueException
{
return ${peerClassName}.doSelectVillageRecords(criteria, (Connection) null);
@@ -52,7 +52,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List#if($java5 == "true")<Record>#end doSelectVillageRecords(Criteria criteria, Connection con)
+ public static List<Record> doSelectVillageRecords(Criteria criteria, Connection con)
throws TorqueException
{
if (criteria.getSelectColumns().size() == 0)
@@ -67,10 +67,10 @@
// order follows the order columns were placed in the Select clause.
if (con == null)
{
- return BasePeer.doSelect(criteria);
+ return BasePeer.doSelectVillageRecords(criteria);
}
else
{
- return BasePeer.doSelect(criteria, con);
+ return BasePeer.doSelectVillageRecords(criteria, con);
}
}
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/populateObjects.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/populateObjects.vm?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/populateObjects.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/populateObjects.vm Sat Oct 2 16:51:32 2010
@@ -34,15 +34,15 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List#if($java5 == "true")<${dbObjectClassName}>#end populateObjects(List#if($java5 == "true")<Record>#end records)
+ public static List<${dbObjectClassName}> populateObjects(List<Record> records)
throws TorqueException
{
- List#if($java5 == "true")<${dbObjectClassName}>#end results = new ArrayList#if($java5 == "true")<${dbObjectClassName}>#end(records.size());
+ List<${dbObjectClassName}> results = new ArrayList<${dbObjectClassName}>(records.size());
// populate the object(s)
for (int i = 0; i < records.size(); i++)
{
- Record row = #if($java5 != "true")(Record)#end records.get(i);
+ Record row = records.get(i);
#if ($torqueGen.getChild("inheritance-column"))
results.add(${peerClassName}.row2Object(
row, 1, ${peerClassName}.getOMClass(row, 1)));
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm Sat Oct 2 16:51:32 2010
@@ -37,13 +37,13 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List#if($java5 == "true")<${dbObjectClassName}>#end resultSet2Objects(java.sql.ResultSet results)
+ public static List<${dbObjectClassName}> resultSet2Objects(java.sql.ResultSet results)
throws TorqueException
{
try
{
QueryDataSet qds = null;
- List#if($java5 == "true")<Record>#end rows = null;
+ List<Record> rows = null;
try
{
qds = new QueryDataSet(results);
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm Sat Oct 2 16:51:32 2010
@@ -130,10 +130,10 @@
#set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") )
criteria.add($peerColumnName, $field);
#end
- List#if($java5 == "true")<${dbObjectClassName}>#end v = doSelect(criteria, con);
+ List<${dbObjectClassName}> v = doSelect(criteria, con);
if (v.size() == 1)
{
- return #if($java5 != "true")(${dbObjectClassName})#end v.get(0);
+ return v.get(0);
}
else
{
@@ -182,7 +182,7 @@
throws TorqueException, NoRowsException, TooManyRowsException
{
Criteria criteria = buildCriteria(pk);
- List#if($java5 == "true")<${dbObjectClassName}>#end v = ${peerClassName}.doSelect(criteria, con);
+ List<${dbObjectClassName}> v = ${peerClassName}.doSelect(criteria, con);
if (v.size() == 0)
{
throw new NoRowsException("Failed to select a row.");
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm Sat Oct 2 16:51:32 2010
@@ -36,11 +36,11 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List#if($java5 == "true")<${dbObjectClassName}>#end retrieveByPKs(List#if($java5 == "true")<ObjectKey>#end pks)
+ public static List<${dbObjectClassName}> retrieveByPKs(List<ObjectKey> pks)
throws TorqueException
{
Connection db = null;
- List#if($java5 == "true")<${dbObjectClassName}>#end retVal = null;
+ List<${dbObjectClassName}> retVal = null;
try
{
db = Torque.getConnection(DATABASE_NAME);
@@ -61,13 +61,13 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List#if($java5 == "true")<${dbObjectClassName}>#end retrieveByPKs(List#if($java5 == "true")<ObjectKey>#end pks, Connection dbcon)
+ public static List<${dbObjectClassName}> retrieveByPKs(List<ObjectKey> pks, Connection dbcon)
throws TorqueException
{
- List#if($java5 == "true")<${dbObjectClassName}>#end objs = null;
+ List<${dbObjectClassName}> objs = null;
if (pks == null || pks.size() == 0)
{
- objs = new LinkedList#if($java5 == "true")<${dbObjectClassName}>#end();
+ objs = new LinkedList<${dbObjectClassName}>();
}
else
{
@@ -77,10 +77,10 @@
#if ($primaryKeyColumnElements.size() == 1)
criteria.addIn(${peerClassName}.$peerColumnName, pks);
#else
- Iterator#if($java5 == "true")<ObjectKey>#end iter = pks.iterator();
+ Iterator<ObjectKey> iter = pks.iterator();
while (iter.hasNext())
{
- ObjectKey pk = #if(!$java5 == "true")(ObjectKey)#end iter.next();
+ ObjectKey pk = iter.next();
SimpleKey[] keys = (SimpleKey[])pk.getValue();
#set ( $i = 0 )
#foreach ($primaryKeyColumnElement in $primaryKeyColumnElements)
Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java?rev=1003834&r1=1003833&r2=1003834&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java Sat Oct 2 16:51:32 2010
@@ -861,7 +861,7 @@ public class DataTest extends BaseRuntim
criteria.addSelectColumn(BookPeer.BOOK_ID);
- BasePeer.doSelect(criteria);
+ BasePeer.doSelectVillageRecords(criteria);
}
/**
@@ -1397,7 +1397,7 @@ public class DataTest extends BaseRuntim
// we need an additional column to select from,
// to indicate the table we want use
criteria.addSelectColumn(AuthorPeer.AUTHOR_ID);
- BasePeer.doSelect(criteria);
+ BasePeer.doSelectVillageRecords(criteria);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org