You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2009/11/16 13:41:30 UTC
svn commit: r880730 [1/2] - in /cayenne/main/trunk/framework:
cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/
cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/
cayenne-jdk1.5-unpublished/src/main/java/org/apache/cay...
Author: aadamchik
Date: Mon Nov 16 12:41:26 2009
New Revision: 880730
URL: http://svn.apache.org/viewvc?rev=880730&view=rev
Log:
CAY-1310 Remove everything deprecated in 3.0
first pass , more to come
Removed:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/AbstractType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/DefaultType.java
cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/gen/AntClassGenerator.java
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/BaseContext.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContext.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BigDecimalType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BigIntegerType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BooleanType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ByteArrayType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ByteType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/CalendarType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/CharType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/DateType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/DoubleType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/EnumType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedEnumType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedTypeDecorator.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/FloatType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/IntegerType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/LongType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ObjectType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ShortType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/TimeType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/TimestampType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/UUIDType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/UtilDateType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/VoidType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/NestedQueryCache.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/AutoAdapter.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/DbAdapter.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/JdbcAdapter.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBNoSchemaAdapter.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteAdapter.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteBigDecimalType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteByteArrayType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteCalendarType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteFloatType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/DefaultQueryMetadata.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQuery.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadata.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadataWrapper.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplate.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/IncrementalQuery.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/IncrementalSelectQuery.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/RangeQuery.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/StringET1ExtendedType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextPaginatedListCachingTest.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextWithDataContextTest.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextPaginatedQueryTest.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextPrefetchTest.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextRefreshQueryTest.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataNodeTest.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/types/MockExtendedType.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/MockDbAdapter.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_207StringType1.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_207StringType2.java
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/BaseContext.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/BaseContext.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/BaseContext.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/BaseContext.java Mon Nov 16 12:41:26 2009
@@ -130,15 +130,6 @@
@SuppressWarnings("unchecked")
public abstract List performQuery(Query query);
- /**
- * @deprecated since 3.0 this method is replaced by
- * {@link #prepareForAccess(Persistent, String, boolean)}.
- */
- @Deprecated
- public void prepareForAccess(Persistent object, String property) {
- prepareForAccess(object, property, false);
- }
-
public void prepareForAccess(Persistent object, String property, boolean lazyFaulting) {
if (object.getPersistenceState() == PersistenceState.HOLLOW) {
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContext.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContext.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContext.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContext.java Mon Nov 16 12:41:26 2009
@@ -118,12 +118,6 @@
void prepareForAccess(Persistent object, String property, boolean lazyFaulting);
/**
- * @deprecated since 3.0 use {@link #prepareForAccess(Persistent, String, boolean)}.
- */
- @Deprecated
- void prepareForAccess(Persistent object, String property);
-
- /**
* A callback method that child Persistent objects are expected to call from inside
* the setter after modifying a value of a persistent property, including "simple" and
* "arc" properties.
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BigDecimalType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BigDecimalType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BigDecimalType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BigDecimalType.java Mon Nov 16 12:41:26 2009
@@ -23,10 +23,6 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.BeanValidationFailure;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
* @since 3.0
*/
@@ -60,23 +56,4 @@
}
}
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- if (dbAttribute.isMandatory() && value == null) {
- validationResult.addFailure(new BeanValidationFailure(source, property, "'"
- + property
- + "' must be not null"));
- return false;
- }
-
- return true;
- }
-
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BigIntegerType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BigIntegerType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BigIntegerType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BigIntegerType.java Mon Nov 16 12:41:26 2009
@@ -24,8 +24,6 @@
import java.sql.ResultSet;
import org.apache.cayenne.dba.TypesMapping;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.ValidationResult;
/**
* @since 3.0
@@ -74,16 +72,4 @@
+ TypesMapping.getSqlNameByType(type));
}
}
-
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- return true;
- }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BooleanType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BooleanType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BooleanType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/BooleanType.java Mon Nov 16 12:41:26 2009
@@ -24,13 +24,10 @@
import java.sql.ResultSet;
import java.sql.Types;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
- * Handles <code>java.lang.Boolean</code> mapping. Note that "materialize*" methods
- * return either Boolean.TRUE or Boolean.FALSE, instead of creating new Boolean instances
- * using contructor. This makes possible identity comparison such as
+ * Handles <code>java.lang.Boolean</code> mapping. Note that "materialize*" methods return
+ * either Boolean.TRUE or Boolean.FALSE, instead of creating new Boolean instances using
+ * constructor. This makes possible identity comparison such as
* <code>object.getBooleanProperty() == Boolean.TRUE</code>.
*
* @since 1.2
@@ -41,23 +38,6 @@
return Boolean.class.getName();
}
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- return AbstractType.validateNull(
- source,
- property,
- value,
- dbAttribute,
- validationResult);
- }
-
public void setJdbcObject(
PreparedStatement st,
Object val,
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ByteArrayType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ByteArrayType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ByteArrayType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ByteArrayType.java Mon Nov 16 12:41:26 2009
@@ -31,10 +31,7 @@
import java.sql.Types;
import org.apache.cayenne.CayenneException;
-import org.apache.cayenne.map.DbAttribute;
import org.apache.cayenne.util.MemoryBlob;
-import org.apache.cayenne.validation.BeanValidationFailure;
-import org.apache.cayenne.validation.ValidationResult;
/**
* Handles <code>byte[]</code>, mapping it as either of JDBC types - BLOB or (VAR)BINARY.
@@ -78,45 +75,6 @@
return "byte[]";
}
- /**
- * Validates byte[] property.
- *
- * @since 1.1
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
-
- if (!(value instanceof byte[])) {
- return true;
- }
-
- if (dbAttribute.getMaxLength() <= 0) {
- return true;
- }
-
- byte[] bytes = (byte[]) value;
- if (bytes.length > dbAttribute.getMaxLength()) {
- String message = "\""
- + property
- + "\" exceeds maximum allowed length ("
- + dbAttribute.getMaxLength()
- + " bytes): "
- + bytes.length;
- validationResult.addFailure(new BeanValidationFailure(
- source,
- property,
- message));
- return false;
- }
-
- return true;
- }
-
public Object materializeObject(ResultSet rs, int index, int type) throws Exception {
byte[] bytes = null;
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ByteType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ByteType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ByteType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ByteType.java Mon Nov 16 12:41:26 2009
@@ -23,10 +23,6 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.BeanValidationFailure;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
* Handles <code>java.lang.Byte</code> type mapping. Can be configured to recast
* java.lang.Byte to java.lang.Integer when binding values to PreparedStatement. This is a
@@ -80,19 +76,4 @@
}
}
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- if (dbAttribute.isMandatory() && value == null) {
- validationResult.addFailure(new BeanValidationFailure(source, property, "'"
- + property
- + "' must be not null"));
- return false;
- }
-
- return true;
- }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/CalendarType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/CalendarType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/CalendarType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/CalendarType.java Mon Nov 16 12:41:26 2009
@@ -28,8 +28,6 @@
import org.apache.cayenne.CayenneRuntimeException;
import org.apache.cayenne.dba.TypesMapping;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.ValidationResult;
/**
* ExtendedType that handles {@link java.util.Calendar} fields.
@@ -175,15 +173,4 @@
+ TypesMapping.getSqlNameByType(type));
}
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- return true;
- }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/CharType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/CharType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/CharType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/CharType.java Mon Nov 16 12:41:26 2009
@@ -31,9 +31,6 @@
import java.sql.Types;
import org.apache.cayenne.CayenneException;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.BeanValidationFailure;
-import org.apache.cayenne.validation.ValidationResult;
/**
* Handles <code>java.lang.String</code>, mapping it as either of JDBC types - CLOB or
@@ -58,46 +55,6 @@
return String.class.getName();
}
- /**
- * Validates string property.
- *
- * @since 1.1
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
-
- if (!(value instanceof String)) {
- return true;
- }
-
- if (dbAttribute.getMaxLength() <= 0) {
- return true;
- }
-
- String string = (String) value;
- if (string.length() > dbAttribute.getMaxLength()) {
- String message = "\""
- + property
- + "\" exceeds maximum allowed length ("
- + dbAttribute.getMaxLength()
- + " chars): "
- + string.length();
- validationResult.addFailure(new BeanValidationFailure(
- source,
- property,
- message));
-
- return false;
- }
-
- return true;
- }
-
/** Return trimmed string. */
public Object materializeObject(ResultSet rs, int index, int type) throws Exception {
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/DateType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/DateType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/DateType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/DateType.java Mon Nov 16 12:41:26 2009
@@ -23,10 +23,6 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.BeanValidationFailure;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
* @since 3.0
*/
@@ -60,22 +56,4 @@
}
}
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- if (dbAttribute.isMandatory() && value == null) {
- validationResult.addFailure(new BeanValidationFailure(source, property, "'"
- + property
- + "' must be not null"));
- return false;
- }
-
- return true;
- }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/DoubleType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/DoubleType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/DoubleType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/DoubleType.java Mon Nov 16 12:41:26 2009
@@ -22,10 +22,6 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.BeanValidationFailure;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
* @since 3.0
*/
@@ -60,23 +56,4 @@
statement.setDouble(pos, ((Number) value).doubleValue());
}
}
-
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- if (dbAttribute.isMandatory() && value == null) {
- validationResult.addFailure(new BeanValidationFailure(source, property, "'"
- + property
- + "' must be not null"));
- return false;
- }
-
- return true;
- }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/EnumType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/EnumType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/EnumType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/EnumType.java Mon Nov 16 12:41:26 2009
@@ -25,8 +25,6 @@
import java.sql.ResultSet;
import org.apache.cayenne.dba.TypesMapping;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.ValidationResult;
/**
* An ExtendedType that handles an enum class. If Enum is mapped to a character column,
@@ -65,24 +63,6 @@
return enumClass.getName();
}
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
-
- return AbstractType.validateNull(
- source,
- property,
- value,
- dbAttribute,
- validationResult);
- }
-
public void setJdbcObject(
PreparedStatement statement,
Object value,
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedEnumType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedEnumType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedEnumType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedEnumType.java Mon Nov 16 12:41:26 2009
@@ -29,28 +29,22 @@
import org.apache.cayenne.CayenneRuntimeException;
import org.apache.cayenne.ExtendedEnumeration;
import org.apache.cayenne.dba.TypesMapping;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.ValidationResult;
/**
- * An ExtendedType that handles a Java Enum based upon the Cayenne
- * ExtendedEnumeration interface. The ExtendedEnumeration interface
- * requires the developer to specify the database values for the Enum
- * being mapped. This ExtendedType is used to auto-register those
- * Enums found in the model.
- * <p>
- * <i>Requires Java 1.5 or newer</i>
- * </p>
+ * An ExtendedType that handles a Java Enum based upon the Cayenne ExtendedEnumeration
+ * interface. The ExtendedEnumeration interface requires the developer to specify the
+ * database values for the Enum being mapped. This ExtendedType is used to auto-register
+ * those Enums found in the model.
*
* @since 3.0
*/
-public class ExtendedEnumType<T extends Enum<T>> implements ExtendedType
-{
+public class ExtendedEnumType<T extends Enum<T>> implements ExtendedType {
+
private Class<T> enumerationClass = null;
- private Object[] values = null;
+ private Object[] values = null;
// Contains a mapping of database values (Integer or String) and the
- // Enum for that value. This is to facilitate mapping database values
+ // Enum for that value. This is to facilitate mapping database values
// back to the Enum upon reading them from the database.
private Map<Object, Enum<T>> enumerationMappings = new HashMap<Object, Enum<T>>();
@@ -66,8 +60,9 @@
values = (Object[]) m.invoke(null);
for (int i = 0; i < values.length; i++)
- register((Enum<T>) values[i], ((ExtendedEnumeration) values[i]).getDatabaseValue());
-
+ register((Enum<T>) values[i], ((ExtendedEnumeration) values[i])
+ .getDatabaseValue());
+
}
catch (Exception e) {
throw new IllegalArgumentException("Class "
@@ -123,57 +118,43 @@
}
/**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- return AbstractType.validateNull(
- source,
- property,
- value,
- dbAttribute,
- validationResult);
- }
-
- /**
* Register the given enum with the mapped database value.
*/
- private void register(Enum<T> enumeration, Object databaseValue)
- {
- // Check for duplicates.
- if (enumerationMappings.containsKey(databaseValue) || enumerationMappings.containsValue(enumeration))
- throw new CayenneRuntimeException("Enumerations/values may not be duplicated.");
+ private void register(Enum<T> enumeration, Object databaseValue) {
+ // Check for duplicates.
+ if (enumerationMappings.containsKey(databaseValue)
+ || enumerationMappings.containsValue(enumeration))
+ throw new CayenneRuntimeException(
+ "Enumerations/values may not be duplicated.");
- // Store by database value/enum because we have to lookup by db value later.
- enumerationMappings.put(databaseValue, enumeration);
+ // Store by database value/enum because we have to lookup by db value later.
+ enumerationMappings.put(databaseValue, enumeration);
}
/**
* Lookup the giving database value and return the matching enum.
*/
- private Enum<T> lookup(Object databaseValue)
- {
- if (enumerationMappings.containsKey(databaseValue) == false)
- {
- // All integers enums are mapped. Not necessarily all strings.
- if (databaseValue instanceof Integer)
- throw new CayenneRuntimeException("Missing enumeration mapping for " + getClassName() + " with value " + databaseValue + ".");
-
- // Use the database value (a String) as the enum value.
- return Enum.valueOf(enumerationClass, (String) databaseValue);
- }
+ private Enum<T> lookup(Object databaseValue) {
+ if (enumerationMappings.containsKey(databaseValue) == false) {
+ // All integers enums are mapped. Not necessarily all strings.
+ if (databaseValue instanceof Integer)
+ throw new CayenneRuntimeException("Missing enumeration mapping for "
+ + getClassName()
+ + " with value "
+ + databaseValue
+ + ".");
+
+ // Use the database value (a String) as the enum value.
+ return Enum.valueOf(enumerationClass, (String) databaseValue);
+ }
- // Mapped value->enum exists, return it.
- return enumerationMappings.get(databaseValue);
+ // Mapped value->enum exists, return it.
+ return enumerationMappings.get(databaseValue);
}
/**
- * Returns the enumeration mapping for this enumerated data type. The
- * key is the database value, the value is the actual enum.
+ * Returns the enumeration mapping for this enumerated data type. The key is the
+ * database value, the value is the actual enum.
*/
public Map<Object, Enum<T>> getEnumerationMappings() {
return enumerationMappings;
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedType.java Mon Nov 16 12:41:26 2009
@@ -23,13 +23,9 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
* Defines methods to read Java objects from JDBC ResultSets and write as parameters of
* PreparedStatements.
- *
*/
public interface ExtendedType {
@@ -39,22 +35,6 @@
String getClassName();
/**
- * Performs validation of an object property. Property is considered valid if this it
- * satisfies the database constraints known to this ExtendedType. In case of
- * validation failure, failures are appended to the ValidationResult object and
- * <code>false</code> is returned.
- *
- * @since 1.1
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult);
-
- /**
* Initializes a single parameter of a PreparedStatement with object value.
*/
void setJdbcObject(
@@ -68,7 +48,7 @@
* Reads an object from JDBC ResultSet column, converting it to class returned by
* 'getClassName' method.
*
- * @throws Exception if read error ocurred, or an object can't be converted to a
+ * @throws Exception if read error occurred, or an object can't be converted to a
* target Java class.
*/
Object materializeObject(ResultSet rs, int index, int type) throws Exception;
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedTypeDecorator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedTypeDecorator.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedTypeDecorator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ExtendedTypeDecorator.java Mon Nov 16 12:41:26 2009
@@ -22,9 +22,6 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
* Decorates another ExtendedType, converting objects to other Java types.
*
@@ -61,22 +58,4 @@
int precision) throws Exception {
decorated.setJdbcObject(statement, fromJavaObject(value), pos, type, precision);
}
-
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
-
- return decorated.validateProperty(
- source,
- property,
- value,
- dbAttribute,
- validationResult);
- }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/FloatType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/FloatType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/FloatType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/FloatType.java Mon Nov 16 12:41:26 2009
@@ -22,10 +22,6 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.BeanValidationFailure;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
* @since 3.0
*/
@@ -61,22 +57,4 @@
}
}
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- if (dbAttribute.isMandatory() && value == null) {
- validationResult.addFailure(new BeanValidationFailure(source, property, "'"
- + property
- + "' must be not null"));
- return false;
- }
-
- return true;
- }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/IntegerType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/IntegerType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/IntegerType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/IntegerType.java Mon Nov 16 12:41:26 2009
@@ -22,10 +22,6 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.BeanValidationFailure;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
* @since 3.0
*/
@@ -61,23 +57,4 @@
}
}
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- if (dbAttribute.isMandatory() && value == null) {
- validationResult.addFailure(new BeanValidationFailure(source, property, "'"
- + property
- + "' must be not null"));
- return false;
- }
-
- return true;
- }
-
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/LongType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/LongType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/LongType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/LongType.java Mon Nov 16 12:41:26 2009
@@ -22,10 +22,6 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.BeanValidationFailure;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
* @since 3.0
*/
@@ -61,23 +57,4 @@
}
}
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- if (dbAttribute.isMandatory() && value == null) {
- validationResult.addFailure(new BeanValidationFailure(source, property, "'"
- + property
- + "' must be not null"));
- return false;
- }
-
- return true;
- }
-
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ObjectType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ObjectType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ObjectType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ObjectType.java Mon Nov 16 12:41:26 2009
@@ -22,10 +22,6 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.BeanValidationFailure;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
* This is a default ExtendedType that relies on JDBC driver to determine the result type.
*
@@ -60,20 +56,4 @@
}
}
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- if (dbAttribute.isMandatory() && value == null) {
- validationResult.addFailure(new BeanValidationFailure(source, property, "'"
- + property
- + "' must be not null"));
- return false;
- }
-
- return true;
- }
-
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ShortType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ShortType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ShortType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/ShortType.java Mon Nov 16 12:41:26 2009
@@ -23,10 +23,6 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.BeanValidationFailure;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
* Handles <code>java.lang.Short</code> type mapping. Can be configured to recast
* java.lang.Short to java.lang.Integer when binding values to PreparedStatement. This is
@@ -79,21 +75,4 @@
}
}
}
-
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
-
- if (dbAttribute.isMandatory() && value == null) {
- validationResult.addFailure(new BeanValidationFailure(source, property, "'"
- + property
- + "' must be not null"));
- return false;
- }
-
- return true;
- }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/TimeType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/TimeType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/TimeType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/TimeType.java Mon Nov 16 12:41:26 2009
@@ -23,10 +23,6 @@
import java.sql.ResultSet;
import java.sql.Time;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.BeanValidationFailure;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
* @since 3.0
*/
@@ -59,23 +55,4 @@
statement.setTime(pos, (Time) value);
}
}
-
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- if (dbAttribute.isMandatory() && value == null) {
- validationResult.addFailure(new BeanValidationFailure(source, property, "'"
- + property
- + "' must be not null"));
- return false;
- }
-
- return true;
- }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/TimestampType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/TimestampType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/TimestampType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/TimestampType.java Mon Nov 16 12:41:26 2009
@@ -21,13 +21,8 @@
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import java.sql.Time;
import java.sql.Timestamp;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.BeanValidationFailure;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
* @since 3.0
*/
@@ -61,22 +56,4 @@
}
}
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- if (dbAttribute.isMandatory() && value == null) {
- validationResult.addFailure(new BeanValidationFailure(source, property, "'"
- + property
- + "' must be not null"));
- return false;
- }
-
- return true;
- }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/UUIDType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/UUIDType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/UUIDType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/UUIDType.java Mon Nov 16 12:41:26 2009
@@ -24,8 +24,6 @@
import java.util.UUID;
import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.ValidationResult;
/**
* An ExtendedType to map Java UUIDs as persistent attributes.
@@ -87,16 +85,4 @@
}
}
- /**
- * @deprecated since 3.0
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- return true;
- }
-
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/UtilDateType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/UtilDateType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/UtilDateType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/UtilDateType.java Mon Nov 16 12:41:26 2009
@@ -27,8 +27,6 @@
import org.apache.cayenne.CayenneRuntimeException;
import org.apache.cayenne.dba.TypesMapping;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.ValidationResult;
/**
* Maps <code>java.util.Date</code> to any of the three database date/time types: TIME,
@@ -43,22 +41,6 @@
return Date.class.getName();
}
- /**
- * Always returns true indicating no validation failures. There is no date-specific
- * validations at the moment.
- *
- * @since 1.1
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- return true;
- }
-
protected Object convertToJdbcObject(Object val, int type) throws Exception {
if (type == Types.DATE)
return new java.sql.Date(((Date) val).getTime());
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/VoidType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/VoidType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/VoidType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/types/VoidType.java Mon Nov 16 12:41:26 2009
@@ -23,9 +23,6 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.ValidationResult;
-
/**
* A noop type that is sometimes useful to suppress extended types operations. It will set
* and get null values.
@@ -38,18 +35,6 @@
return Void.TYPE.getName();
}
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- return true;
- }
-
public void setJdbcObject(
PreparedStatement statement,
Object value,
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/NestedQueryCache.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/NestedQueryCache.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/NestedQueryCache.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/NestedQueryCache.java Mon Nov 16 12:41:26 2009
@@ -133,14 +133,6 @@
return qualifiedKey(mdDelegate.getCacheKey());
}
- /**
- * @deprecated since 3.0 in favor of 'getCacheStrategy'.
- */
- @Deprecated
- public String getCachePolicy() {
- return mdDelegate.getCachePolicy();
- }
-
public QueryCacheStrategy getCacheStrategy() {
return mdDelegate.getCacheStrategy();
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/AutoAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/AutoAdapter.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/AutoAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/AutoAdapter.java Mon Nov 16 12:41:26 2009
@@ -66,7 +66,7 @@
final static String DEFAULT_QUOTE_SQL_IDENTIFIERS_CHAR_START = "\"";
final static String DEFAULT_QUOTE_SQL_IDENTIFIERS_CHAR_END = "\"";
-
+
static final List<DbAdapterFactory> defaultFactories;
static {
defaultFactories = new ArrayList<DbAdapterFactory>();
@@ -212,14 +212,6 @@
return getAdapter().getAction(query, node);
}
- /**
- * @deprecated since 3.0 - almost all DB's support FK's now and also this flag is less
- * relevant for Cayenne now.
- */
- public boolean supportsFkConstraints() {
- return getAdapter().supportsFkConstraints();
- }
-
public boolean supportsUniqueConstraints() {
return getAdapter().supportsUniqueConstraints();
}
@@ -232,13 +224,6 @@
return getAdapter().supportsBatchUpdates();
}
- /**
- * @deprecated since 3.0 as the decorated method is deprecated.
- */
- public String dropTable(DbEntity entity) {
- return getAdapter().dropTable(entity);
- }
-
public Collection<String> dropTableStatements(DbEntity table) {
return getAdapter().dropTableStatements(table);
}
@@ -315,7 +300,7 @@
public MergerFactory mergerFactory() {
return getAdapter().mergerFactory();
}
-
+
public void createTableAppendColumn(StringBuffer sqlBuffer, DbAttribute column) {
getAdapter().createTableAppendColumn(sqlBuffer, column);
}
@@ -324,14 +309,14 @@
}
public String getIdentifiersStartQuote() {
- return DEFAULT_QUOTE_SQL_IDENTIFIERS_CHAR_START;
+ return DEFAULT_QUOTE_SQL_IDENTIFIERS_CHAR_START;
}
public String getIdentifiersEndQuote() {
- return DEFAULT_QUOTE_SQL_IDENTIFIERS_CHAR_END;
+ return DEFAULT_QUOTE_SQL_IDENTIFIERS_CHAR_END;
}
- public QuotingStrategy getQuotingStrategy(boolean isQuoteStrategy) {
+ public QuotingStrategy getQuotingStrategy(boolean isQuoteStrategy) {
return getAdapter().getQuotingStrategy(isQuoteStrategy);
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/DbAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/DbAdapter.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/DbAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/DbAdapter.java Mon Nov 16 12:41:26 2009
@@ -63,14 +63,6 @@
SQLAction getAction(Query query, DataNode node);
/**
- * Returns true if a target database supports FK constraints.
- *
- * @deprecated since 3.0 - almost all DB's support FK's now and also this flag is less
- * relevant for Cayenne now.
- */
- boolean supportsFkConstraints();
-
- /**
* Returns true if a target database supports UNIQUE constraints.
*
* @since 1.1
@@ -91,15 +83,6 @@
boolean supportsBatchUpdates();
/**
- * Returns a SQL string that can be used to drop a database table corresponding to
- * entity parameter.
- *
- * @deprecated since 3.0 Cayenne supports 'dropTableStatements' to allow multiple
- * statements to be executed when dropping the table.
- */
- String dropTable(DbEntity entity);
-
- /**
* Returns a collection of SQL statements needed to drop a database table.
*
* @since 3.0
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/JdbcAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/JdbcAdapter.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/JdbcAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/JdbcAdapter.java Mon Nov 16 12:41:26 2009
@@ -57,7 +57,6 @@
protected TypesHandler typesHandler;
protected ExtendedTypeMap extendedTypes;
protected boolean supportsBatchUpdates;
- protected boolean supportsFkConstraints;
protected boolean supportsUniqueConstraints;
protected boolean supportsGeneratedKeys;
protected EJBQLTranslatorFactory ejbqlTranslatorFactory;
@@ -86,7 +85,6 @@
// init defaults
this.setSupportsBatchUpdates(false);
this.setSupportsUniqueConstraints(true);
- this.setSupportsFkConstraints(true);
this.pkGenerator = createPkGenerator();
this.typesHandler = TypesHandler.getHandler(findResource("/types.xml"));
@@ -196,20 +194,6 @@
/**
* Returns true.
- */
- public boolean supportsFkConstraints() {
- return supportsFkConstraints;
- }
-
- /**
- * @since 1.1
- */
- public void setSupportsFkConstraints(boolean flag) {
- this.supportsFkConstraints = flag;
- }
-
- /**
- * Returns true.
*
* @since 1.1
*/
@@ -225,15 +209,6 @@
}
/**
- * Returns a SQL string to drop a table corresponding to table DbEntity.
- *
- * @deprecated since 3.0 in favor of "dropTableStatements"
- */
- public String dropTable(DbEntity table) {
- return dropTableStatements(table).iterator().next();
- }
-
- /**
* @since 3.0
*/
public Collection<String> dropTableStatements(DbEntity table) {
@@ -241,7 +216,7 @@
.getDataMap()
.isQuotingSQLIdentifiers());
- StringBuffer buf = new StringBuffer("DROP TABLE ");
+ StringBuilder buf = new StringBuilder("DROP TABLE ");
buf.append(context.quoteFullyQualifiedName(table));
return Collections.singleton(buf.toString());
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBNoSchemaAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBNoSchemaAdapter.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBNoSchemaAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBNoSchemaAdapter.java Mon Nov 16 12:41:26 2009
@@ -19,8 +19,10 @@
package org.apache.cayenne.dba.hsqldb;
-import org.apache.cayenne.map.DbEntity;
+import java.util.Collection;
+import java.util.Collections;
+import org.apache.cayenne.map.DbEntity;
/**
* A flavor of HSQLDBAdapter that implements workarounds for some old driver limitations.
@@ -28,15 +30,15 @@
* @since 1.2
*/
public class HSQLDBNoSchemaAdapter extends HSQLDBAdapter {
+
/**
* Generate unqualified name without schema.
*
* @since 1.2
*/
@Override
- protected String getTableName(DbEntity entity)
- {
- return entity.getName();
+ protected String getTableName(DbEntity entity) {
+ return entity.getName();
}
/**
@@ -49,15 +51,10 @@
return "";
}
- /**
- * Returns a SQL string to drop a table corresponding to <code>ent</code> DbEntity.
- *
- * @since 1.2
- */
@Override
- public String dropTable(DbEntity ent) {
+ public Collection<String> dropTableStatements(DbEntity table) {
// hsqldb doesn't support schema namespaces, so remove if found
- return "DROP TABLE " + getTableName(ent);
+ return Collections.singleton("DROP TABLE " + getTableName(table));
}
/**
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java Mon Nov 16 12:41:26 2009
@@ -70,6 +70,7 @@
final static String MYSQL_QUOTE_SQL_IDENTIFIERS_CHAR_END = "`";
protected String storageEngine;
+ protected boolean supportsFkConstraints;
public MySQLAdapter() {
@@ -82,6 +83,10 @@
initIdentifiersQuotes();
}
+ void setSupportsFkConstraints(boolean flag) {
+ this.supportsFkConstraints = supportsFkConstraints;
+ }
+
@Override
public void initIdentifiersQuotes() {
this.identifiersStartQuote = MYSQL_QUOTE_SQL_IDENTIFIERS_CHAR_START;
@@ -100,20 +105,6 @@
}
/**
- * @deprecated since 3.0
- */
- @Override
- public String dropTable(DbEntity table) {
- QuotingStrategy context = getQuotingStrategy(table
- .getDataMap()
- .isQuotingSQLIdentifiers());
- StringBuffer buf = new StringBuffer("DROP TABLE IF EXISTS ");
- buf.append(context.quoteFullyQualifiedName(table));
- buf.append(" CASCADE");
- return buf.toString();
- }
-
- /**
* @since 3.0
*/
@Override
@@ -278,7 +269,7 @@
// if FK constraints are supported, we must add indices to all FKs
// Note that according to MySQL docs, FK indexes are created automatically when
// constraint is defined, starting at MySQL 4.1.2
- if (supportsFkConstraints()) {
+ if (supportsFkConstraints) {
for (Relationship r : entity.getRelationships()) {
DbRelationship relationship = (DbRelationship) r;
if (relationship.getJoins().size() > 0
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java Mon Nov 16 12:41:26 2009
@@ -52,7 +52,6 @@
import org.apache.cayenne.query.Query;
import org.apache.cayenne.query.SQLAction;
import org.apache.cayenne.query.UpdateBatchQuery;
-import org.apache.cayenne.validation.ValidationResult;
/**
* DbAdapter implementation for <a href="http://www.oracle.com">Oracle RDBMS </a>. Sample
@@ -63,9 +62,8 @@
* test-oracle.jdbc.username = test
* test-oracle.jdbc.password = secret
* test-oracle.jdbc.url = jdbc:oracle:thin:@//192.168.0.20:1521/ora1
- * test-oracle.jdbc.driver = oracle.jdbc.driver.OracleDriver
+ * test-oracle.jdbc.driver = oracle.jdbc.driver.OracleDriver
* </pre>
- *
*/
public class OracleAdapter extends JdbcAdapter {
@@ -126,8 +124,8 @@
}
/**
- * Utility method that returns <code>true</code> if the query will update at least
- * one BLOB or CLOB DbAttribute.
+ * Utility method that returns <code>true</code> if the query will update at least one
+ * BLOB or CLOB DbAttribute.
*
* @since 1.2
*/
@@ -225,19 +223,21 @@
}
/**
- * Returns a query string to drop a table corresponding to <code>ent</code>
- * DbEntity. Changes superclass behavior to drop all related foreign key constraints.
+ * Returns a query string to drop a table corresponding to <code>ent</code> DbEntity.
+ * Changes superclass behavior to drop all related foreign key constraints.
*
* @since 3.0
*/
@Override
public Collection<String> dropTableStatements(DbEntity table) {
- QuotingStrategy context = getQuotingStrategy(table.getDataMap().isQuotingSQLIdentifiers());
+ QuotingStrategy context = getQuotingStrategy(table
+ .getDataMap()
+ .isQuotingSQLIdentifiers());
StringBuffer buf = new StringBuffer("DROP TABLE ");
- buf.append(context.quoteFullyQualifiedName(table));
+ buf.append(context.quoteFullyQualifiedName(table));
buf.append(" CASCADE CONSTRAINTS");
- return Collections.singleton(buf.toString() );
+ return Collections.singleton(buf.toString());
}
@Override
@@ -336,19 +336,6 @@
return Boolean.class.getName();
}
- /**
- * @deprecated since 3.0 as validation should not be done at the DataNode level.
- */
- @Deprecated
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- return true;
- }
-
public void setJdbcObject(
PreparedStatement st,
Object val,
@@ -385,7 +372,7 @@
return (st.wasNull()) ? null : i == 0 ? Boolean.FALSE : Boolean.TRUE;
}
}
-
+
@Override
public MergerFactory mergerFactory() {
return new OracleMergerFactory();
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteAdapter.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteAdapter.java Mon Nov 16 12:41:26 2009
@@ -24,7 +24,6 @@
import org.apache.cayenne.access.DataNode;
import org.apache.cayenne.access.types.ExtendedTypeMap;
-import org.apache.cayenne.access.types.ObjectType;
import org.apache.cayenne.dba.JdbcAdapter;
import org.apache.cayenne.map.DbAttribute;
import org.apache.cayenne.map.DbEntity;
@@ -48,7 +47,6 @@
public class SQLiteAdapter extends JdbcAdapter {
public SQLiteAdapter() {
- setSupportsFkConstraints(false);
this.setSupportsUniqueConstraints(false);
this.setSupportsGeneratedKeys(true);
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteBigDecimalType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteBigDecimalType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteBigDecimalType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteBigDecimalType.java Mon Nov 16 12:41:26 2009
@@ -20,21 +20,20 @@
import java.math.BigDecimal;
import java.sql.CallableStatement;
+import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.access.types.AbstractType;
+import org.apache.cayenne.access.types.ExtendedType;
/**
* @since 3.0
*/
-class SQLiteBigDecimalType extends AbstractType {
+class SQLiteBigDecimalType implements ExtendedType {
- @Override
public String getClassName() {
return BigDecimal.class.getName();
}
- @Override
public Object materializeObject(CallableStatement rs, int index, int type)
throws Exception {
// BigDecimals are not supported by the zentus driver... in addition the driver
@@ -44,7 +43,6 @@
return (string == null) ? null : new BigDecimal(string);
}
- @Override
public Object materializeObject(ResultSet rs, int index, int type) throws Exception {
// BigDecimals are not supported by the zentus driver... in addition the driver
// throws an NPE on 'getDouble' if the value is null, and also there are rounding
@@ -52,4 +50,19 @@
String string = rs.getString(index);
return (string == null) ? null : new BigDecimal(string);
}
+
+ public void setJdbcObject(
+ PreparedStatement st,
+ Object val,
+ int pos,
+ int type,
+ int scale) throws Exception {
+
+ if (scale != -1) {
+ st.setObject(pos, val, type, scale);
+ }
+ else {
+ st.setObject(pos, val, type);
+ }
+ }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteByteArrayType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteByteArrayType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteByteArrayType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteByteArrayType.java Mon Nov 16 12:41:26 2009
@@ -22,40 +22,41 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.access.types.AbstractType;
+import org.apache.cayenne.access.types.ExtendedType;
/**
* @since 3.0
*/
-class SQLiteByteArrayType extends AbstractType {
+class SQLiteByteArrayType implements ExtendedType {
- @Override
public String getClassName() {
return "byte[]";
}
- @Override
public void setJdbcObject(
PreparedStatement st,
Object val,
int pos,
int type,
- int precision) throws Exception {
+ int scale) throws Exception {
if (val instanceof byte[]) {
st.setBytes(pos, (byte[]) val);
}
else {
- super.setJdbcObject(st, val, pos, type, precision);
+ if (scale != -1) {
+ st.setObject(pos, val, type, scale);
+ }
+ else {
+ st.setObject(pos, val, type);
+ }
}
}
- @Override
public Object materializeObject(ResultSet rs, int index, int type) throws Exception {
return rs.getBytes(index);
}
- @Override
public Object materializeObject(CallableStatement rs, int index, int type)
throws Exception {
return rs.getBytes(index);
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteCalendarType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteCalendarType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteCalendarType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteCalendarType.java Mon Nov 16 12:41:26 2009
@@ -27,8 +27,6 @@
import org.apache.cayenne.access.types.CalendarType;
import org.apache.cayenne.access.types.ExtendedType;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.validation.ValidationResult;
/**
* @since 3.0
@@ -43,23 +41,6 @@
this.delegateDateType = new SQLiteDateType();
}
- /**
- * @deprecated since 3.0
- */
- public boolean validateProperty(
- Object source,
- String property,
- Object value,
- DbAttribute dbAttribute,
- ValidationResult validationResult) {
- return delegateCalendarType.validateProperty(
- source,
- property,
- value,
- dbAttribute,
- validationResult);
- }
-
public String getClassName() {
return delegateCalendarType.getClassName();
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteFloatType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteFloatType.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteFloatType.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteFloatType.java Mon Nov 16 12:41:26 2009
@@ -19,21 +19,20 @@
package org.apache.cayenne.dba.sqlite;
import java.sql.CallableStatement;
+import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import org.apache.cayenne.access.types.AbstractType;
+import org.apache.cayenne.access.types.ExtendedType;
/**
* @since 3.0
*/
-class SQLiteFloatType extends AbstractType {
+class SQLiteFloatType implements ExtendedType {
- @Override
public String getClassName() {
return Float.class.getName();
}
- @Override
public Object materializeObject(CallableStatement rs, int index, int type)
throws Exception {
// the driver throws an NPE on 'getFloat' if the value is null, so must read it as
@@ -42,11 +41,25 @@
return (n == null) ? null : new Float(n.floatValue());
}
- @Override
public Object materializeObject(ResultSet rs, int index, int type) throws Exception {
// the driver throws an NPE on 'getFloat' if the value is null, so must read it as
// an object.
Number n = (Number) rs.getObject(index);
return (n == null) ? null : new Float(n.floatValue());
}
+
+ public void setJdbcObject(
+ PreparedStatement st,
+ Object val,
+ int pos,
+ int type,
+ int scale) throws Exception {
+
+ if (scale != -1) {
+ st.setObject(pos, val, type, scale);
+ }
+ else {
+ st.setObject(pos, val, type);
+ }
+ }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java Mon Nov 16 12:41:26 2009
@@ -47,7 +47,7 @@
int fetchLimit = QueryMetadata.FETCH_LIMIT_DEFAULT;
int fetchOffset = QueryMetadata.FETCH_OFFSET_DEFAULT;
-
+
int statementFetchSize = QueryMetadata.FETCH_OFFSET_DEFAULT;
int pageSize = QueryMetadata.PAGE_SIZE_DEFAULT;
@@ -57,7 +57,7 @@
PrefetchTreeNode prefetchTree;
String cacheKey;
String[] cacheGroups;
-
+
transient List<Object> resultSetMapping;
transient DbEntity dbEntity;
transient DataMap dataMap;
@@ -100,11 +100,14 @@
if (root != null) {
if (root instanceof Class) {
entity = resolver.lookupObjEntity((Class<?>) root);
- if (entity == null) { //entity not found, try to resolve it with client resolver
- EntityResolver clientResolver = resolver.getClientEntityResolver();
+ if (entity == null) { // entity not found, try to resolve it with
+ // client resolver
+ EntityResolver clientResolver = resolver
+ .getClientEntityResolver();
if (clientResolver != resolver) {
- ObjEntity clientEntity = clientResolver.lookupObjEntity((Class<?>) root);
-
+ ObjEntity clientEntity = clientResolver
+ .lookupObjEntity((Class<?>) root);
+
if (clientEntity != null) {
entity = resolver.getObjEntity(clientEntity.getName());
}
@@ -150,7 +153,7 @@
this.lastRoot = root;
this.lastEntityResolver = resolver;
-
+
return true;
}
@@ -166,12 +169,11 @@
Object fetchOffset = properties.get(QueryMetadata.FETCH_OFFSET_PROPERTY);
Object fetchLimit = properties.get(QueryMetadata.FETCH_LIMIT_PROPERTY);
Object pageSize = properties.get(QueryMetadata.PAGE_SIZE_PROPERTY);
- Object statementFetchSize = properties.get(QueryMetadata.STATEMENT_FETCH_SIZE_PROPERTY);
+ Object statementFetchSize = properties
+ .get(QueryMetadata.STATEMENT_FETCH_SIZE_PROPERTY);
Object fetchingDataRows = properties
.get(QueryMetadata.FETCHING_DATA_ROWS_PROPERTY);
- // deprecated cache policy... handle it for backwards compatibility.
- Object cachePolicy = properties.get(QueryMetadata.CACHE_POLICY_PROPERTY);
Object cacheStrategy = properties.get(QueryMetadata.CACHE_STRATEGY_PROPERTY);
Object cacheGroups = properties.get(QueryMetadata.CACHE_GROUPS_PROPERTY);
@@ -187,7 +189,7 @@
this.pageSize = (pageSize != null)
? Integer.parseInt(pageSize.toString())
: QueryMetadata.PAGE_SIZE_DEFAULT;
-
+
this.statementFetchSize = (statementFetchSize != null)
? Integer.parseInt(statementFetchSize.toString())
: QueryMetadata.STATEMENT_FETCH_SIZE_DEFAULT;
@@ -200,11 +202,6 @@
.safeValueOf(cacheStrategy.toString()) : QueryCacheStrategy
.getDefaultStrategy();
- // use legacy cachePolicy if it is provided and no strategy is set...
- if (cacheStrategy == null && cachePolicy != null) {
- setCachePolicy(cachePolicy.toString());
- }
-
this.cacheGroups = null;
if (cacheGroups instanceof String[]) {
this.cacheGroups = (String[]) cacheGroups;
@@ -243,9 +240,11 @@
encoder.printProperty(QueryMetadata.CACHE_STRATEGY_PROPERTY, cacheStrategy
.name());
}
-
+
if (statementFetchSize != QueryMetadata.STATEMENT_FETCH_SIZE_DEFAULT) {
- encoder.printProperty(QueryMetadata.STATEMENT_FETCH_SIZE_PROPERTY, statementFetchSize);
+ encoder.printProperty(
+ QueryMetadata.STATEMENT_FETCH_SIZE_PROPERTY,
+ statementFetchSize);
}
if (prefetchTree != null) {
@@ -344,61 +343,6 @@
}
/**
- * @deprecated since 3.0 {@link #getCacheStrategy()} replaces this method.
- */
- @Deprecated
- public String getCachePolicy() {
- if (cacheStrategy == null) {
- return QueryMetadata.CACHE_POLICY_DEFAULT;
- }
-
- switch (cacheStrategy) {
- case NO_CACHE:
- return QueryMetadata.NO_CACHE;
- case LOCAL_CACHE:
- return QueryMetadata.LOCAL_CACHE;
- case LOCAL_CACHE_REFRESH:
- return QueryMetadata.LOCAL_CACHE_REFRESH;
- case SHARED_CACHE:
- return QueryMetadata.SHARED_CACHE;
- case SHARED_CACHE_REFRESH:
- return QueryMetadata.SHARED_CACHE_REFRESH;
-
- default:
- return QueryMetadata.CACHE_POLICY_DEFAULT;
- }
- }
-
- /**
- * @deprecated since 3.0 {@link #setCacheStrategy(QueryCacheStrategy)} replaces this
- * method.
- */
- @Deprecated
- void setCachePolicy(String policy) {
- if (policy == null) {
- cacheStrategy = null;
- }
- else if (QueryMetadata.NO_CACHE.equals(policy)) {
- cacheStrategy = QueryCacheStrategy.NO_CACHE;
- }
- else if (QueryMetadata.LOCAL_CACHE.equals(policy)) {
- cacheStrategy = QueryCacheStrategy.LOCAL_CACHE;
- }
- else if (QueryMetadata.LOCAL_CACHE_REFRESH.equals(policy)) {
- cacheStrategy = QueryCacheStrategy.LOCAL_CACHE_REFRESH;
- }
- else if (QueryMetadata.SHARED_CACHE.equals(policy)) {
- cacheStrategy = QueryCacheStrategy.SHARED_CACHE;
- }
- else if (QueryMetadata.SHARED_CACHE_REFRESH.equals(policy)) {
- cacheStrategy = QueryCacheStrategy.SHARED_CACHE_REFRESH;
- }
- else {
- cacheStrategy = QueryCacheStrategy.NO_CACHE;
- }
- }
-
- /**
* @since 3.0
*/
public QueryCacheStrategy getCacheStrategy() {
@@ -484,15 +428,16 @@
void setPageSize(int i) {
pageSize = i;
}
-
+
/**
* Sets statement's fetch size (0 for no default size)
- * @since 3.0
+ *
+ * @since 3.0
*/
void setStatementFetchSize(int size) {
this.statementFetchSize = size;
}
-
+
/**
* @return statement's fetch size
* @since 3.0
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/DefaultQueryMetadata.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/DefaultQueryMetadata.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/DefaultQueryMetadata.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/DefaultQueryMetadata.java Mon Nov 16 12:41:26 2009
@@ -103,14 +103,6 @@
return null;
}
- /**
- * @deprecated since 3.0 {@link #getCacheStrategy()} replaces this method.
- */
- @Deprecated
- public String getCachePolicy() {
- return QueryMetadata.CACHE_POLICY_DEFAULT;
- }
-
public boolean isFetchingDataRows() {
return QueryMetadata.FETCHING_DATA_ROWS_DEFAULT;
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQuery.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQuery.java?rev=880730&r1=880729&r2=880730&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQuery.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQuery.java Mon Nov 16 12:41:26 2009
@@ -219,9 +219,8 @@
Object columnNamesCapitalization = properties
.get(COLUMN_NAME_CAPITALIZATION_PROPERTY);
this.columnNamesCapitalization = (columnNamesCapitalization != null)
- ? CapsStrategy.valueOf(columnNamesCapitalization
- .toString()
- .toUpperCase())
+ ? CapsStrategy
+ .valueOf(columnNamesCapitalization.toString().toUpperCase())
: null;
metaData.initWithProperties(properties);
@@ -299,23 +298,6 @@
}
/**
- * @deprecated since 3.0 {@link #getCacheStrategy()} replaces this method.
- */
- @Deprecated
- public String getCachePolicy() {
- return metaData.getCachePolicy();
- }
-
- /**
- * @deprecated since 3.0 {@link #setCacheStrategy(QueryCacheStrategy)} replaces this
- * method.
- */
- @Deprecated
- public void setCachePolicy(String policy) {
- metaData.setCachePolicy(policy);
- }
-
- /**
* @since 3.0
*/
public QueryCacheStrategy getCacheStrategy() {
@@ -537,15 +519,16 @@
public void setColumnNamesCapitalization(CapsStrategy columnNameCapitalization) {
this.columnNamesCapitalization = columnNameCapitalization;
}
-
+
/**
* Sets statement's fetch size (0 for no default size)
- * @since 3.0
+ *
+ * @since 3.0
*/
public void setStatementFetchSize(int size) {
metaData.setStatementFetchSize(size);
}
-
+
/**
* @return statement's fetch size
* @since 3.0