cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1063285 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/access/trans/ test/java/org/apache/cayenne/query/ test/java/org/apache/cayenne/testdo/consttest/ test/java/org/apache/cayenne/testdo/co...
Date Tue, 25 Jan 2011 14:08:13 GMT
Author: aadamchik
Date: Tue Jan 25 14:08:12 2011
New Revision: 1063285

URL: http://svn.apache.org/viewvc?rev=1063285&view=rev
Log:
CAY-1528 Undo CAY-1213

undoing r998620

Removed:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/ConstQueryTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/consttest/Const.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/consttest/Const1Entity.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/consttest/Const1Status.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/consttest/Const1Type.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/consttest/auto/_Const.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/consttest/auto/_Const1Entity.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/cayenne-const.xml
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/const.map.xml
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/spring-test-resources.xml

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java?rev=1063285&r1=1063284&r2=1063285&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java
Tue Jan 25 14:08:12 2011
@@ -27,7 +27,6 @@ import org.apache.cayenne.CayenneRuntime
 import org.apache.cayenne.ObjectId;
 import org.apache.cayenne.Persistent;
 import org.apache.cayenne.exp.Expression;
-import org.apache.cayenne.exp.ExpressionException;
 import org.apache.cayenne.exp.TraversalHandler;
 import org.apache.cayenne.exp.parser.ASTDbPath;
 import org.apache.cayenne.exp.parser.ASTObjPath;
@@ -40,7 +39,6 @@ import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.query.QualifiedQuery;
 import org.apache.cayenne.query.Query;
 import org.apache.cayenne.reflect.ClassDescriptor;
-import org.apache.cayenne.util.Util;
 import org.apache.commons.collections.IteratorUtils;
 import org.apache.commons.collections.Transformer;
 
@@ -374,50 +372,11 @@ public class QualifierTranslator extends
         }
     }
 
-    private boolean tryAppendConst(String path, Expression parentNode) throws IOException
{
-
-        if (path.length() < 3) {
-            return false;
-        }
-
-        int lastDot = path.lastIndexOf('.');
-        if (lastDot <= 0 || lastDot == path.length() - 1) {
-            return false;
-        }
-
-        String constName = path.substring(lastDot + 1);
-        String className = path.substring(0, lastDot);
-        
-        Object constValue;
-        try {
-            Class<?> klass = Util.getJavaClass(className);
-            Field constField = klass.getField(constName);
-            constValue = constField.get(null);
-        }
-        catch (ClassNotFoundException e) {
-            return false;
-        }
-        catch (NoSuchFieldException e) {
-            return false;
-        }
-        catch (IllegalAccessException e) {
-            throw new ExpressionException("Can't access const field", e);
-        }
-        appendLiteral(constValue, paramsDbType(parentNode), parentNode);
-        return true;
-    }
-
-    private void appendObjPathOrConst(Object leaf, Expression parentNode)
-            throws IOException {
-        if (!(leaf instanceof String && tryAppendConst((String) leaf, parentNode)))
{
-            appendObjPath(parentNode);
-        }
-    }
-
     public void objectNode(Object leaf, Expression parentNode) {
+
         try {
             if (parentNode.getType() == Expression.OBJ_PATH) {
-                appendObjPathOrConst(leaf, parentNode);
+                appendObjPath(parentNode);
             }
             else if (parentNode.getType() == Expression.DB_PATH) {
                 appendDbPath(parentNode);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/spring-test-resources.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/spring-test-resources.xml?rev=1063285&r1=1063284&r2=1063285&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/spring-test-resources.xml
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/spring-test-resources.xml
Tue Jan 25 14:08:12 2011
@@ -112,9 +112,6 @@
     <bean id="InheritanceVerticalMap" class="org.apache.cayenne.unit.DataMapFactory">
         <constructor-arg><value>inheritance-vertical.map.xml</value></constructor-arg>
     </bean>
-    <bean id="ConstMap" class="org.apache.cayenne.unit.DataMapFactory">
-        <constructor-arg><value>const.map.xml</value></constructor-arg>
-    </bean>
     
 	
 	<!-- ======================================= -->
@@ -198,7 +195,6 @@
                 <ref bean="QuoteMap"/>
 				<ref bean="InheritanceSingleTable1Map"/>
 				<ref bean="InheritanceVerticalMap"/>
-				<ref bean="ConstMap"/>
 			</list>
 		</constructor-arg>
 	</bean>



Mime
View raw message