Author: tfischer
Date: Sat Aug 4 03:49:10 2012
New Revision: 1369258
URL: http://svn.apache.org/viewvc?rev=1369258&view=rev
Log:
Remove deprecated methods and constants from new Criteria object
Modified:
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Criteria.java
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Criterion.java
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Join.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderTest.java
db/torque/torque4/trunk/torque-site/src/site/xdoc/migration-from-torque-3.xml
Modified:
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Criteria.java
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Criteria.java?rev=1369258&r1=1369257&r2=1369258&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Criteria.java
(original)
+++
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Criteria.java
Sat Aug 4 03:49:10 2012
@@ -91,18 +91,6 @@ public class Criteria
/** Comparison type. */
public static final SqlEnum NOT_ILIKE = SqlEnum.NOT_ILIKE;
- /**
- * Comparison type.
- *
- * @deprecated use the methods whereVerbatimSql, andVerbatimSql,
- * orVerbatimSql or the Constructor
- * Criterion(null, null, null, String, Object[])
- * instead of using Criteria.CUSTOM.
- * This constant will be removed in Torque 4.1.
- */
- @Deprecated
- public static final SqlEnum CUSTOM = SqlEnum.CUSTOM;
-
/** Comparison type. */
public static final SqlEnum DISTINCT = SqlEnum.DISTINCT;
@@ -355,27 +343,6 @@ public class Criteria
}
/**
- * Method to return criterion that is not added automatically
- * to this Criteria. This can be used to chain the
- * Criterions to form a more complex where clause.
- *
- * @param column a column (for example TablePeer.COLUMN).
- * @param value The value to compare to.
- * @param comparison the comparison to use.
- *
- * @return A Criterion.
- *
- * @deprecated use the constructor Criterion(Column, Object, SqlEnum)
- * instead.
- */
- @Deprecated
- public Criterion getNewCriterion(Column column, Object value,
- SqlEnum comparison)
- {
- return new Criterion(column, value, comparison);
- }
-
- /**
* Get the Database name to be used for this criterion.
*
* @return The database name, not null.
@@ -993,324 +960,6 @@ public class Criteria
}
}
- /*
- * ------------------------------------------------------------------------
- *
- * Start of the deprecated "add" methods
- *
- * ------------------------------------------------------------------------
- */
-
- /**
- * This method ands a Criterion object with the conditions
- * in this Criteria. This is used as follows:
- * <p>
- * <code>
- * Criteria crit = new Criteria();
- * Criterion c = new Criterion(
- * BasePeer.ID, new Integer(5), Criteria.LESS_THAN);
- * crit.add(c);
- * </code>
- *
- * @param c A Criterion object
- *
- * @return A modified Criteria object.
- *
- * @deprecated The semantics of this method has changed.
- * This method will be removed in a future version of Torque.
- * Use and(...) or where(...) instead.
- */
- @Deprecated
- public Criteria add(Criterion c)
- {
- if (topLevelCriterion == null)
- {
- topLevelCriterion = c;
- }
- else
- {
- topLevelCriterion.and(c);
- }
- return this;
- }
-
- /**
- * This method ands the given condition with the current conditions
- * in the Criteria.
- * An EQUAL comparison is used for column and value.
- *
- * @param lValue The left hand side of the comparison, not null.
- * If this object implements the Column interface, it is interpreted
- * as a (pseudo)column.
- * If this object is c Criteria, it is interpreted as a subselect.
- * In all other cases, (e.G. string object), it is interpreted as
- * literal value.
- * @param rValue The right hand side of the comparison, may be null.
- * If this object implements the Column interface, it is interpreted
- * as a (pseudo)column.
- * If this object is c Criteria, it is interpreted as a subselect.
- * In all other cases, (e.G. string object), it is interpreted as
- * literal value.
- *
- * @return A modified Criteria object.
- * @deprecated The semantics of this method has changed.
- * This method will be removed in a future version of Torque.
- * Use and(...) or where(...) instead.
- */
- @Deprecated
- public Criteria add(Object lValue, Object rValue)
- {
- add(lValue, rValue, EQUAL);
- return this;
- }
-
- /**
- * This method ands the given condition with the current conditions
- * in the Criteria.
- *
- * @param lValue The left hand side of the comparison, not null.
- * If this object implements the Column interface, it is interpreted
- * as a (pseudo)column.
- * If this object is c Criteria, it is interpreted as a subselect.
- * In all other cases, (e.G. string object), it is interpreted as
- * literal value.
- * @param rValue The right hand side of the comparison, may be null.
- * If this object implements the Column interface, it is interpreted
- * as a (pseudo)column.
- * If this object is c Criteria, it is interpreted as a subselect.
- * In all other cases, (e.G. string object), it is interpreted as
- * literal value.
- * @param comparison The comparison operator.
- *
- * @return A modified Criteria object.
- *
- * @deprecated The semantics of this method has changed.
- * This method will be removed in a future version of Torque.
- * Use and(...) or where(...) instead.
- */
- @Deprecated
- public Criteria add(Object lValue, Object rValue, SqlEnum comparison)
- {
- Criterion newCriterion;
- if (comparison == Criteria.CUSTOM)
- {
- newCriterion = new Criterion(
- lValue,
- null,
- null,
- (String) rValue,
- null);
- }
- else
- {
- newCriterion = new Criterion(lValue, rValue, comparison);
- }
- if (topLevelCriterion == null)
- {
- topLevelCriterion = newCriterion;
- }
- else
- {
- topLevelCriterion.and(newCriterion);
- }
- return this;
- }
-
- /**
- * Convenience method to add a Date object specified by
- * year, month, and date into the Criteria. Equal to
- * <p>
- * <code>
- * add(column, new GregorianCalendar(year, month, day), EQUAL);
- * </code>
- *
- * @param lValue The value to compare the date to, not null.
- * If this object implements the Column interface, it is interpreted
- * as a (pseudo)column.
- * If this object is c Criteria, it is interpreted as a subselect.
- * In all other cases, (e.G. string object), it is interpreted as
- * literal value.
- * @param year An int with the year.
- * @param month An int with the month. Month value is 0-based.
- * e.g., 0 for January
- * @param day An int with the day.
- * @return A modified Criteria object.
- * @deprecated The semantics of this method has changed.
- * This method will be removed in a future version of Torque.
- * Use and(...) or where(...) instead.
- */
- @Deprecated
- public Criteria addDate(Object lValue, int year, int month, int day)
- {
- add(lValue,
- new GregorianCalendar(year, month, day).getTime(),
- EQUAL);
- return this;
- }
-
- /**
- * Convenience method to add a Date object specified by
- * year, month, and date into the Criteria. Equal to
- * <p>
- * <code>
- * add(column, new GregorianCalendar(year, month, day), comparison);
- * </code>
- *
- * @param lValue The value to compare the date to, not null.
- * If this object implements the Column interface, it is interpreted
- * as a (pseudo)column.
- * If this object is c Criteria, it is interpreted as a subselect.
- * In all other cases, (e.G. string object), it is interpreted as
- * literal value.
- * @param year An int with the year.
- * @param month An int with the month. Month value is 0-based.
- * e.g., 0 for January
- * @param day An int with the day.
- * @param comparison String describing how to compare the column with
- * the value.
- *
- * @return A modified Criteria object.
- * @deprecated The semantics of this method has changed.
- * This method will be removed in a future version of Torque.
- * Use and(...) or where(...) instead.
- */
- @Deprecated
- public Criteria addDate(Object lValue, int year, int month, int day,
- SqlEnum comparison)
- {
- add(lValue, new GregorianCalendar(year, month, day).getTime(),
- comparison);
- return this;
- }
-
- /**
- * Adds an 'IN' clause with the value supplied as an Object
- * array. For example, to add the condition
- * <p>
- * FOO.NAME IN ('FOO', 'BAR', 'ZOW')
- * <p> use <p>
- * <code>
- * criteria.addIn(FooPeer.NAME, new String[] {'FOO', 'BAR', 'ZOW'});
- * </code>
- *
- * @param lValue The value which is checked for containment, not null.
- * If this object implements the Column interface, it is interpreted
- * as a (pseudo)column.
- * If this object is c Criteria, it is interpreted as a subselect.
- * In all other cases, (e.G. string object), it is interpreted as
- * literal value.
- * @param rValues The values to check against, not null.
- *
- * @return A modified Criteria object.
- * @deprecated The semantics of this method has changed.
- * This method will be removed in a future version of Torque.
- * Use and(...) or where(...) instead.
- */
- @Deprecated
- public Criteria addIn(Object lValue, Object[] rValues)
- {
- add(lValue, rValues, Criteria.IN);
- return this;
- }
-
- /**
- /**
- * Adds an 'IN' clause with the criteria supplied as a Collection.
- * For example, to add the condition
- * <p>
- * FOO.NAME IN ('FOO', 'BAR', 'ZOW')
- * <p> use <p>
- * <code>
- * criteria.addIn(FooPeer.NAME, values);
- * </code>
- *
- * where 'values' contains three Strings "FOO", "BAR" and "ZOW".
- *
- * @param lValue The value which is checked for containment, not null.
- * If this object implements the Column interface, it is interpreted
- * as a (pseudo)column.
- * If this object is c Criteria, it is interpreted as a subselect.
- * In all other cases, (e.G. string object), it is interpreted as
- * literal value.
- * @param rValues The values to check against, not null.
- *
- * @return A modified Criteria object.
- * @deprecated The semantics of this method has changed.
- * This method will be removed in a future version of Torque.
- * Use and(...) or where(...) instead.
- */
- @Deprecated
- public Criteria addIn(Object lValue, Collection<?> rValues)
- {
- add(lValue, rValues, Criteria.IN);
- return this;
- }
-
-
- /**
- * Adds an 'NOT IN' clause with the value supplied as an Object
- * array. For example, to add the condition
- * <p>
- * FOO.NAME NOT IN ('FOO', 'BAR', 'ZOW')
- * <p> use <p>
- * <code>
- * criteria.addNotIn(FooPeer.NAME, new String[] {'FOO', 'BAR', 'ZOW'});
- * </code>
- *
- * @param lValue The value which is checked for containment, not null.
- * If this object implements the Column interface, it is interpreted
- * as a (pseudo)column.
- * If this object is c Criteria, it is interpreted as a subselect.
- * In all other cases, (e.G. string object), it is interpreted as
- * literal value.
- * @param rValues The values to check against, not null.
- *
- * @return A modified Criteria object.
- * @deprecated The semantics of this method has changed.
- * This method will be removed in a future version of Torque.
- * Use and(...) or where(...) instead.
- */
- @Deprecated
- public Criteria addNotIn(Object lValue, Object[] rValues)
- {
- add(lValue, rValues, Criteria.NOT_IN);
- return this;
- }
-
- /**
- /**
- * Adds an 'NOT IN' clause with the criteria supplied as a Collection.
- * For example, to add the condition
- * <p>
- * FOO.NAME NOT IN ('FOO', 'BAR', 'ZOW')
- * <p> use <p>
- * <code>
- * criteria.addNotIn(FooPeer.NAME, values);
- * </code>
- *
- * where 'values' contains three Strings "FOO", "BAR" and "ZOW".
- *
- * @param lValue The value which is checked for containment, not null.
- * If this object implements the Column interface, it is interpreted
- * as a (pseudo)column.
- * If this object is c Criteria, it is interpreted as a subselect.
- * In all other cases, (e.G. string object), it is interpreted as
- * literal value.
- * @param rValues The values to check against, not null.
- *
- * @return A modified Criteria object.
- * @deprecated The semantics of this method has changed.
- * This method will be removed in a future version of Torque.
- * Use and(...) or where(...) instead.
- */
- @Deprecated
- public Criteria addNotIn(Object lValue, Collection<?> rValues)
- {
- add(lValue, rValues, Criteria.NOT_IN);
- return this;
- }
-
-
/*
* ------------------------------------------------------------------------
*
@@ -1391,10 +1040,11 @@ public class Criteria
*
* @return A modified Criteria object.
*/
+ @SuppressWarnings("deprecation")
public Criteria and(Object lValue, Object rValue, SqlEnum comparison)
{
Criterion newCriterion;
- if (comparison == Criteria.CUSTOM)
+ if (comparison == SqlEnum.CUSTOM)
{
newCriterion = new Criterion(
lValue,
@@ -1704,10 +1354,11 @@ public class Criteria
*
* @return A modified Criteria object.
*/
+ @SuppressWarnings("deprecation")
public Criteria or(Object lValue, Object rValue, SqlEnum comparison)
{
Criterion newCriterion;
- if (comparison == Criteria.CUSTOM)
+ if (comparison == SqlEnum.CUSTOM)
{
newCriterion = new Criterion(
lValue,
Modified:
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Criterion.java
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Criterion.java?rev=1369258&r1=1369257&r2=1369258&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Criterion.java
(original)
+++
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Criterion.java
Sat Aug 4 03:49:10 2012
@@ -420,6 +420,7 @@ public class Criterion implements Serial
* Appends a debug String representation of the Criterion
* onto the String builder.
*/
+ @SuppressWarnings("deprecation")
public void appendTo(StringBuilder sb)
{
if (isComposite())
@@ -445,7 +446,7 @@ public class Criterion implements Serial
}
else
{
- if (Criteria.CUSTOM == comparison)
+ if (SqlEnum.CUSTOM == comparison)
{
if (rValue != null && !"".equals(rValue))
{
Modified:
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Join.java
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Join.java?rev=1369258&r1=1369257&r2=1369258&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Join.java
(original)
+++
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Join.java
Sat Aug 4 03:49:10 2012
@@ -72,6 +72,7 @@ public class Join implements Serializabl
* are null.
* @throws IllegalArgumentException if comparison id SqlEnum.CUSTOM
*/
+ @SuppressWarnings("deprecation")
public Join(
final Column leftColumn,
final Column rightColumn,
Modified:
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderTest.java
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderTest.java?rev=1369258&r1=1369257&r2=1369258&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderTest.java
(original)
+++
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderTest.java
Sat Aug 4 03:49:10 2012
@@ -1436,7 +1436,7 @@ public class SqlBuilderTest extends Base
{
Criteria criteria = new Criteria();
criteria.addSelectColumn(new ColumnImpl("table.column"));
- criteria.where("A", "A = functionOf(B)", Criteria.CUSTOM);
+ criteria.where("A", "A = functionOf(B)", SqlEnum.CUSTOM);
Query query = SqlBuilder.buildQuery(criteria);
assertEquals("SELECT table.column FROM table WHERE A = functionOf(B)",
query.toString());
@@ -1447,7 +1447,7 @@ public class SqlBuilderTest extends Base
{
Criteria criteria = new Criteria();
criteria.addSelectColumn(new ColumnImpl("table.column"));
- criteria.where(null, "A = functionOf(B)", Criteria.CUSTOM);
+ criteria.where(null, "A = functionOf(B)", SqlEnum.CUSTOM);
Query query = SqlBuilder.buildQuery(criteria);
assertEquals("SELECT table.column FROM table WHERE A = functionOf(B)",
query.toString());
@@ -1459,7 +1459,7 @@ public class SqlBuilderTest extends Base
Criteria criteria = new Criteria();
criteria.addSelectColumn(new ColumnImpl("table.column"));
Criterion criterion
- = new Criterion("A", "A = functionOf(B)", Criteria.CUSTOM);
+ = new Criterion("A", "A = functionOf(B)", SqlEnum.CUSTOM);
criteria.where(criterion);
Query query = SqlBuilder.buildQuery(criteria);
assertEquals("SELECT table.column FROM table WHERE A = functionOf(B)",
@@ -1472,7 +1472,7 @@ public class SqlBuilderTest extends Base
Criteria criteria = new Criteria();
criteria.addSelectColumn(new ColumnImpl("table.column"));
Criterion criterion
- = new Criterion("A", 3, Criteria.CUSTOM);
+ = new Criterion("A", 3, SqlEnum.CUSTOM);
criteria.where(criterion);
try
{
Modified:
db/torque/torque4/trunk/torque-site/src/site/xdoc/migration-from-torque-3.xml
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-site/src/site/xdoc/migration-from-torque-3.xml?rev=1369258&r1=1369257&r2=1369258&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-site/src/site/xdoc/migration-from-torque-3.xml
(original)
+++
db/torque/torque4/trunk/torque-site/src/site/xdoc/migration-from-torque-3.xml
Sat Aug 4 03:49:10 2012
@@ -55,6 +55,9 @@
in the first argument as Strings, not as column names
(e.g. criteria.and("string1", "string2") has a different meaning in
the old and the new Criteria).
+ Also the new Criteria object does not define the operator
+ Criteria.CUSTOM any more, but instead contains the methods
+ andVerbatimSql() and orVerbatimSql().
</li>
<li>
Database views are now supported out-of-the-box.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]