[teiid-commits] teiid SVN: r1299 - in trunk: common-core/src/main/java/com/metamatrix/common/types/basic and 10 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon Aug 31 18:18:34 EDT 2009


Author: shawkins
Date: 2009-08-31 18:18:33 -0400 (Mon, 31 Aug 2009)
New Revision: 1299

Removed:
   trunk/common-core/src/main/java/com/metamatrix/common/types/AbstractTransform.java
Modified:
   trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/Transform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToObjectTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToStringTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToBigIntegerTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToBigDecimalTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToNumberTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ClobToStringTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DateToTimestampTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FixedNumberToBigDecimalTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FixedNumberToBigIntegerTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatingNumberToBigDecimalTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatingNumberToBigIntegerTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NullToAnyTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToBooleanTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToByteTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ObjectToAnyTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/SQLXMLToStringTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigDecimalTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigIntegerTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBooleanTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToByteTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToCharacterTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToClobTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDateTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDoubleTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToFloatTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToIntegerTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToLongTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToSQLXMLTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToShortTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimeTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimestampTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimeToTimestampTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToDateTransform.java
   trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToTimeTransform.java
   trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties
   trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java
   trunk/common-core/src/test/java/com/metamatrix/common/types/basic/TestStringToXmlTransform.java
   trunk/common-core/src/test/java/com/metamatrix/common/types/basic/TestTransforms.java
   trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
   trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java
   trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java
   trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLValueTranslator.java
   trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
   trunk/engine/src/test/java/com/metamatrix/query/function/TestFunction.java
   trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java
Log:
TEIID-813 TEIID-811 TEIID-745 TEIID-744 reverting changes to parseXXX functions, adding range checks for numeric conversions and removing overly optimistic rewriter optimizations

Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/AbstractTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/AbstractTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/AbstractTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -1,133 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types;
-
-import com.metamatrix.core.util.HashCodeUtil;
-
-/**
- * This fills in most of the details of a Transform and provides additional
- * helpful methods as well.  Transform writers should only need to fill in
- * getSourceType(), getTargetType(), and transform().
- */
-public abstract class AbstractTransform implements Transform {
-
-	/**
-	 * This method transforms a value of the source type into a value
-	 * of the target type.
-	 * @param value Incoming value of source type
-	 * @return Outgoing value of target type
-	 * @throws TransformationException if value is an incorrect input type or
-	 * the transformation fails
-	 */
-	public abstract Object transform(Object value) throws TransformationException;
-
-	/**
-	 * Type of the incoming value.
-	 * @return Source type
-	 */
-	public abstract Class getSourceType();
-
-	/**
-	 * Name of the source type.
-	 * @return Name of source type
-	 */
-	public String getSourceTypeName() {
-		return DataTypeManager.getDataTypeName(getSourceType());
-	}
-
-	/**
-	 * Type of the outgoing value.
-	 * @return Target type
-	 */
-	public abstract Class getTargetType();
-
-	/**
-	 * Name of the target type.
-	 * @return Name of target type
-	 */
-	public String getTargetTypeName() {
-        return DataTypeManager.getDataTypeName(getTargetType());
-	}
-
-	/**
-	 * Get nice display name for GUIs.
-	 * @return Display name
-	 */
-	public String getDisplayName() {
-		return getSourceTypeName() + " to " + getTargetTypeName(); //$NON-NLS-1$
-	}
-
-	/**
-	 * Get description.
-	 * @return Description of transform
-	 */
-	public String getDescription() {
-		return getDisplayName();
-	}
-
-	/**
-	 * Flag if the transformation from source to target is
-	 * a narrowing transformation that may lose information.
-	 * This class returns false by default.  This method should
-	 * be overridden if the transform is a narrowing transform.
-	 * @return False unless overridden.
-	 */
-	public boolean isNarrowing() {
-		return false;
-	}
-
-	/**
-	 * Override Object.toString() to do getDisplayName() version.
-	 * @return String representation of object
-	 */
-	public String toString() {
-		return getDisplayName();
-	}
-
-	/**
-	 * Override Object.hashCode() to build a hash based on types.
-	 * @return Hash code
-	 */
-	public int hashCode() {
-		return HashCodeUtil.hashCode( getSourceTypeName().hashCode(), getTargetTypeName().hashCode() );
-	}
-
-	/**
-	 * Override Object.equals() to build an equals based on src and tgt types.
-	 * @param obj Other object
-	 * @return True if obj==this
-	 */
-	public boolean equals(Object obj) {
-		if(this == obj) {
-			return true;
-		}
-
-		if(! this.getClass().isInstance(obj)) {
-			return false;
-		}
-
-		Transform other = (Transform) obj;
-		return other.getSourceType() == this.getSourceType() &&
-			   other.getTargetType() == this.getTargetType();
-	}
-}

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -26,7 +26,12 @@
 import java.math.BigInteger;
 import java.sql.Blob;
 import java.sql.Clob;
+//## JDBC4.0-begin ##
 import java.sql.SQLXML;
+//## JDBC4.0-end ##
+/*## JDBC3.0-JDK1.5-begin ##
+import com.metamatrix.core.jdbc.SQLXML; 
+## JDBC3.0-JDK1.5-end ##*/
 import java.sql.Timestamp;
 import java.util.Arrays;
 import java.util.Collections;
@@ -322,104 +327,6 @@
 	}
 
 	/**
-	 * Get the preferred data value transformation between the firstType and the
-	 * secondType. The transform returned may be either from the firstType to
-	 * secondType or from secondType to firstType.
-	 * 
-	 * @param firstType
-	 * 		First value type
-	 * @param secondType
-	 * 		Second value type
-	 * @return The preferred transform if one exists, null otherwise
-	 */
-	public static Transform getPreferredTransform(Class firstType,
-			Class secondType) {
-		if (firstType == null || secondType == null) {
-			throw new IllegalArgumentException(CorePlugin.Util.getString(
-					ErrorMessageKeys.TYPES_ERR_0002, firstType, secondType));
-		}
-
-		// Get transforms
-		String firstName = DataTypeManager.getDataTypeName(firstType);
-		String secondName = DataTypeManager.getDataTypeName(secondType);
-
-		return DataTypeManager.getPreferredTransformHelper(firstName,
-				secondName);
-	}
-
-	/**
-	 * Get the preferred data value transformation between the firstType and the
-	 * secondType. The transform returned may be either from the firstType to
-	 * secondType or from secondType to firstType.
-	 * 
-	 * @param firstTypeName
-	 * 		First value type
-	 * @param secondTypeName
-	 * 		Second value type
-	 * @return The preferred transform if one exists, null otherwise
-	 */
-	public static Transform getPreferredTransform(String firstTypeName,
-			String secondTypeName) {
-		if (firstTypeName == null || secondTypeName == null) {
-			throw new IllegalArgumentException(CorePlugin.Util.getString(
-					ErrorMessageKeys.TYPES_ERR_0003, firstTypeName,
-					secondTypeName));
-		}
-
-		return DataTypeManager.getPreferredTransformHelper(firstTypeName,
-				secondTypeName);
-	}
-
-	/**
-	 * Get the preferred data value transformation between the firstType and the
-	 * secondType. The transform returned may be either from the firstType to
-	 * secondType or from secondType to firstType.
-	 * 
-	 * @param firstName
-	 * 		First value type name
-	 * @param secondName
-	 * 		Second value type name
-	 * @return The preferred transform if one exists, null otherwise
-	 */
-	private static Transform getPreferredTransformHelper(String firstTypeName,
-			String secondTypeName) {
-		// Return null for identity transform
-		if (firstTypeName.equals(secondTypeName)) {
-			return null;
-		}
-
-		Transform t1 = getTransformFromMaps(firstTypeName, secondTypeName);
-		Transform t2 = getTransformFromMaps(secondTypeName, firstTypeName);
-
-		// Check for null transforms
-		if (t1 == null) {
-			// Can't choose t1 so return t2, which may be null, which is correct
-			return t2;
-		} else if (t2 == null) {
-			// Both transforms are null
-			return null;
-		}
-
-		// We know both transforms are non-null now
-		// Rules for choosing:
-		// 1) Cast away from a string (string to float instead of float to
-		// string)
-		// 2) Choose a non-narrowing over narrowing
-		// 3) Choose t1 arbitrarily
-		if (firstTypeName.equals(DataTypeManager.DefaultDataClasses.STRING.getName())) {
-			return t1;
-		} else if (secondTypeName.equals(DataTypeManager.DefaultDataClasses.STRING.getName())) {
-			return t2;
-		} else if (!t1.isNarrowing() && t2.isNarrowing()) {
-			return t1;
-		} else if (t1.isNarrowing() && !t2.isNarrowing()) {
-			return t2;
-		} else {
-			return t1;
-		}
-	}
-
-	/**
 	 * Does a transformation exist between the source and target type?
 	 * 
 	 * @param sourceType
@@ -663,7 +570,7 @@
 		DataTypeManager.addTransform(new NumberToIntegerTransform(
 				DefaultDataClasses.DOUBLE, true));
 		DataTypeManager.addTransform(new NumberToLongTransform(
-				DefaultDataClasses.DOUBLE, true));
+				DefaultDataClasses.DOUBLE, false)); //lossy, but not narrowing
 		DataTypeManager.addTransform(new NumberToShortTransform(
 				DefaultDataClasses.DOUBLE, true));
 		DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.DOUBLE));
@@ -678,7 +585,7 @@
 		DataTypeManager.addTransform(new NumberToIntegerTransform(
 				DefaultDataClasses.FLOAT, true));
 		DataTypeManager.addTransform(new NumberToLongTransform(
-				DefaultDataClasses.FLOAT, true));
+				DefaultDataClasses.FLOAT, false)); //lossy, but not narrowing
 		DataTypeManager.addTransform(new NumberToShortTransform(
 				DefaultDataClasses.FLOAT, true));
 		DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.FLOAT));
@@ -691,7 +598,7 @@
 		DataTypeManager.addTransform(new NumberToDoubleTransform(
 				DefaultDataClasses.INTEGER, false));
 		DataTypeManager.addTransform(new NumberToFloatTransform(
-				DefaultDataClasses.INTEGER, false));
+				DefaultDataClasses.INTEGER, false)); //lossy, but not narrowing
 		DataTypeManager.addTransform(new NumberToLongTransform(
 				DefaultDataClasses.INTEGER, false));
 		DataTypeManager.addTransform(new NumberToShortTransform(
@@ -704,9 +611,9 @@
 		DataTypeManager.addTransform(new NumberToByteTransform(
 				DefaultDataClasses.LONG));
 		DataTypeManager.addTransform(new NumberToDoubleTransform(
-				DefaultDataClasses.LONG, true));
+				DefaultDataClasses.LONG, false)); //lossy, but not narrowing
 		DataTypeManager.addTransform(new NumberToFloatTransform(
-				DefaultDataClasses.LONG, true));
+				DefaultDataClasses.LONG, false)); //lossy, but not narrowing
 		DataTypeManager.addTransform(new NumberToIntegerTransform(
 				DefaultDataClasses.LONG, true));
 		DataTypeManager.addTransform(new NumberToShortTransform(

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/Transform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/Transform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/Transform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,14 +22,17 @@
 
 package com.metamatrix.common.types;
 
+import com.metamatrix.core.CorePlugin;
+import com.metamatrix.core.util.HashCodeUtil;
+
 /**
  * This interface represents the transformation from one data type to
  * another.  For instance, from java.lang.String to java.lang.Integer
  * where java.lang.String is the the source type, "java.lang.String"
  * is the source name, etc.
  */
-public interface Transform {
-
+public abstract class Transform {
+	
 	/**
 	 * This method transforms a value of the source type into a value
 	 * of the target type.
@@ -38,49 +41,111 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException;
+	public Object transform(Object value) throws TransformationException {
+		if (value == null) {
+			return null;
+		}
+		return transformDirect(value);
+	}
+	
+	
+	protected abstract Object transformDirect(Object value) throws TransformationException;
 
 	/**
 	 * Type of the incoming value.
 	 * @return Source type
 	 */
-	public Class getSourceType();
+	public abstract Class getSourceType();
 
 	/**
 	 * Name of the source type.
 	 * @return Name of source type
 	 */
-	public String getSourceTypeName();
+	public String getSourceTypeName() {
+		return DataTypeManager.getDataTypeName(getSourceType());
+	}
 
 	/**
 	 * Type of the outgoing value.
 	 * @return Target type
 	 */
-	public Class getTargetType();
+	public abstract Class getTargetType();
 
 	/**
 	 * Name of the target type.
 	 * @return Name of target type
 	 */
-	public String getTargetTypeName();
+	public String getTargetTypeName() {
+        return DataTypeManager.getDataTypeName(getTargetType());
+	}
 
 	/**
 	 * Get nice display name for GUIs.
 	 * @return Display name
 	 */
-	public String getDisplayName();
+	public String getDisplayName() {
+		return getSourceTypeName() + " to " + getTargetTypeName(); //$NON-NLS-1$
+	}
 
 	/**
 	 * Get description.
 	 * @return Description of transform
 	 */
-	public String getDescription();
+	public String getDescription() {
+		return getDisplayName();
+	}
 
 	/**
-	 * Flag if the transformation from source to target is 
+	 * Flag if the transformation from source to target is
 	 * a narrowing transformation that may lose information.
-	 * @return True if transformation is narrowing
+	 * This class returns false by default.  This method should
+	 * be overridden if the transform is a narrowing transform.
+	 * @return False unless overridden.
 	 */
-	public boolean isNarrowing();
+	public boolean isNarrowing() {
+		return false;
+	}
 
+	/**
+	 * Override Object.toString() to do getDisplayName() version.
+	 * @return String representation of object
+	 */
+	public String toString() {
+		return getDisplayName();
+	}
+
+	/**
+	 * Override Object.hashCode() to build a hash based on types.
+	 * @return Hash code
+	 */
+	public int hashCode() {
+		return HashCodeUtil.hashCode( getSourceTypeName().hashCode(), getTargetTypeName().hashCode() );
+	}
+
+	/**
+	 * Override Object.equals() to build an equals based on src and tgt types.
+	 * @param obj Other object
+	 * @return True if obj==this
+	 */
+	public boolean equals(Object obj) {
+		if(this == obj) {
+			return true;
+		}
+
+		if(! this.getClass().isInstance(obj)) {
+			return false;
+		}
+
+		Transform other = (Transform) obj;
+		return other.getSourceType() == this.getSourceType() &&
+			   other.getTargetType() == this.getTargetType();
+	}
+	
+	protected void checkValueRange(Object value, Number min, Number max)
+			throws TransformationException {
+		if (((Comparable)value).compareTo(DataTypeManager.transformValue(min, getSourceType())) < 0 || ((Comparable)value).compareTo(DataTypeManager.transformValue(max, getSourceType())) > 0) {
+			throw new TransformationException(CorePlugin.Util.getString("transform.value_out_of_range", value, getSourceType().getSimpleName(), getTargetType().getSimpleName())); //$NON-NLS-1$
+		}
+	}
+
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToObjectTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToObjectTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToObjectTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,11 +22,11 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
 import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 
-public class AnyToObjectTransform extends AbstractTransform {
+public class AnyToObjectTransform extends Transform {
 	
 	private Class<?> sourceType;
 	
@@ -47,7 +47,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
+	public Object transformDirect(Object value) throws TransformationException {
 		return value;
 	}
 

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToStringTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToStringTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToStringTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,13 +22,15 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.*;
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.Transform;
+import com.metamatrix.common.types.TransformationException;
 
 /**
  * This class can be subclassed to do a simple anything-->String by
  * just calling toString().  Just extend and implement getSouceType().
  */
-public class AnyToStringTransform extends AbstractTransform {
+public class AnyToStringTransform extends Transform {
 
 	private Class<?> sourceType;
 	
@@ -60,11 +62,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return null;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		String result = value.toString();
 		if (result != null && result.length() > DataTypeManager.MAX_STRING_LENGTH) {
 			return result.substring(0, DataTypeManager.MAX_STRING_LENGTH);

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToBigIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToBigIntegerTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToBigIntegerTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -25,10 +25,10 @@
 import java.math.BigDecimal;
 import java.math.BigInteger;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 
-public class BigDecimalToBigIntegerTransform extends AbstractTransform {
+public class BigDecimalToBigIntegerTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -38,11 +38,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		return ((BigDecimal) value).toBigInteger();
 	}
 

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToBigDecimalTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToBigDecimalTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToBigDecimalTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -25,10 +25,10 @@
 import java.math.BigDecimal;
 import java.math.BigInteger;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 
-public class BigIntegerToBigDecimalTransform extends AbstractTransform {
+public class BigIntegerToBigDecimalTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -38,11 +38,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		return new BigDecimal((BigInteger) value);
 	}
 

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToNumberTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToNumberTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToNumberTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,11 +22,11 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
 import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 
-public class BooleanToNumberTransform extends AbstractTransform {
+public class BooleanToNumberTransform extends Transform {
 
 	private Object trueVal;
 	private Object falseVal;
@@ -49,10 +49,7 @@
 	}
 	
 	@Override
-	public Object transform(Object value) throws TransformationException {
-		if (value == null) {
-			return null;
-		}
+	public Object transformDirect(Object value) throws TransformationException {
 		return value.equals(Boolean.TRUE)?trueVal:falseVal;
 	}
 	

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ClobToStringTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ClobToStringTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ClobToStringTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -46,11 +46,7 @@
      * @throws TransformationException if value is an incorrect input type or
      * the transformation fails
      */
-    public Object transform(Object value) throws TransformationException {
-        if(value == null) {
-            return value;
-        }
-
+    public Object transformDirect(Object value) throws TransformationException {
         ClobType source = (ClobType)value;
         
         try {
@@ -73,7 +69,7 @@
     }
 
     /** 
-     * @see com.metamatrix.common.types.AbstractTransform#isNarrowing()
+     * @see com.metamatrix.common.types.Transform#isNarrowing()
      */
     public boolean isNarrowing() {
         return true;

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DateToTimestampTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DateToTimestampTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DateToTimestampTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -24,10 +24,10 @@
 
 import java.sql.Timestamp;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 
-public class DateToTimestampTransform extends AbstractTransform {
+public class DateToTimestampTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -37,11 +37,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		return new Timestamp( ((java.sql.Date) value).getTime() );
 	}
 

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FixedNumberToBigDecimalTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FixedNumberToBigDecimalTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FixedNumberToBigDecimalTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -24,11 +24,11 @@
 
 import java.math.BigDecimal;
 
-import com.metamatrix.common.types.AbstractTransform;
 import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 
-public class FixedNumberToBigDecimalTransform extends AbstractTransform {
+public class FixedNumberToBigDecimalTransform extends Transform {
 
 	private Class<?> sourceType;
 	
@@ -44,11 +44,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		return BigDecimal.valueOf(((Number)value).longValue());
 	}
 

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FixedNumberToBigIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FixedNumberToBigIntegerTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FixedNumberToBigIntegerTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -24,11 +24,11 @@
 
 import java.math.BigInteger;
 
-import com.metamatrix.common.types.AbstractTransform;
 import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 
-public class FixedNumberToBigIntegerTransform extends AbstractTransform {
+public class FixedNumberToBigIntegerTransform extends Transform {
 
 	private Class<?> sourceType;
 	
@@ -44,11 +44,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		return BigInteger.valueOf(((Number)value).longValue());
 	}
 

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatingNumberToBigDecimalTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatingNumberToBigDecimalTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatingNumberToBigDecimalTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -24,11 +24,11 @@
 
 import java.math.BigDecimal;
 
-import com.metamatrix.common.types.AbstractTransform;
 import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 
-public class FloatingNumberToBigDecimalTransform extends AbstractTransform {
+public class FloatingNumberToBigDecimalTransform extends Transform {
 
 	private Class<?> sourceType;
 	
@@ -44,11 +44,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
         return BigDecimal.valueOf(((Number)value).doubleValue());
 	}
 

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatingNumberToBigIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatingNumberToBigIntegerTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatingNumberToBigIntegerTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,13 +22,13 @@
 
 package com.metamatrix.common.types.basic;
 
-import java.math.BigInteger;
+import java.math.BigDecimal;
 
-import com.metamatrix.common.types.AbstractTransform;
 import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 
-public class FloatingNumberToBigIntegerTransform extends AbstractTransform {
+public class FloatingNumberToBigIntegerTransform extends Transform {
 
 	private Class<?> sourceType;
 	
@@ -44,17 +44,8 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
-        String doubleString = String.valueOf(value);
-        int index = doubleString.lastIndexOf("."); //$NON-NLS-1$
-        if(index >= 0) { 
-            return new BigInteger(doubleString.substring(0, index));
-        }
-        return new BigInteger(doubleString);
+	public Object transformDirect(Object value) throws TransformationException {
+        return BigDecimal.valueOf(((Number)value).doubleValue()).toBigInteger();
 	}
 
 	/**
@@ -73,11 +64,7 @@
 		return DataTypeManager.DefaultDataClasses.BIG_INTEGER;
 	}
 
-	/**
-	 * Flag if the transformation from source to target is 
-	 * a narrowing transformation that may lose information.
-	 * @return True - this transformation is narrowing
-	 */
+	@Override
 	public boolean isNarrowing() {
 		return true;
 	}

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NullToAnyTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NullToAnyTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NullToAnyTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,17 +22,17 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
 import com.metamatrix.common.types.NullType;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
-import com.metamatrix.core.CorePlugin;
+import com.metamatrix.core.util.Assertion;
 
 /**
  * This class can do a simple null-->anything.  
  * Incoming value must be null and outgoing value is the same.  
  * This is purely for type purposes.
  */
-public class NullToAnyTransform extends AbstractTransform {
+public class NullToAnyTransform extends Transform {
 
 	private Class<?> targetType;
 	
@@ -64,12 +64,9 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return null;
-		}
-        Object[] params = new Object[] { getSourceType(), value, value.getClass().getName()};
-        throw new TransformationException(CorePlugin.Util.getString("NullToAnyTransform.Invalid_value", params)); //$NON-NLS-1$
+	public Object transformDirect(Object value) throws TransformationException {
+		Assertion.isNull(value);
+		return null;
 	}
 	
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToBooleanTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToBooleanTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToBooleanTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,11 +22,11 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
 import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 
-public class NumberToBooleanTransform extends AbstractTransform {
+public class NumberToBooleanTransform extends Transform {
 	
 	private Comparable falseVal;
 	private Class<?> sourceType;
@@ -47,10 +47,7 @@
 	}
 	
 	@Override
-	public Object transform(Object value) throws TransformationException {
-		if (value == null) {
-			return null;
-		}
+	public Object transformDirect(Object value) throws TransformationException {
 		if (falseVal.compareTo(value) == 0) {
 			return Boolean.FALSE;
 		}

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToByteTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToByteTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToByteTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,11 +22,11 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
 import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 
-public class NumberToByteTransform extends AbstractTransform {
+public class NumberToByteTransform extends Transform {
 	
 	private Class<?> sourceType;
 	
@@ -47,10 +47,8 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if (value == null) {
-			return null;
-		}
+	public Object transformDirect(Object value) throws TransformationException {
+		checkValueRange(value, Byte.MIN_VALUE, Byte.MAX_VALUE);
 		return Byte.valueOf(((Number)value).byteValue());
 	}
 
@@ -61,10 +59,5 @@
 	public Class<?> getTargetType() {
 		return DataTypeManager.DefaultDataClasses.BYTE;
 	}
-	
-	@Override
-	public boolean isNarrowing() {
-		return true;
-	}
-
+		
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,11 +22,11 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.common.types.TransformationException;
 
-public class NumberToDoubleTransform extends AbstractTransform {
+public class NumberToDoubleTransform extends Transform {
 	
 	private Class<?> sourceType;
 	private boolean isNarrowing;
@@ -49,9 +49,9 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if (value == null) {
-			return null;
+	public Object transformDirect(Object value) throws TransformationException {
+		if (isNarrowing) {
+			checkValueRange(value, -Double.MAX_VALUE, Double.MAX_VALUE);
 		}
 		return Double.valueOf(((Number)value).doubleValue());
 	}
@@ -64,9 +64,4 @@
 		return DataTypeManager.DefaultDataClasses.DOUBLE;
 	}
 	
-	@Override
-	public boolean isNarrowing() {
-		return isNarrowing;
-	}
-
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,11 +22,11 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.common.types.TransformationException;
 
-public class NumberToFloatTransform extends AbstractTransform {
+public class NumberToFloatTransform extends Transform {
 	
 	private Class<?> sourceType;
 	private boolean isNarrowing;
@@ -49,9 +49,9 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if (value == null) {
-			return null;
+	public Object transformDirect(Object value) throws TransformationException {
+		if (isNarrowing) {
+			checkValueRange(value, -Float.MAX_VALUE, Float.MAX_VALUE);
 		}
 		return Float.valueOf(((Number)value).floatValue());
 	}
@@ -64,9 +64,4 @@
 		return DataTypeManager.DefaultDataClasses.FLOAT;
 	}
 	
-	@Override
-	public boolean isNarrowing() {
-		return isNarrowing;
-	}
-
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,11 +22,11 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.common.types.TransformationException;
 
-public class NumberToIntegerTransform extends AbstractTransform {
+public class NumberToIntegerTransform extends Transform {
 	
 	private Class<?> sourceType;
 	private boolean isNarrowing;
@@ -49,9 +49,9 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if (value == null) {
-			return null;
+	public Object transformDirect(Object value) throws TransformationException {
+		if (isNarrowing) {
+			checkValueRange(value, Integer.MIN_VALUE, Integer.MAX_VALUE);
 		}
 		return Integer.valueOf(((Number)value).intValue());
 	}
@@ -64,9 +64,4 @@
 		return DataTypeManager.DefaultDataClasses.INTEGER;
 	}
 	
-	@Override
-	public boolean isNarrowing() {
-		return isNarrowing;
-	}
-
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,11 +22,11 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.common.types.TransformationException;
 
-public class NumberToLongTransform extends AbstractTransform {
+public class NumberToLongTransform extends Transform {
 	
 	private Class<?> sourceType;
 	private boolean isNarrowing;
@@ -49,9 +49,9 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if (value == null) {
-			return null;
+	public Object transformDirect(Object value) throws TransformationException {
+		if (isNarrowing) {
+			checkValueRange(value, Long.MIN_VALUE, Long.MAX_VALUE);
 		}
 		return Long.valueOf(((Number)value).longValue());
 	}
@@ -64,9 +64,4 @@
 		return DataTypeManager.DefaultDataClasses.LONG;
 	}
 	
-	@Override
-	public boolean isNarrowing() {
-		return isNarrowing;
-	}
-
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,11 +22,11 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.common.types.TransformationException;
 
-public class NumberToShortTransform extends AbstractTransform {
+public class NumberToShortTransform extends Transform {
 	
 	private Class<?> sourceType;
 	private boolean isNarrowing;
@@ -49,9 +49,9 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if (value == null) {
-			return null;
+	public Object transformDirect(Object value) throws TransformationException {
+		if (isNarrowing) {
+			checkValueRange(value, Short.MIN_VALUE, Short.MAX_VALUE);
 		}
 		return Short.valueOf(((Number)value).shortValue());
 	}
@@ -64,9 +64,4 @@
 		return DataTypeManager.DefaultDataClasses.SHORT;
 	}
 	
-	@Override
-	public boolean isNarrowing() {
-		return isNarrowing;
-	}
-
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ObjectToAnyTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ObjectToAnyTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ObjectToAnyTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,13 +22,12 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.common.types.Transform;
+import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.core.CorePlugin;
 
-public class ObjectToAnyTransform extends AbstractTransform {
+public class ObjectToAnyTransform extends Transform {
 
     private Class targetClass;
     
@@ -48,8 +47,8 @@
         return targetClass;
     }
 
-    public Object transform(Object value) throws TransformationException {
-        if(value == null || targetClass.isAssignableFrom(value.getClass())) {
+    public Object transformDirect(Object value) throws TransformationException {
+        if(targetClass.isAssignableFrom(value.getClass())) {
             return value;
         }
         
@@ -69,7 +68,7 @@
     }
     
     /** 
-     * @see com.metamatrix.common.types.AbstractTransform#isNarrowing()
+     * @see com.metamatrix.common.types.Transform#isNarrowing()
      */
     public boolean isNarrowing() {
         return true;

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/SQLXMLToStringTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/SQLXMLToStringTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/SQLXMLToStringTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -45,11 +45,7 @@
      * @throws TransformationException if value is an incorrect input type or
      * the transformation fails
      */
-    public Object transform(Object value) throws TransformationException {
-        if(value == null) {
-            return value;
-        }
-
+    public Object transformDirect(Object value) throws TransformationException {
         XMLType source = (XMLType)value;
         
         try {       
@@ -64,7 +60,7 @@
     }
 
     /** 
-     * @see com.metamatrix.common.types.AbstractTransform#isNarrowing()
+     * @see com.metamatrix.common.types.Transform#isNarrowing()
      */
     public boolean isNarrowing() {
         return true;

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigDecimalTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigDecimalTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigDecimalTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -24,12 +24,12 @@
 
 import java.math.BigDecimal;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.core.CorePlugin;
 import com.metamatrix.core.ErrorMessageKeys;
 
-public class StringToBigDecimalTransform extends AbstractTransform {
+public class StringToBigDecimalTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -39,11 +39,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		try {
 			return new BigDecimal(((String)value).trim());
 		} catch(NumberFormatException e) {
@@ -66,5 +62,10 @@
 	public Class getTargetType() {
 		return BigDecimal.class;
 	}
-
+	
+	@Override
+	public boolean isNarrowing() {
+		return true;
+	}
+	
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigIntegerTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigIntegerTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -24,12 +24,12 @@
 
 import java.math.BigInteger;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.core.CorePlugin;
 import com.metamatrix.core.ErrorMessageKeys;
 
-public class StringToBigIntegerTransform extends AbstractTransform {
+public class StringToBigIntegerTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -39,11 +39,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		try {
 			return new BigInteger(((String)value).trim());
 		} catch(NumberFormatException e) {
@@ -66,5 +62,10 @@
 	public Class getTargetType() {
 		return BigInteger.class;
 	}
+	
+	@Override
+	public boolean isNarrowing() {
+		return true;
+	}
 
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBooleanTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBooleanTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBooleanTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -26,11 +26,11 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.common.types.DataTypeManager.DefaultDataClasses;
 
-public class StringToBooleanTransform extends AbstractTransform {
+public class StringToBooleanTransform extends Transform {
 
     private static final Set<String> FALSE = new HashSet<String>(Arrays.asList("0", "false")); //$NON-NLS-1$ //$NON-NLS-2$
 
@@ -42,10 +42,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
+	public Object transformDirect(Object value) throws TransformationException {
 		String str = ((String)value).trim().toLowerCase();
         if (FALSE.contains(str)) {
             return Boolean.FALSE;

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToByteTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToByteTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToByteTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,12 +22,12 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.core.CorePlugin;
 import com.metamatrix.core.ErrorMessageKeys;
 
-public class StringToByteTransform extends AbstractTransform {
+public class StringToByteTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -37,11 +37,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		try {
 			return Byte.valueOf(((String)value).trim());
 		} catch(NumberFormatException e) {
@@ -64,5 +60,10 @@
 	public Class getTargetType() {
 		return Byte.class;
 	}
+	
+	@Override
+	public boolean isNarrowing() {
+		return true;
+	}
 
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToCharacterTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToCharacterTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToCharacterTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,10 +22,10 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 
-public class StringToCharacterTransform extends AbstractTransform {
+public class StringToCharacterTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -35,11 +35,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-		
+	public Object transformDirect(Object value) throws TransformationException {
 		String s = (String) value;
 		
 		if (s.length() == 0) {

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToClobTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToClobTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToClobTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,11 +22,11 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.ClobType;
 import com.metamatrix.common.types.TransformationException;
 
-public class StringToClobTransform extends AbstractTransform {
+public class StringToClobTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -36,11 +36,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-        if (value == null) {
-            return value;
-        }
-        
+	public Object transformDirect(Object value) throws TransformationException {
         String contents = (String)value;                
 		return new ClobType(ClobType.createClob(contents.toCharArray()));
 	}
@@ -60,5 +56,5 @@
 	public Class getTargetType() {
 		return ClobType.class;
 	}
-
+	
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDateTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDateTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDateTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -24,12 +24,12 @@
 
 import java.sql.Date;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.core.CorePlugin;
 import com.metamatrix.core.ErrorMessageKeys;
 
-public class StringToDateTransform extends AbstractTransform {
+public class StringToDateTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -39,10 +39,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
+	public Object transformDirect(Object value) throws TransformationException {
 		value = ((String) value).trim();
 		Date result = null;
 		try {
@@ -71,5 +68,10 @@
 	public Class getTargetType() {
 		return Date.class;
 	}
+	
+	@Override
+	public boolean isNarrowing() {
+		return true;
+	}
 
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDoubleTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDoubleTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,12 +22,12 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.core.CorePlugin;
 import com.metamatrix.core.ErrorMessageKeys;
 
-public class StringToDoubleTransform extends AbstractTransform {
+public class StringToDoubleTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -37,11 +37,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		try {
 			return Double.valueOf((String)value);
 		} catch(NumberFormatException e) {
@@ -65,4 +61,9 @@
 		return Double.class;
 	}
 
+	@Override
+	public boolean isNarrowing() {
+		return true;
+	}
+	
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToFloatTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToFloatTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,12 +22,12 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.core.CorePlugin;
 import com.metamatrix.core.ErrorMessageKeys;
 
-public class StringToFloatTransform extends AbstractTransform {
+public class StringToFloatTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -37,11 +37,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		try {
 			return Float.valueOf((String)value);
 		} catch(NumberFormatException e) {
@@ -64,5 +60,10 @@
 	public Class getTargetType() {
 		return Float.class;
 	}
+	
+	@Override
+	public boolean isNarrowing() {
+		return true;
+	}
 
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToIntegerTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToIntegerTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,12 +22,12 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.core.CorePlugin;
 import com.metamatrix.core.ErrorMessageKeys;
 
-public class StringToIntegerTransform extends AbstractTransform {
+public class StringToIntegerTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -37,11 +37,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		try {
 			return Integer.valueOf(((String)value).trim());
 		} catch(NumberFormatException e) {
@@ -64,5 +60,10 @@
 	public Class getTargetType() {
 		return Integer.class;
 	}
+	
+	@Override
+	public boolean isNarrowing() {
+		return true;
+	}
 
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToLongTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToLongTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,12 +22,12 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.core.CorePlugin;
 import com.metamatrix.core.ErrorMessageKeys;
 
-public class StringToLongTransform extends AbstractTransform {
+public class StringToLongTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -37,11 +37,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		try {
 			return Long.valueOf(((String)value).trim());
 		} catch(NumberFormatException e) {
@@ -64,5 +60,10 @@
 	public Class getTargetType() {
 		return Long.class;
 	}
+	
+	@Override
+	public boolean isNarrowing() {
+		return true;
+	}
 
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToSQLXMLTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToSQLXMLTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToSQLXMLTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -31,13 +31,13 @@
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.SQLXMLImpl;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.common.types.XMLType;
 import com.metamatrix.core.CorePlugin;
 
-public class StringToSQLXMLTransform extends AbstractTransform {
+public class StringToSQLXMLTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -47,11 +47,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-        if (value == null) {
-            return value;
-        }
-        
+	public Object transformDirect(Object value) throws TransformationException {
         String xml = (String)value;        
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();        
         try{        
@@ -79,5 +75,5 @@
 	public Class getTargetType() {
 		return XMLType.class;
 	}
-
+	
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToShortTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToShortTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -22,12 +22,12 @@
 
 package com.metamatrix.common.types.basic;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.core.CorePlugin;
 import com.metamatrix.core.ErrorMessageKeys;
 
-public class StringToShortTransform extends AbstractTransform {
+public class StringToShortTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -37,11 +37,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		try {
 			return Short.valueOf(((String)value).trim());
 		} catch(NumberFormatException e) {
@@ -64,5 +60,10 @@
 	public Class getTargetType() {
 		return Short.class;
 	}
+	
+	@Override
+	public boolean isNarrowing() {
+		return true;
+	}
 
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimeTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimeTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimeTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -24,12 +24,12 @@
 
 import java.sql.Time;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.core.CorePlugin;
 import com.metamatrix.core.ErrorMessageKeys;
 
-public class StringToTimeTransform extends AbstractTransform {
+public class StringToTimeTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -39,10 +39,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
+	public Object transformDirect(Object value) throws TransformationException {
 		value = ((String) value).trim();
 		Time result = null;
 		try {
@@ -71,5 +68,10 @@
 	public Class getTargetType() {
 		return Time.class;
 	}
+	
+	@Override
+	public boolean isNarrowing() {
+		return true;
+	}
 
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimestampTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimestampTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimestampTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -24,12 +24,12 @@
 
 import java.sql.Timestamp;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.core.CorePlugin;
 import com.metamatrix.core.ErrorMessageKeys;
 
-public class StringToTimestampTransform extends AbstractTransform {
+public class StringToTimestampTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -39,10 +39,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
+	public Object transformDirect(Object value) throws TransformationException {
 		value = ((String) value).trim();
 		Timestamp result = null;
 		try {
@@ -72,5 +69,10 @@
 	public Class getTargetType() {
 		return Timestamp.class;
 	}
+	
+	@Override
+	public boolean isNarrowing() {
+		return true;
+	}
 
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimeToTimestampTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimeToTimestampTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimeToTimestampTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -24,10 +24,10 @@
 
 import java.sql.Timestamp;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 
-public class TimeToTimestampTransform extends AbstractTransform {
+public class TimeToTimestampTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -37,11 +37,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		return new Timestamp( ((java.sql.Time) value).getTime() );
 	}
 

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToDateTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToDateTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToDateTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -25,11 +25,11 @@
 
 import java.sql.Timestamp;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.common.util.TimestampWithTimezone;
 
-public class TimestampToDateTransform extends AbstractTransform {
+public class TimestampToDateTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -39,11 +39,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		return TimestampWithTimezone.createDate((Timestamp)value);
 	}
 
@@ -64,7 +60,7 @@
 	}
     
     /** 
-     * @see com.metamatrix.common.types.AbstractTransform#isNarrowing()
+     * @see com.metamatrix.common.types.Transform#isNarrowing()
      */
     public boolean isNarrowing() {
         return true;

Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToTimeTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToTimeTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToTimeTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -24,11 +24,11 @@
 
 import java.sql.Timestamp;
 
-import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.types.TransformationException;
 import com.metamatrix.common.util.TimestampWithTimezone;
 
-public class TimestampToTimeTransform extends AbstractTransform {
+public class TimestampToTimeTransform extends Transform {
 
 	/**
 	 * This method transforms a value of the source type into a value
@@ -38,11 +38,7 @@
 	 * @throws TransformationException if value is an incorrect input type or
 	 * the transformation fails
 	 */
-	public Object transform(Object value) throws TransformationException {
-		if(value == null) {
-			return value;
-		}
-
+	public Object transformDirect(Object value) throws TransformationException {
 		return TimestampWithTimezone.createTime((Timestamp)value);
 	}
 
@@ -63,7 +59,7 @@
 	}
     
     /** 
-     * @see com.metamatrix.common.types.AbstractTransform#isNarrowing()
+     * @see com.metamatrix.common.types.Transform#isNarrowing()
      */
     public boolean isNarrowing() {
         return true;

Modified: trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties
===================================================================
--- trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties	2009-08-31 22:18:33 UTC (rev 1299)
@@ -400,4 +400,5 @@
 ExceptionHolder.converted_exception=Remote exception: {0} ... Original type hierarchy {1}.
 PropertiesUtils.failed_to_resolve_property=failed to completely resolve the property value for key {0}
 
-transform.invalid_string_for_date=The string representation ''{0}'' of a {1} value is not valid.
\ No newline at end of file
+transform.invalid_string_for_date=The string representation ''{0}'' of a {1} value is not valid.
+transform.value_out_of_range=The {1} value ''{0}'' is outside the of range for {2}
\ No newline at end of file

Modified: trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -161,11 +161,11 @@
     }
     
     public void testTimeConversions() {
-        Transform t = DataTypeManager.getPreferredTransform(DataTypeManager.DefaultDataTypes.TIMESTAMP, DataTypeManager.DefaultDataTypes.DATE);
+        Transform t = DataTypeManager.getTransform(DataTypeManager.DefaultDataTypes.TIMESTAMP, DataTypeManager.DefaultDataTypes.DATE);
         
-        assertEquals(DataTypeManager.DefaultDataClasses.TIMESTAMP, t.getTargetType());
+        assertEquals(DataTypeManager.DefaultDataClasses.DATE, t.getTargetType());
         
-        t = DataTypeManager.getPreferredTransform(DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP);
+        t = DataTypeManager.getTransform(DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP);
         
         assertEquals(DataTypeManager.DefaultDataClasses.TIMESTAMP, t.getTargetType());
     }

Modified: trunk/common-core/src/test/java/com/metamatrix/common/types/basic/TestStringToXmlTransform.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/types/basic/TestStringToXmlTransform.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/test/java/com/metamatrix/common/types/basic/TestStringToXmlTransform.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -45,7 +45,7 @@
         
        StringToSQLXMLTransform transform = new StringToSQLXMLTransform();
        
-       SQLXML xmlValue = (SQLXML)transform.transform(xml);
+       SQLXML xmlValue = (SQLXML)transform.transformDirect(xml);
        assertEquals(xml, xmlValue.getString());
     }
     
@@ -58,7 +58,7 @@
        StringToSQLXMLTransform transform = new StringToSQLXMLTransform();
        
        try {
-           transform.transform(xml);
+           transform.transformDirect(xml);
            fail("exception expected"); //$NON-NLS-1$           
         } catch (TransformationException e) {        
         }        

Modified: trunk/common-core/src/test/java/com/metamatrix/common/types/basic/TestTransforms.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/types/basic/TestTransforms.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/common-core/src/test/java/com/metamatrix/common/types/basic/TestTransforms.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -219,7 +219,7 @@
         String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$
         expected += xml.substring(0, DataTypeManager.MAX_STRING_LENGTH - expected.length());
                 
-        helpTestTransform(new StringToSQLXMLTransform().transform(xml.toString()), expected);
+        helpTestTransform(new StringToSQLXMLTransform().transformDirect(xml.toString()), expected);
     }
     
     @Test public void testStringToTimestampOutOfRange() throws Exception {
@@ -234,4 +234,18 @@
     	helpTestTransform(" 1 ", Long.valueOf(1)); //$NON-NLS-1$ 
     }
     
+    @Test public void testEngineeringNotationFloatToBigInteger() throws Exception {
+    	helpTestTransform(Float.MIN_VALUE, new BigDecimal(Float.MIN_VALUE).toBigInteger());
+    }
+    
+    @Test public void testRangeCheck() throws Exception {
+    	helpTransformException(300, DataTypeManager.DefaultDataClasses.BYTE, "The Integer value '300' is outside the of range for Byte"); //$NON-NLS-1$
+    }
+    
+    @Test public void testRangeCheck1() throws Exception {
+    	helpTransformException(new Double("1E11"), DataTypeManager.DefaultDataClasses.INTEGER, "The Double value '100,000,000,000' is outside the of range for Integer"); //$NON-NLS-1$ //$NON-NLS-2$  
+    }
+
+
+    
 }

Modified: trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml	2009-08-31 22:18:33 UTC (rev 1299)
@@ -505,8 +505,7 @@
         numeric string formats by visiting the Sun Java Web site at the
         following
         <ulink
-          url="http://java.sun.com/javase/6/docs/api/java/text/DecimalFormat.html">URL for Sun Java</ulink>
-        .  In addition to the Java conventions, parse strings have leading and trailing whitespace removed automatically and cannot contain characters after a valid parse prefix.
+          url="http://java.sun.com/javase/6/docs/api/java/text/DecimalFormat.html">URL for Sun Java</ulink>.
       </para>
       <para>For example, you could use these function calls, with the
         formatting string that adheres to the java.text.DecimalFormat
@@ -1045,8 +1044,7 @@
         defines formats by visiting the Sun Java Web site
         at the following
         <ulink
-          url="http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html">URL for Sun Java</ulink>
-        .  In addition to the Java conventions, parse strings have leading and trailing whitespace removed automatically and cannot contain characters after a valid parse prefix.
+          url="http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html">URL for Sun Java</ulink>.
     </para>
     <informaltable frame="all">
       <tgroup cols="3">

Modified: trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -29,7 +29,7 @@
 import java.sql.Timestamp;
 import java.text.DateFormat;
 import java.text.DecimalFormat;
-import java.text.ParsePosition;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
@@ -1032,51 +1032,27 @@
     }
 
 	// ================== Format date/time/timestamp TO String ==================
-	public static Object formatDate(Object date, Object format)
+	public static String format(Date date, String format)
 		throws FunctionExecutionException {
 		try {
-            SimpleDateFormat sdf = new SimpleDateFormat((String)format);
-            return sdf.format((Date)date);
+            SimpleDateFormat sdf = new SimpleDateFormat(format);
+            return sdf.format(date);
 		} catch (IllegalArgumentException iae) {
 			throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0042, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0042 ,
 				iae.getMessage()));
 		}
 	}
 
-	public static Object formatTime(Object time, Object format)
-		throws FunctionExecutionException {
-		try {
-            SimpleDateFormat sdf = new SimpleDateFormat((String)format);
-            return sdf.format((Time)time);
-		} catch (IllegalArgumentException iae) {
-			throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0042, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0042 ,
-				iae.getMessage()));
-		}
-	}
-
-	public static Object formatTimestamp(Object timestamp, Object format)
-		throws FunctionExecutionException {
-		try {
-            SimpleDateFormat sdf = new SimpleDateFormat((String)format);
-            return sdf.format((Timestamp) timestamp);
-		} catch (IllegalArgumentException iae) {
-			throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0042, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0042 ,
-				iae.getMessage()));
-		}
-	}
-
 	//	================== Parse String TO date/time/timestamp  ==================
 	private static Date parseDateHelper(String date, String format)
 			throws FunctionExecutionException {
-		date = date.trim();
 		DateFormat df = new SimpleDateFormat(format);
-		df.setLenient(false);
-		ParsePosition pp = new ParsePosition(0);
-		Date parsedDate = df.parse(date, pp);
-		if (parsedDate == null || pp.getIndex() < date.length()) {
-			throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0043, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0043, date, format));
+		try {
+			return df.parse(date);
+		} catch (ParseException e) {
+			throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0043, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0043 ,
+					date, format));
 		}
-		return parsedDate;
 	}
 	
 	public static Date parseDate(String date, String format)
@@ -1095,35 +1071,17 @@
 	}
 
 	//	================== Format number TO String ==================
-	public static Object formatInteger(Object integerNum, Object format)
-		throws FunctionExecutionException {
-		return formatNumberHelper(integerNum, format);
+	public static String format(Number number, String format)
+	throws FunctionExecutionException {
+		try {
+	        DecimalFormat df = new DecimalFormat(format);
+	        return df.format(number);
+		} catch (IllegalArgumentException iae) {
+			throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0042, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0042 ,
+			iae.getMessage()));
+		}
 	}
 
-	public static Object formatLong(Object longNum, Object format)
-		throws FunctionExecutionException {
-		return formatNumberHelper(longNum, format);
-	}
-
-	public static Object formatDouble(Object doubleNum, Object format)
-		throws FunctionExecutionException {
-		return formatNumberHelper(doubleNum, format);
-	}
-
-	public static Object formatFloat(Object floatNum, Object format)
-		throws FunctionExecutionException {
-		return formatNumberHelper(floatNum, format);
-	}
-	public static Object formatBigInteger(Object bigIntegerNum, Object format)
-		throws FunctionExecutionException {
-		return formatNumberHelper(bigIntegerNum, format);
-	}
-
-	public static Object formatBigDecimal(Object bigDecimalNum, Object format)
-		throws FunctionExecutionException {
-		return formatNumberHelper(bigDecimalNum, format);
-	}
-
 	//	================== Parse String TO numbers ==================
 	public static Object parseInteger(String number, String format)
 		throws FunctionExecutionException {
@@ -1162,32 +1120,16 @@
 	}
 
 	// ============== Helper Function for format/parse numbers ==================
-	public static String formatNumberHelper(Object number, Object format)
-		throws FunctionExecutionException {
-		if (number == null || format == null) {
-			return null;
-		}
 
-		try {
-            DecimalFormat df = new DecimalFormat((String)format);
-            return df.format(number);
-		} catch (IllegalArgumentException iae) {
-			throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0042, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0042 ,
-			iae.getMessage()));
-		}
-	}
-
 	private static Number parseNumberHelper(String number, String format)
 		throws FunctionExecutionException {
-		number = number.trim();
 		DecimalFormat df= new DecimalFormat(format);
-		ParsePosition pp = new ParsePosition(0);
-		Number num = df.parse(number, pp);
-		if (num == null || pp.getIndex() < number.length()) {
+		try {
+			return df.parse(number);
+		} catch (ParseException e) {
 			throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0043, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0043 ,
 					number,format));
 		}
-		return num;
 	}
 
 	// ================== Function - ACOS =====================

Modified: trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -160,9 +160,9 @@
 		addIfNullFunctions();
         
 		// format 
-		addFormatTimeFunction(SourceSystemFunctions.FORMATTIME, QueryPlugin.Util.getString("SystemSource.Formattime_desc"), "formatTime", QueryPlugin.Util.getString("SystemSource.Formattime_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
-		addFormatDateFunction(SourceSystemFunctions.FORMATDATE, QueryPlugin.Util.getString("SystemSource.Formatdate_desc"), "formatDate", QueryPlugin.Util.getString("SystemSource.Formatdate_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
-		addFormatTimestampFunction(SourceSystemFunctions.FORMATTIMESTAMP, QueryPlugin.Util.getString("SystemSource.Formattimestamp_desc"), "formatTimestamp", QueryPlugin.Util.getString("SystemSource.Formattimestamp_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
+		addFormatTimeFunction(SourceSystemFunctions.FORMATTIME, QueryPlugin.Util.getString("SystemSource.Formattime_desc"), "format", QueryPlugin.Util.getString("SystemSource.Formattime_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
+		addFormatDateFunction(SourceSystemFunctions.FORMATDATE, QueryPlugin.Util.getString("SystemSource.Formatdate_desc"), "format", QueryPlugin.Util.getString("SystemSource.Formatdate_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
+		addFormatTimestampFunction(SourceSystemFunctions.FORMATTIMESTAMP, QueryPlugin.Util.getString("SystemSource.Formattimestamp_desc"), "format", QueryPlugin.Util.getString("SystemSource.Formattimestamp_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
 
 		addFormatNumberFunctions();
 		
@@ -195,12 +195,12 @@
     }
 
     private void addFormatNumberFunctions() {
-		addFormatNumberFunction(SourceSystemFunctions.FORMATINTEGER, QueryPlugin.Util.getString("SystemSource.Formatinteger_desc"), "formatInteger", "integer", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Formatinteger_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
-		addFormatNumberFunction(SourceSystemFunctions.FORMATLONG, QueryPlugin.Util.getString("SystemSource.Formatlong_desc"), "formatLong", "long", DataTypeManager.DefaultDataTypes.LONG, QueryPlugin.Util.getString("SystemSource.Formatlong_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
-		addFormatNumberFunction(SourceSystemFunctions.FORMATDOUBLE, QueryPlugin.Util.getString("SystemSource.Formatdouble_desc"), "formatDouble", "double", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Formatdouble_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
-		addFormatNumberFunction(SourceSystemFunctions.FORMATFLOAT, QueryPlugin.Util.getString("SystemSource.Formatfloat_desc"), "formatFloat", "float", DataTypeManager.DefaultDataTypes.FLOAT, QueryPlugin.Util.getString("SystemSource.Formatfloat_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
-		addFormatNumberFunction(SourceSystemFunctions.FORMATBIGINTEGER, QueryPlugin.Util.getString("SystemSource.Formatbiginteger_desc"), "formatBigInteger", "biginteger", DataTypeManager.DefaultDataTypes.BIG_INTEGER, QueryPlugin.Util.getString("SystemSource.Formatbiginteger_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
-		addFormatNumberFunction(SourceSystemFunctions.FORMATBIGDECIMAL, QueryPlugin.Util.getString("SystemSource.Formatbigdecimal_desc"), "formatBigDecimal", "bigdecimal", DataTypeManager.DefaultDataTypes.BIG_DECIMAL, QueryPlugin.Util.getString("SystemSource.Formatbigdecimal_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
+		addFormatNumberFunction(SourceSystemFunctions.FORMATINTEGER, QueryPlugin.Util.getString("SystemSource.Formatinteger_desc"), "format", "integer", DataTypeManager.DefaultDataTypes.INTEGER, QueryPlugin.Util.getString("SystemSource.Formatinteger_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
+		addFormatNumberFunction(SourceSystemFunctions.FORMATLONG, QueryPlugin.Util.getString("SystemSource.Formatlong_desc"), "format", "long", DataTypeManager.DefaultDataTypes.LONG, QueryPlugin.Util.getString("SystemSource.Formatlong_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
+		addFormatNumberFunction(SourceSystemFunctions.FORMATDOUBLE, QueryPlugin.Util.getString("SystemSource.Formatdouble_desc"), "format", "double", DataTypeManager.DefaultDataTypes.DOUBLE, QueryPlugin.Util.getString("SystemSource.Formatdouble_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
+		addFormatNumberFunction(SourceSystemFunctions.FORMATFLOAT, QueryPlugin.Util.getString("SystemSource.Formatfloat_desc"), "format", "float", DataTypeManager.DefaultDataTypes.FLOAT, QueryPlugin.Util.getString("SystemSource.Formatfloat_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
+		addFormatNumberFunction(SourceSystemFunctions.FORMATBIGINTEGER, QueryPlugin.Util.getString("SystemSource.Formatbiginteger_desc"), "format", "biginteger", DataTypeManager.DefaultDataTypes.BIG_INTEGER, QueryPlugin.Util.getString("SystemSource.Formatbiginteger_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
+		addFormatNumberFunction(SourceSystemFunctions.FORMATBIGDECIMAL, QueryPlugin.Util.getString("SystemSource.Formatbigdecimal_desc"), "format", "bigdecimal", DataTypeManager.DefaultDataTypes.BIG_DECIMAL, QueryPlugin.Util.getString("SystemSource.Formatbigdecimal_result_desc")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
 	}
 	
 	private void addParseNumberFunctions() {

Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLValueTranslator.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLValueTranslator.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLValueTranslator.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -146,10 +146,10 @@
                     valueStr = bigIntegerTogMonth((BigInteger)value);
                     break;
                 case GMONTHDAY_CODE:
-                    valueStr = (String)FunctionMethods.formatTimestamp(value, GMONTHDAY_FORMAT);
+                    valueStr = FunctionMethods.format((Timestamp)value, GMONTHDAY_FORMAT);
                     break;
                 case GYEAR_CODE:
-                    valueStr = (String)FunctionMethods.formatBigInteger(value, GYEAR_FORMAT);
+                    valueStr = FunctionMethods.format((BigInteger)value, GYEAR_FORMAT);
                     break;
                 case GYEARMONTH_CODE:
                     valueStr = timestampTogYearMonth(value);
@@ -178,7 +178,7 @@
     private static String timestampTogYearMonth(Object value) throws FunctionExecutionException {
         String valueStr;
         Timestamp time = (Timestamp)value;
-        valueStr = (String)FunctionMethods.formatTimestamp(value, GYEARMONTH_FORMAT);
+        valueStr = (String)FunctionMethods.format(time, GYEARMONTH_FORMAT);
         if (time.getTime() < YEAR_ZERO) {
             valueStr = "-" + valueStr; //$NON-NLS-1$
         }
@@ -190,7 +190,7 @@
      * with a trailing string for nanoseconds (without right zeros). 
      */
     static String timestampToDateTime(Timestamp time) throws FunctionExecutionException {
-        String result = (String)FunctionMethods.formatTimestamp(time, DATETIME_FORMAT);
+        String result = (String)FunctionMethods.format(time, DATETIME_FORMAT);
         int nanos = time.getNanos();
         if (nanos == 0) {
             return result;

Modified: trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -54,6 +54,7 @@
 import com.metamatrix.api.exception.query.QueryValidatorException;
 import com.metamatrix.common.buffer.BlockedException;
 import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.Transform;
 import com.metamatrix.common.util.TimestampWithTimezone;
 import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.core.util.Assertion;
@@ -164,10 +165,6 @@
     public static final CompareCriteria FALSE_CRITERIA = new CompareCriteria(new Constant(new Integer(1), DataTypeManager.DefaultDataClasses.INTEGER), CompareCriteria.EQ, new Constant(new Integer(0), DataTypeManager.DefaultDataClasses.INTEGER));
     public static final CompareCriteria UNKNOWN_CRITERIA = new CompareCriteria(new Constant(null, DataTypeManager.DefaultDataClasses.STRING), CompareCriteria.NE, new Constant(null, DataTypeManager.DefaultDataClasses.STRING));
     
-    private final static Timestamp EXAMPLE_TIMESTAMP = Timestamp.valueOf("2001-02-03 13:04:05.01"); //$NON-NLS-1$
-    private final static Time EXAMPLE_TIME = Time.valueOf("13:04:05"); //$NON-NLS-1$
-    private final static Date EXAMPLE_DATE = Date.valueOf("2001-02-03"); //$NON-NLS-1$
-    
     private static final Map<String, String> ALIASED_FUNCTIONS = new HashMap<String, String>();
     
     static {
@@ -1312,15 +1309,10 @@
         if(isSimpleMathematicalFunction(leftFunction)) {
             return simplifyMathematicalCriteria(criteria);
         }   
-        if(criteria.getOperator() == CompareCriteria.EQ || criteria.getOperator() == CompareCriteria.NE) {
-            if(criteria.getRightExpression() instanceof Constant && (FunctionLibrary.isConvert(leftFunction))) { 
-
-                return simplifyConvertFunction(criteria); 
-                
-            } 
-            return simplifyParseFormatFunction(criteria);
+        if (FunctionLibrary.isConvert(leftFunction)) {
+        	return simplifyConvertFunction(criteria);
         }
-        return criteria;
+        return simplifyParseFormatFunction(criteria);
     }
     
     private boolean isSimpleMathematicalFunction(Function function) {
@@ -1489,22 +1481,38 @@
      */
     private Criteria simplifyConvertFunction(CompareCriteria crit) throws QueryValidatorException {
         Function leftFunction = (Function) crit.getLeftExpression();
-        Constant rightConstant = (Constant) crit.getRightExpression();
         Expression leftExpr = leftFunction.getArgs()[0];
+        if (leftExpr.getType() == crit.getRightExpression().getType()) {
+        	crit.setLeftExpression(leftExpr);
+        	return crit;
+        }
+        if(!(crit.getRightExpression() instanceof Constant) 
+        		//TODO: this can be relaxed for order preserving operations
+        		|| !(crit.getOperator() == CompareCriteria.EQ || crit.getOperator() == CompareCriteria.NE)) { 
+        	return crit;
+        } 
+
+        Constant rightConstant = (Constant) crit.getRightExpression();
         
         String leftExprTypeName = DataTypeManager.getDataTypeName(leftExpr.getType());
-        
+
         Constant result = null;
         try {
             result = ResolverUtil.convertConstant(DataTypeManager.getDataTypeName(rightConstant.getType()), leftExprTypeName, rightConstant);
+            Constant other = ResolverUtil.convertConstant(leftExprTypeName, DataTypeManager.getDataTypeName(rightConstant.getType()), result);
+            if (((Comparable)rightConstant.getValue()).compareTo(other.getValue()) != 0) {
+            	return getSimpliedCriteria(crit, leftExpr, crit.getOperator() != CompareCriteria.EQ, true);
+            }
         } catch(QueryResolverException e) {
-            
-        }
-        
-        if (result == null) {
         	return getSimpliedCriteria(crit, leftExpr, crit.getOperator() != CompareCriteria.EQ, true);
         }
         
+        Transform transform = DataTypeManager.getTransform(leftExpr.getType(), crit.getRightExpression().getType());
+        
+        if (transform.isNarrowing()) {
+        	return crit;
+        }
+                
     	crit.setRightExpression(result);
         crit.setLeftExpression(leftExpr);
 
@@ -1586,7 +1594,12 @@
     }
         
     private Criteria simplifyParseFormatFunction(CompareCriteria crit) throws QueryValidatorException {
-        Function leftFunction = (Function) crit.getLeftExpression();
+    	//TODO: this can be relaxed for order preserving operations
+        if(!(crit.getOperator() == CompareCriteria.EQ || crit.getOperator() == CompareCriteria.NE)) {
+        	return crit;
+        }
+    	boolean isFormat = false;
+    	Function leftFunction = (Function) crit.getLeftExpression();
         String funcName = leftFunction.getName().toLowerCase();
         String inverseFunction = null;
         if(funcName.startsWith("parse")) { //$NON-NLS-1$
@@ -1595,97 +1608,44 @@
         } else if(funcName.startsWith("format")) { //$NON-NLS-1$
             String type = funcName.substring(6);
             inverseFunction = "parse" + type; //$NON-NLS-1$
+            isFormat = true;
         } else {
             return crit;
         }
         Expression rightExpr = crit.getRightExpression();
+        if (!(rightExpr instanceof Constant)) {
+        	return crit;
+        }
         Expression leftExpr = leftFunction.getArgs()[0];
         Expression formatExpr = leftFunction.getArgs()[1];
         if(!(formatExpr instanceof Constant)) {
             return crit;
         }
+        String format = (String)((Constant)formatExpr).getValue();
         FunctionLibrary funcLib = FunctionLibraryManager.getFunctionLibrary();
         FunctionDescriptor descriptor = funcLib.findFunction(inverseFunction, new Class[] { rightExpr.getType(), formatExpr.getType() });
         if(descriptor == null){
             return crit;
         }
-        String format = (String)((Constant)formatExpr).getValue();
-        try {
-            /*
-             * The following is a hack at fixing defect 23792.  Our strategy of always inverting parse and format functions was wrong in 
-             * many cases, so this code will catch many circumstances that were missed before.
-             */
-            Expression dateExpression = null;
-            FunctionDescriptor forwardFunction = null;
-            FunctionDescriptor reverseFunction = null;
-            boolean parseFunction = false;
-            boolean checkExpression = true;
-            
-            if (java.util.Date.class.isAssignableFrom(leftExpr.getType())) {
-                dateExpression = leftExpr;
-                forwardFunction = leftFunction.getFunctionDescriptor();
-                reverseFunction = descriptor;
-            } else if (java.util.Date.class.isAssignableFrom(rightExpr.getType())) {
-                dateExpression = rightExpr;
-                forwardFunction = descriptor;
-                reverseFunction = leftFunction.getFunctionDescriptor();
-                parseFunction = true;
-            }
-            
-            if (dateExpression != null) {
-                Object example = EXAMPLE_TIMESTAMP;
-                if (DataTypeManager.DefaultDataClasses.DATE.equals(dateExpression.getType())) {
-                    example = EXAMPLE_DATE;
-                } else if (DataTypeManager.DefaultDataClasses.TIME.equals(dateExpression.getType())) {
-                    example = EXAMPLE_TIME;
-                }
-                if (parseFunction) {
-                    if (rightExpr instanceof Constant) {
-                        example = ((Constant)rightExpr).getValue(); 
-                    } else {
-                        checkExpression = false;
-                    }
-                }
-                if (checkExpression) {
-                    Object result = funcLib.invokeFunction(forwardFunction, new Object[] {example, format});
-                    result = funcLib.invokeFunction(reverseFunction, new Object[] { result, format } );
-                    if (!example.equals(result)) {
-                        if (parseFunction) {
-                        	return getSimpliedCriteria(crit, leftExpr, crit.getOperator() != CompareCriteria.EQ, true);
-                        }
-                        //the format is loosing information, so it must not be invertable
-                        return crit;
-                    }
-                }
-            }
-        } catch(InvalidFunctionException e) {
+    	Object value = ((Constant)rightExpr).getValue();
+    	try {
+    		Object result = funcLib.invokeFunction(descriptor, new Object[] {((Constant)rightExpr).getValue(), format});
+    		result = funcLib.invokeFunction(leftFunction.getFunctionDescriptor(), new Object[] { result, format } );
+    		if (((Comparable)value).compareTo(result) != 0) {
+    			return getSimpliedCriteria(crit, leftExpr, crit.getOperator() != CompareCriteria.EQ, true);
+    		}
+    	} catch(InvalidFunctionException e) {
             String errorMsg = QueryExecPlugin.Util.getString("QueryRewriter.criteriaError", crit); //$NON-NLS-1$
             throw new QueryValidatorException(e, errorMsg);
-        } catch(FunctionExecutionException e) {
-            String errorMsg = QueryExecPlugin.Util.getString("QueryRewriter.criteriaError", crit); //$NON-NLS-1$
-            throw new QueryValidatorException(e, errorMsg);
-        }
-        try {   
-            if (rightExpr instanceof Constant) {
-                Object result = funcLib.invokeFunction(
-                                                       descriptor, new Object[] { ((Constant)rightExpr).getValue(), format } );
-                crit.setRightExpression(new Constant(result, descriptor.getReturnType()));
-                crit.setLeftExpression(leftExpr);
-            } else {
-                Function conversion = new Function(descriptor.getName(), new Expression[] { rightExpr, formatExpr });
-                conversion.setType(leftExpr.getType());
-                conversion.setFunctionDescriptor(descriptor);
-                
-                crit.setRightExpression(conversion);
-                crit.setLeftExpression(leftExpr);
-            }
-        } catch(InvalidFunctionException e) {
-            String errorMsg = QueryExecPlugin.Util.getString("QueryRewriter.criteriaError", crit); //$NON-NLS-1$
-            throw new QueryValidatorException(e, errorMsg);
-        } catch(FunctionExecutionException e) {
+    	} catch(FunctionExecutionException e) {
             //Not all numeric formats are invertable, so just return the criteria as it may still be valid
             return crit;
         }
+        //parseFunctions are all potentially narrowing
+        if (!isFormat) {
+        	return crit;
+        }
+        //TODO: if format is not lossy, then invert the function
         return crit;
     }
       
@@ -1720,16 +1680,12 @@
         if(leftExpr instanceof Function && rightExpr instanceof Constant) {
             tsCreateFunction = (Function) leftExpr;
             timestampConstant = (Constant) rightExpr;            
-        } else if(leftExpr instanceof Constant && rightExpr instanceof Function) {
-            tsCreateFunction = (Function) rightExpr;
-            timestampConstant = (Constant) leftExpr;
         } else {
             return criteria;
         }
 
         // Verify data type of constant and that constant has a value
-        if(! timestampConstant.getType().equals(DataTypeManager.DefaultDataClasses.TIMESTAMP) || 
-           timestampConstant.getValue() == null) {
+        if(! timestampConstant.getType().equals(DataTypeManager.DefaultDataClasses.TIMESTAMP)) {
             return criteria;        
         }
         
@@ -1754,12 +1710,12 @@
         return compCrit;                     
     }
 
-   /*
+   /**
     * This method also applies the same simplification for Case 1829.  This is conceptually 
     * the same thing but done  using the timestampCreate system function.  
     *     
-    * TIMESTAMPCREATE(rpcolli_physical.RPCOLLI.Table_B.date_field, rpcolli_physical.RPCOLLI.Table_B.time_field)
-    *    = {ts'1969-09-20 18:30:45.0'}
+    * formatDate(rpcolli_physical.RPCOLLI.Table_B.date_field, 'yyyy-MM-dd') 
+    *    || formatTime(rpcolli_physical.RPCOLLI.Table_B.time_field, ' HH:mm:ss') = '1969-09-20 18:30:45'
     *  
     *  -------------
     *  
@@ -1786,16 +1742,12 @@
        if(leftExpr instanceof Function && rightExpr instanceof Constant) {
            concatFunction = (Function) leftExpr;
            timestampConstant = (Constant) rightExpr;            
-       } else if(leftExpr instanceof Constant && rightExpr instanceof Function) {
-           concatFunction = (Function) rightExpr;
-           timestampConstant = (Constant) leftExpr;
        } else {
            return criteria;
        }
 
        // Verify data type of string constant and that constant has a value
-       if(! timestampConstant.getType().equals(DataTypeManager.DefaultDataClasses.STRING) || 
-          timestampConstant.getValue() == null) {
+       if(! timestampConstant.getType().equals(DataTypeManager.DefaultDataClasses.STRING)) {
            return criteria;        
        }
        
@@ -1823,13 +1775,7 @@
        // Verify length of combined date/time constants == timestamp constant
        String dateFormat = (String) ((Constant)formatDateFunction.getArgs()[1]).getValue();        
        String timeFormat = (String) ((Constant)formatTimeFunction.getArgs()[1]).getValue();        
-       if(dateFormat == null || timeFormat == null) {
-           return criteria;
-       }
        String timestampValue = (String) timestampConstant.getValue();
-       if(timestampValue.length() != dateFormat.length() + timeFormat.length()) {
-           return criteria;
-       }
        
        // Passed all the checks, so build the optimized version
        try {

Modified: trunk/engine/src/test/java/com/metamatrix/query/function/TestFunction.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/function/TestFunction.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/engine/src/test/java/com/metamatrix/query/function/TestFunction.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -1158,12 +1158,12 @@
         assertEquals(systemProperty+"_lowercase", FunctionMethods.env(context, systemProperty.toUpperCase())); //$NON-NLS-1$
     }
     
-    @Test(expected=FunctionExecutionException.class) public void testParseIntStrictness() throws Exception {
-    	FunctionMethods.parseInteger("1 a", "#"); //$NON-NLS-1$ //$NON-NLS-2$
+    public void testParseIntStrictness() throws Exception {
+    	assertEquals(Integer.valueOf(1), FunctionMethods.parseInteger("a 1 a", "#")); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    @Test(expected=FunctionExecutionException.class) public void testParseDateStrictness() throws Exception {
-    	FunctionMethods.parseDate("2007-13-01", "yyyy-MM-dd"); //$NON-NLS-1$ //$NON-NLS-2$
+    public void testParseDateStrictness() throws Exception {
+    	assertEquals(TimestampUtil.createDate(2007, 1, 1), FunctionMethods.parseDate(" 2007-13-01", "yyyy-MM")); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     @Test public void testParseTimeWhitespace() throws Exception {

Modified: trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java	2009-08-31 22:02:02 UTC (rev 1298)
+++ trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java	2009-08-31 22:18:33 UTC (rev 1299)
@@ -26,12 +26,12 @@
 
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Properties;
 import java.util.TimeZone;
 
+import org.junit.Ignore;
 import org.junit.Test;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -265,7 +265,8 @@
     @Test public void testRewriteCrit5() {
         helpTestRewriteCriteria("pm1.g1.e1 in ('a')", "pm1.g1.e1 = 'a'"); //$NON-NLS-1$ //$NON-NLS-2$
     }
-    
+    
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteCrit6() {
         helpTestRewriteCriteria("1 = convert(pm1.g1.e1,integer) + 10", "pm1.g1.e1 = '-9'"); //$NON-NLS-1$ //$NON-NLS-2$
     } 
@@ -389,12 +390,14 @@
     @Test public void testRewriteCritExpr_unhandled2() {
         helpTestRewriteCriteria("5 - pm1.g1.e2 <= 10", "5 - pm1.g1.e2 <= 10"); //$NON-NLS-1$ //$NON-NLS-2$
     }
-    
+    
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteCrit_parseDate() {
         helpTestRewriteCriteria("PARSEDATE(pm3.g1.e1, 'yyyyMMdd') = {d'2003-05-01'}", //$NON-NLS-1$
                                 "pm3.g1.e1 = '20030501'" );         //$NON-NLS-1$
     }
     
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteCrit_parseDate1() {
         helpTestRewriteCriteria("PARSEDATE(pm3.g1.e1, 'yyyyMM') = {d'2003-05-01'}", //$NON-NLS-1$
                                 "pm3.g1.e1 = '200305'" );         //$NON-NLS-1$
@@ -404,7 +407,8 @@
         helpTestRewriteCriteria("PARSEDATE(pm3.g1.e1, 'yyyyMM') = {d'2003-05-02'}", //$NON-NLS-1$
                                 "1 = 0" );         //$NON-NLS-1$
     }
-    
+    
+    @Ignore(value="Should be moved to the validator")
     @Test public void testRewriteCrit_invalidParseDate() {
         QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
         Criteria origCrit = parseCriteria("PARSEDATE(pm3.g1.e1, '''') = {d'2003-05-01'}", metadata); //$NON-NLS-1$
@@ -416,7 +420,8 @@
             assertEquals("Error Code:ERR.015.001.0003 Message:Error simplifying criteria: PARSEDATE(pm3.g1.e1, '''') = {d'2003-05-01'}", e.getMessage());     //$NON-NLS-1$
         }
     }
-    
+    
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteCrit_parseTime() {
         helpTestRewriteCriteria("PARSETIME(pm3.g1.e1, 'HH mm ss') = {t'13:25:04'}", //$NON-NLS-1$
                                 "pm3.g1.e1 = '13 25 04'" );         //$NON-NLS-1$
@@ -426,7 +431,8 @@
         helpTestRewriteCriteria("PARSETimestamp(pm3.g1.e1, 'yyyy dd mm') = {ts'2003-05-01 13:25:04.5'}", //$NON-NLS-1$
                                 "1 = 0" );         //$NON-NLS-1$
     }
-    
+    
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteCrit_parseTimestamp1() {
         helpTestRewriteCriteria("PARSETimestamp(pm3.g1.e1, 'yyyy dd mm') = {ts'2003-01-01 00:25:00.0'}", //$NON-NLS-1$
                                 "pm3.g1.e1 = '2003 01 25'" );         //$NON-NLS-1$
@@ -441,7 +447,8 @@
         helpTestRewriteCriteria("PARSETimestamp(pm3.g1.e1, 'yyyy dd mm') <> {ts'2003-05-01 13:25:04.5'}", //$NON-NLS-1$
                                 "pm3.g1.e1 is not null" );         //$NON-NLS-1$
     }
-    
+    
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteCrit_parseTimestamp4() {
         helpTestRewriteCriteria("PARSETimestamp(CONVERT(pm3.g1.e2, string), 'yyyy-MM-dd') = {ts'2003-05-01 00:00:00.0'}", //$NON-NLS-1$
                                 "pm3.g1.e2 = {d'2003-05-01'}" );         //$NON-NLS-1$
@@ -452,6 +459,7 @@
                                 "PARSETimestamp(pm3.g1.e1, 'yyyy dd mm') > {ts'2003-05-01 13:25:04.5'}" );         //$NON-NLS-1$
     }
     
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteCrit_parseTimestamp_decompose() {
         helpTestRewriteCriteria("PARSETIMESTAMP(CONCAT(FORMATDATE(pm3.g1.e2, 'yyyyMMdd'), FORMATTIME(pm3.g1.e3, 'HHmmss')), 'yyyyMMddHHmmss') = PARSETIMESTAMP('19690920183045', 'yyyyMMddHHmmss')", //$NON-NLS-1$
         "(pm3.g1.e2 = {d'1969-09-20'}) AND (pm3.g1.e3 = {t'18:30:45'})" );         //$NON-NLS-1$
@@ -461,42 +469,50 @@
         helpTestRewriteCriteria("timestampCreate(pm3.g1.e2, pm3.g1.e3) = PARSETIMESTAMP('19690920183045', 'yyyyMMddHHmmss')", //$NON-NLS-1$
         "(pm3.g1.e2 = {d'1969-09-20'}) AND (pm3.g1.e3 = {t'18:30:45'})" );         //$NON-NLS-1$
     }
-
+
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteCrit_parseInteger() {
         helpTestRewriteCriteria("parseInteger(pm1.g1.e1, '#,##0') = 1234", //$NON-NLS-1$
                                 "pm1.g1.e1 = '1,234'" );         //$NON-NLS-1$
     }
-
+
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteCrit_parseLong() {
         helpTestRewriteCriteria("parseLong(pm1.g1.e1, '#,##0') = convert(1234, long)", //$NON-NLS-1$
                                 "pm1.g1.e1 = '1,234'" );         //$NON-NLS-1$
     }
-
+
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteCrit_parseBigInteger() {
         helpTestRewriteCriteria("parseBigInteger(pm1.g1.e1, '#,##0') = convert(1234, biginteger)", //$NON-NLS-1$
                                 "pm1.g1.e1 = '1,234'" );         //$NON-NLS-1$
     }
-
+
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteCrit_parseFloat() {
-        helpTestRewriteCriteria("parseFloat(pm1.g1.e1, '#,##0.###') = convert(1234.1234, float)", //$NON-NLS-1$
+        helpTestRewriteCriteria("parseFloat(pm1.g1.e1, '#,##0.###') = convert(1234.123, float)", //$NON-NLS-1$
                                 "pm1.g1.e1 = '1,234.123'" );         //$NON-NLS-1$
     }
-
+
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteCrit_parseDouble() {
         helpTestRewriteCriteria("parseDouble(pm1.g1.e1, '$#,##0.00') = convert(1234.5, double)", //$NON-NLS-1$
                                 "pm1.g1.e1 = '$1,234.50'" );         //$NON-NLS-1$
     }
-
+
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteCrit_parseBigDecimal() {
         helpTestRewriteCriteria("parseBigDecimal(pm1.g1.e1, '#,##0.###') = convert(1234.1234, bigdecimal)", //$NON-NLS-1$
                                 "pm1.g1.e1 = '1,234.123'" );         //$NON-NLS-1$
     }
-
+
+    @Ignore(value="Cannot deterime if the format is narrowing")
     @Test public void testRewriteCrit_formatDate() {
         helpTestRewriteCriteria("formatDate(pm3.g1.e2, 'yyyyMMdd') = '20030501'", //$NON-NLS-1$
                                 "pm3.g1.e2 = {d'2003-05-01'}" );         //$NON-NLS-1$
     }
-
+
+    @Ignore(value="Cannot deterime if the format is narrowing")
     @Test public void testRewriteCrit_formatTime() {
         helpTestRewriteCriteria("formatTime(pm3.g1.e3, 'HH mm ss') = '13 25 04'", //$NON-NLS-1$
                                 "pm3.g1.e3 = {t'13:25:04'}" );         //$NON-NLS-1$
@@ -506,12 +522,14 @@
         helpTestRewriteCriteria("formatTimestamp(pm3.g1.e4, 'MM dd, yyyy - HH:mm:ss') = '05 01, 1974 - 07:00:00'", //$NON-NLS-1$
                                 "formatTimestamp(pm3.g1.e4, 'MM dd, yyyy - HH:mm:ss') = '05 01, 1974 - 07:00:00'" );         //$NON-NLS-1$
     }
-    
+    
+    @Ignore(value="Cannot deterime if the format is narrowing")
     @Test public void testRewriteCrit_formatTimestamp1() {
         helpTestRewriteCriteria("formatTimestamp(pm3.g1.e4, 'MM dd, yyyy - HH:mm:ss.S') = '05 01, 1974 - 07:00:00.0'", //$NON-NLS-1$
                                 "pm3.g1.e4 = {ts'1974-05-01 07:00:00.0'}" );         //$NON-NLS-1$
     }
-
+
+    @Ignore(value="Cannot deterime if the format is narrowing")
     @Test public void testRewriteCrit_formatInteger() {
         helpTestRewriteCriteria("formatInteger(pm1.g1.e2, '#,##0') = '1,234'", //$NON-NLS-1$
                                 "pm1.g1.e2 = 1234" );         //$NON-NLS-1$
@@ -521,17 +539,20 @@
         helpTestRewriteCriteria("formatInteger(pm1.g1.e2, '#5') = '105'", //$NON-NLS-1$
                                 "formatInteger(pm1.g1.e2, '#5') = '105'" );         //$NON-NLS-1$
     }
-
+
+    @Ignore(value="Cannot deterime if the format is narrowing")
     @Test public void testRewriteCrit_formatLong() {
         helpTestRewriteCriteria("formatLong(convert(pm1.g1.e2, long), '#,##0') = '1,234,567,890,123'", //$NON-NLS-1$
                                 "1 = 0" );         //$NON-NLS-1$
     }
     
+    @Ignore(value="Cannot deterime if the format is narrowing")
     @Test public void testRewriteCrit_formatLong1() {
         helpTestRewriteCriteria("formatLong(convert(pm1.g1.e2, long), '#,##0') = '1,234,567,890'", //$NON-NLS-1$
                                 "pm1.g1.e2 = 1234567890" );         //$NON-NLS-1$
     }
-    
+    
+    @Ignore(value="Cannot deterime if the format is narrowing")
     @Test public void testRewriteCrit_formatTimestampInvert() { 
         String original = "formatTimestamp(pm3.g1.e4, 'MM dd, yyyy - HH:mm:ss.S') = ?"; //$NON-NLS-1$ 
         String expected = "pm3.g1.e4 = parseTimestamp(?, 'MM dd, yyyy - HH:mm:ss.S')"; //$NON-NLS-1$ 
@@ -545,7 +566,8 @@
          
         helpTestRewriteCriteria(original, expected);
     } 
-
+
+    @Ignore(value="Cannot deterime if the format is narrowing")
     @Test public void testRewriteCrit_formatBigInteger() throws Exception {
         String original = "formatBigInteger(convert(pm1.g1.e2, biginteger), '#,##0') = '1,234,567,890'"; //$NON-NLS-1$
         String expected = "pm1.g1.e2 = 1234567890"; //$NON-NLS-1$
@@ -558,7 +580,8 @@
         Criteria actual = QueryRewriter.rewriteCriteria(origCrit, null, null, null);
         assertEquals("Did not rewrite correctly: ", expectedCrit, actual); //$NON-NLS-1$
     }
-
+
+    @Ignore(value="Cannot deterime if the format is narrowing")
     @Test public void testRewriteCrit_formatFloat() throws Exception {
         String original = "formatFloat(convert(pm1.g1.e4, float), '#,##0.###') = '1,234.123'"; //$NON-NLS-1$
         String expected = "pm1.g1.e4 = 1234.123046875"; //$NON-NLS-1$
@@ -570,7 +593,8 @@
         Criteria actual = QueryRewriter.rewriteCriteria(origCrit, null, null, null);
         assertEquals("Did not rewrite correctly: ", expected, actual.toString()); //$NON-NLS-1$
     }
-
+
+    @Ignore(value="Cannot deterime if the format is narrowing")
     @Test public void testRewriteCrit_formatDouble() throws Exception {
         String original = "formatDouble(convert(pm1.g1.e4, double), '$#,##0.00') = '$1,234.50'"; //$NON-NLS-1$
         String expected = "pm1.g1.e4 = '1234.5'"; //$NON-NLS-1$
@@ -584,9 +608,10 @@
         Criteria actual = QueryRewriter.rewriteCriteria(origCrit, null, null, null);
         assertEquals("Did not rewrite correctly: ", expectedCrit, actual); //$NON-NLS-1$
     }
-
+
+    @Ignore(value="Cannot deterime if the format is narrowing")
     @Test public void testRewriteCrit_formatBigDecimal() throws Exception {
-        String original = "formatBigDecimal(convert(pm1.g1.e4, bigdecimal), '#,##0.###') = convert(1234.5, bigdecimal)"; //$NON-NLS-1$
+        String original = "formatBigDecimal(convert(pm1.g1.e4, bigdecimal), '#,##0.###') = '1,234.5'"; //$NON-NLS-1$
         String expected = "pm1.g1.e4 = 1234.5"; //$NON-NLS-1$
         
         FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached(); 
@@ -1101,7 +1126,7 @@
 		String rewritProc = "CREATE PROCEDURE\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "BEGIN\n";		 //$NON-NLS-1$
 		rewritProc = rewritProc + "DECLARE integer var1;\n"; //$NON-NLS-1$
-		rewritProc = rewritProc + "SELECT pm1.g1.e2 FROM pm1.g1 WHERE (CONCAT(e1, 'z') = CONCAT(CONCAT(e1, 'z'), 'y')) AND (CONCAT(e1, 'k') = '1');\n"; //$NON-NLS-1$
+		rewritProc = rewritProc + "SELECT pm1.g1.e2 FROM pm1.g1 WHERE (CONCAT(e1, 'z') = CONCAT(CONCAT(e1, 'z'), 'y')) AND (convert(CONCAT(e1, 'k'), integer) = 1);\n"; //$NON-NLS-1$
 		rewritProc = rewritProc + "END"; //$NON-NLS-1$
 
 		String procReturned = this.getReWrittenProcedure(procedure, userQuery, 
@@ -1490,11 +1515,9 @@
         // rewrite
         Command rewriteCommand = QueryRewriter.rewrite(command, null, null, null);
         
-        List parameters = ((StoredProcedure)rewriteCommand).getParameters();
-        
-        Iterator iter = parameters.iterator();
-        while(iter.hasNext()){
-            SPParameter param = (SPParameter)iter.next();
+        List<SPParameter> parameters = ((StoredProcedure)rewriteCommand).getParameters();
+
+        for (SPParameter param : parameters) {
             if(param.getParameterType() == ParameterInfo.IN || param.getParameterType() == ParameterInfo.INOUT){
                 assertTrue(param.getExpression() instanceof Constant);
             }
@@ -1569,8 +1592,6 @@
     @Test public void testRewriteCase1954b() throws Exception{
         FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached(); 
 
-        // Have to hand-build the criteria, because 3.0 gets parsed as a Float by default
-        // pm1.g1.e4 = 3.0
         CompareCriteria expected = new CompareCriteria();
         ElementSymbol leftElement = new ElementSymbol("pm1.g1.e4"); //$NON-NLS-1$
         Constant constant = new Constant(new Double(3.0), DataTypeManager.DefaultDataClasses.DOUBLE);
@@ -1579,13 +1600,14 @@
         // resolve against metadata
         QueryResolver.resolveCriteria(expected, metadata);
         
-        helpTestRewriteCriteria("convert(pm1.g1.e4, string) = '3'", expected, metadata); //$NON-NLS-1$ 
+        helpTestRewriteCriteria("convert(pm1.g1.e4, string) = '3.0'", expected, metadata); //$NON-NLS-1$ 
     }    
 
     @Test public void testRewriteCase1954c() {
         helpTestRewriteCriteria("convert(pm1.g1.e1, string) = 'x'", "pm1.g1.e1 = 'x'"); //$NON-NLS-1$ //$NON-NLS-2$
     }    
-
+
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteCase1954d() {
         helpTestRewriteCriteria("convert(pm1.g1.e1, timestamp) = {ts '2005-01-03 00:00:00.0'}", "pm1.g1.e1 = '2005-01-03 00:00:00.0'"); //$NON-NLS-1$ //$NON-NLS-2$
     }
@@ -1743,11 +1765,13 @@
         
         assertEquals("SELECT e1, e2 FROM pm1.g1 WHERE e1 = '1'", rewriteCommand.toString()); //$NON-NLS-1$
     }
-
+
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteNestedFunctions() {
         helpTestRewriteCommand("SELECT e1 FROM pm1.g1 where convert(parsedate(e1, 'yyyy-MM-dd'), string) = '2006-07-01'", "SELECT e1 FROM pm1.g1 WHERE e1 = '2006-07-01'"); //$NON-NLS-1$ //$NON-NLS-2$
     }
-    
+    
+    @Ignore(value="It's not generally possible to invert a narrowing conversion")
     @Test public void testRewriteWithReference() {
         helpTestRewriteCommand("SELECT e1 FROM pm1.g1 where parsetimestamp(e1, 'yyyy-MM-dd') != ?", "SELECT e1 FROM pm1.g1 WHERE e1 <> formattimestamp(?, 'yyyy-MM-dd')"); //$NON-NLS-1$ //$NON-NLS-2$
     }



More information about the teiid-commits mailing list