cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r734989 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLIdColumnsTranslator.java
Date Fri, 16 Jan 2009 12:39:20 GMT
Author: aadamchik
Date: Fri Jan 16 04:39:19 2009
New Revision: 734989

URL: http://svn.apache.org/viewvc?rev=734989&view=rev
Log:
CAY-1047 Aligning query capabilities

added pagination to EJBQLQuery - cleaning up new class

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLIdColumnsTranslator.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLIdColumnsTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLIdColumnsTranslator.java?rev=734989&r1=734988&r2=734989&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLIdColumnsTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLIdColumnsTranslator.java
Fri Jan 16 04:39:19 2009
@@ -18,64 +18,43 @@
  ****************************************************************/
 package org.apache.cayenne.access.jdbc;
 
-import java.util.Iterator;
 import java.util.Map;
-import java.util.Set;
 
-import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.ejbql.EJBQLExpression;
 import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.map.DbEntity;
-import org.apache.cayenne.map.DbJoin;
-import org.apache.cayenne.map.DbRelationship;
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
-import org.apache.cayenne.map.ObjRelationship;
-import org.apache.cayenne.reflect.ArcProperty;
-import org.apache.cayenne.reflect.AttributeProperty;
 import org.apache.cayenne.reflect.ClassDescriptor;
-import org.apache.cayenne.reflect.PropertyVisitor;
-import org.apache.cayenne.reflect.ToManyProperty;
-import org.apache.cayenne.reflect.ToOneProperty;
 
-
-public class EJBQLIdColumnsTranslator extends EJBQLIdentifierColumnsTranslator {
+/**
+ * @since 3.0
+ */
+class EJBQLIdColumnsTranslator extends EJBQLIdentifierColumnsTranslator {
 
     private EJBQLTranslationContext context;
-    private Set<String> columns;
-    
+
     EJBQLIdColumnsTranslator(EJBQLTranslationContext context) {
         super(context);
         this.context = context;
     }
-    
+
     @Override
     public boolean visitIdentifier(EJBQLExpression expression) {
 
-        Map<String, String> xfields = null;
+        Map<String, String> fields = null;
         if (context.isAppendingResultColumns()) {
-            xfields = context.nextEntityResult().getFields();
+            fields = context.nextEntityResult().getFields();
         }
 
-        // assign whatever we have to a final ivar so that it can be accessed within
-        // the inner class
-        final Map<String, String> fields = xfields;
-        final String idVar = expression.getText();
-        
+        String idVar = expression.getText();
+
         ClassDescriptor descriptor = context.getEntityDescriptor(idVar);
         ObjEntity oe = descriptor.getEntity();
 
-        
-        Iterator<ObjAttribute> ObjIterator = oe.getPrimaryKeys().iterator();
-        try{
-            while(ObjIterator.hasNext()){
-                
-                ObjAttribute temp = ObjIterator.next();
-                DbAttribute t = (DbAttribute) oe.getDbEntity().getAttribute(temp.getDbAttributeName());
-                appendColumn(idVar, temp,t, fields ,temp.getType());
-            }
-        }catch (Exception e) {
-            // TODO: handle exception
+        for (ObjAttribute oa : oe.getPrimaryKeys()) {
+            DbAttribute t = (DbAttribute) oe.getDbEntity().getAttribute(
+                    oa.getDbAttributeName());
+            appendColumn(idVar, oa, t, fields, oa.getType());
         }
 
         return false;



Mime
View raw message