cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amania...@apache.org
Subject svn commit: r600721 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/
Date Mon, 03 Dec 2007 23:08:48 GMT
Author: amaniatis
Date: Mon Dec  3 15:08:46 2007
New Revision: 600721

URL: http://svn.apache.org/viewvc?rev=600721&view=rev
Log:
Generics.

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/BatchQueryBuilder.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/DataObjectMatchTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/InsertBatchQueryBuilder.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBBatchQueryBuilder.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBBatchQueryWrapper.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBInsertBatchQueryBuilder.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBUpdateBatchQueryBuilder.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/OrderingTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/ProcedureTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QueryAssembler.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QueryAssemblerHelper.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/UpdateBatchQueryBuilder.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/BatchQueryBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/BatchQueryBuilder.java?rev=600721&r1=600720&r2=600721&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/BatchQueryBuilder.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/BatchQueryBuilder.java
Mon Dec  3 15:08:46 2007
@@ -96,12 +96,12 @@
     public void bindParameters(PreparedStatement statement, BatchQuery query)
             throws SQLException, Exception {
 
-        List dbAttributes = query.getDbAttributes();
+        List<DbAttribute> dbAttributes = query.getDbAttributes();
         int attributeCount = dbAttributes.size();
 
         for (int i = 0; i < attributeCount; i++) {
             Object value = query.getValue(i);
-            DbAttribute attribute = (DbAttribute) dbAttributes.get(i);
+            DbAttribute attribute = dbAttributes.get(i);
             adapter.bindParameter(statement, value, i + 1, attribute.getType(), attribute
                     .getScale());
 
@@ -114,9 +114,9 @@
      * 
      * @since 1.2
      */
-    public List getParameterValues(BatchQuery query) {
+    public List<Object> getParameterValues(BatchQuery query) {
         int len = query.getDbAttributes().size();
-        List values = new ArrayList(len);
+        List<Object> values = new ArrayList<Object>(len);
         for (int i = 0; i < len; i++) {
             values.add(query.getValue(i));
         }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/DataObjectMatchTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/DataObjectMatchTranslator.java?rev=600721&r1=600720&r2=600721&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/DataObjectMatchTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/DataObjectMatchTranslator.java
Mon Dec  3 15:08:46 2007
@@ -38,8 +38,8 @@
  * @author Andrus Adamchik
  */
 public class DataObjectMatchTranslator {
-    protected Map attributes;
-    protected Map values;
+    protected Map<String, DbAttribute> attributes;
+    protected Map<String, Object> values;
     protected String operation;
     protected Expression expression;
     protected DbRelationship relationship;
@@ -66,26 +66,21 @@
      */
     public void setRelationship(DbRelationship rel) {
         this.relationship = rel;
-        attributes = new HashMap(rel.getJoins().size() * 2);
+        attributes = new HashMap<String, DbAttribute>(rel.getJoins().size() * 2);
 
         if (rel.isToMany() || !rel.isToPK()) {
 
             // match on target PK
             DbEntity ent = (DbEntity) rel.getTargetEntity();
-            Iterator pk = ent.getPrimaryKeys().iterator();
 
             // index by name
-            while (pk.hasNext()) {
-                DbAttribute pkAttr = (DbAttribute) pk.next();
+            for (DbAttribute pkAttr : ent.getPrimaryKeys()) {
                 attributes.put(pkAttr.getName(), pkAttr);
             }
         } else {
 
             // match on this FK
-            Iterator joins = rel.getJoins().iterator();
-            while (joins.hasNext()) {
-                DbJoin join = (DbJoin) joins.next();
-
+            for (DbJoin join : rel.getJoins()) {
                 // index by target name
                 attributes.put(join.getTargetName(), join.getSource());
             }
@@ -118,7 +113,7 @@
         }
     }
 
-    public Iterator keys() {
+    public Iterator<String> keys() {
         if (attributes == null) {
             throw new IllegalStateException(
                 "An attempt to use uninitialized DataObjectMatchTranslator: "
@@ -135,7 +130,7 @@
     }
 
     public DbAttribute getAttribute(String key) {
-        return (DbAttribute) attributes.get(key);
+        return attributes.get(key);
     }
 
     public Object getValue(String key) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/InsertBatchQueryBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/InsertBatchQueryBuilder.java?rev=600721&r1=600720&r2=600721&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/InsertBatchQueryBuilder.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/InsertBatchQueryBuilder.java
Mon Dec  3 15:08:46 2007
@@ -23,7 +23,6 @@
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.cayenne.dba.DbAdapter;
@@ -51,12 +50,12 @@
     public void bindParameters(PreparedStatement statement, BatchQuery query)
             throws SQLException, Exception {
 
-        List dbAttributes = query.getDbAttributes();
+        List<DbAttribute> dbAttributes = query.getDbAttributes();
         int attributeCount = dbAttributes.size();
 
         // must use an independent counter "j" for prepared statement index
         for (int i = 0, j = 0; i < attributeCount; i++) {
-            DbAttribute attribute = (DbAttribute) dbAttributes.get(i);
+            DbAttribute attribute = dbAttributes.get(i);
             if (includeInBatch(attribute)) {
                 j++;
                 Object value = query.getValue(i);
@@ -72,12 +71,12 @@
      * 
      * @since 1.2
      */
-    public List getParameterValues(BatchQuery query) {
-        List attributes = query.getDbAttributes();
+    public List<Object> getParameterValues(BatchQuery query) {
+        List<DbAttribute> attributes = query.getDbAttributes();
         int len = attributes.size();
-        List values = new ArrayList(len);
+        List<Object> values = new ArrayList<Object>(len);
         for (int i = 0; i < len; i++) {
-            DbAttribute attribute = (DbAttribute) attributes.get(i);
+            DbAttribute attribute = attributes.get(i);
             if (includeInBatch(attribute)) {
                 values.add(query.getValue(i));
             }
@@ -87,16 +86,13 @@
 
     public String createSqlString(BatchQuery batch) {
         String table = batch.getDbEntity().getFullyQualifiedName();
-        List dbAttributes = batch.getDbAttributes();
+        List<DbAttribute> dbAttributes = batch.getDbAttributes();
 
         StringBuffer query = new StringBuffer("INSERT INTO ");
         query.append(table).append(" (");
 
         int columnCount = 0;
-        Iterator it = dbAttributes.iterator();
-
-        while (it.hasNext()) {
-            DbAttribute attribute = (DbAttribute) it.next();
+        for (DbAttribute attribute : dbAttributes) {
 
             // attribute inclusion rule - one of the rules below must be true:
             // (1) attribute not generated

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBBatchQueryBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBBatchQueryBuilder.java?rev=600721&r1=600720&r2=600721&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBBatchQueryBuilder.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBBatchQueryBuilder.java
Mon Dec  3 15:08:46 2007
@@ -122,14 +122,14 @@
     public void bindParameters(PreparedStatement statement, BatchQuery query)
             throws SQLException, Exception {
 
-        List dbAttributes = query.getDbAttributes();
+        List<DbAttribute> dbAttributes = query.getDbAttributes();
         int attributeCount = dbAttributes.size();
 
         // i - attribute position in the query
         // j - PreparedStatement parameter position (starts with "1")
         for (int i = 0, j = 1; i < attributeCount; i++) {
             Object value = query.getValue(i);
-            DbAttribute attribute = (DbAttribute) dbAttributes.get(i);
+            DbAttribute attribute = dbAttributes.get(i);
             int type = attribute.getType();
 
             // TODO: (Andrus) This works as long as there is no LOBs in qualifier

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBBatchQueryWrapper.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBBatchQueryWrapper.java?rev=600721&r1=600720&r2=600721&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBBatchQueryWrapper.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBBatchQueryWrapper.java
Mon Dec  3 15:08:46 2007
@@ -42,7 +42,7 @@
 
     protected BatchQuery query;
 
-    protected List dbAttributes;
+    protected List<DbAttribute> dbAttributes;
 
     // attribute list decoders
     protected boolean[] qualifierAttributes;
@@ -79,7 +79,7 @@
     protected void indexQualifierAttributes() {
         int len = this.dbAttributes.size();
         for (int i = 0; i < len; i++) {
-            DbAttribute attribute = (DbAttribute) this.dbAttributes.get(i);
+            DbAttribute attribute = this.dbAttributes.get(i);
             int type = attribute.getType();
             qualifierAttributes[i] = attribute.isPrimaryKey();
             allLOBAttributes[i] = (type == Types.BLOB || type == Types.CLOB);
@@ -102,7 +102,7 @@
                     continue;
                 }
 
-                if (((DbAttribute) dbAttributes.get(i)).getType() == Types.BLOB) {
+                if (dbAttributes.get(i).getType() == Types.BLOB) {
                     updatedLOBAttributes[i] = convertToBlobValue(value);
                 }
                 else {
@@ -165,7 +165,7 @@
     public List getDbAttributesForLOBSelectQualifier() {
 
         int len = qualifierAttributes.length;
-        List attributes = new ArrayList(len);
+        List<DbAttribute> attributes = new ArrayList<DbAttribute>(len);
 
         for (int i = 0; i < len; i++) {
             if (this.qualifierAttributes[i]) {
@@ -186,7 +186,7 @@
         }
 
         int len = updatedLOBAttributes.length;
-        List attributes = new ArrayList(len);
+        List<DbAttribute> attributes = new ArrayList<DbAttribute>(len);
 
         for (int i = 0; i < len; i++) {
             if (this.updatedLOBAttributes[i] != null) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBInsertBatchQueryBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBInsertBatchQueryBuilder.java?rev=600721&r1=600720&r2=600721&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBInsertBatchQueryBuilder.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBInsertBatchQueryBuilder.java
Mon Dec  3 15:08:46 2007
@@ -38,13 +38,13 @@
     }
 
     public List getValuesForLOBUpdateParameters(BatchQuery query) {
-        List dbAttributes = query.getDbAttributes();
+        List<DbAttribute> dbAttributes = query.getDbAttributes();
         int len = dbAttributes.size();
 
         List values = new ArrayList(len);
         for (int i = 0; i < len; i++) {
             Object value = query.getValue(i);
-            DbAttribute attribute = (DbAttribute) dbAttributes.get(i);
+            DbAttribute attribute = dbAttributes.get(i);
             if (isUpdateableColumn(value, attribute.getType())) {
                 values.add(value);
             }
@@ -55,11 +55,11 @@
 
     public String createSqlString(BatchQuery batch) {
         String table = batch.getDbEntity().getFullyQualifiedName();
-        List dbAttributes = batch.getDbAttributes();
+        List<DbAttribute> dbAttributes = batch.getDbAttributes();
         StringBuffer query = new StringBuffer("INSERT INTO ");
         query.append(table).append(" (");
-        for (Iterator i = dbAttributes.iterator(); i.hasNext();) {
-            DbAttribute attribute = (DbAttribute) i.next();
+        for (Iterator<DbAttribute> i = dbAttributes.iterator(); i.hasNext();) {
+            DbAttribute attribute = i.next();
             query.append(attribute.getName());
             if (i.hasNext()) {
                 query.append(", ");
@@ -73,7 +73,7 @@
 
             appendUpdatedParameter(
                 query,
-                (DbAttribute) dbAttributes.get(i),
+                dbAttributes.get(i),
                 batch.getValue(i));
         }
         query.append(')');

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBUpdateBatchQueryBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBUpdateBatchQueryBuilder.java?rev=600721&r1=600720&r2=600721&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBUpdateBatchQueryBuilder.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/LOBUpdateBatchQueryBuilder.java
Mon Dec  3 15:08:46 2007
@@ -43,13 +43,13 @@
         UpdateBatchQuery updateBatch = (UpdateBatchQuery) query;
 
         List values = new ArrayList(len);
-        List qualifierAttributes = updateBatch.getQualifierAttributes();
-        List updatedDbAttributes = updateBatch.getUpdatedAttributes();
+        List<DbAttribute> qualifierAttributes = updateBatch.getQualifierAttributes();
+        List<DbAttribute> updatedDbAttributes = updateBatch.getUpdatedAttributes();
 
         int updatedLen = updatedDbAttributes.size();
         int qualifierLen = qualifierAttributes.size();
         for (int i = 0; i < updatedLen; i++) {
-            DbAttribute attribute = (DbAttribute) updatedDbAttributes.get(i);
+            DbAttribute attribute = updatedDbAttributes.get(i);
             Object value = query.getValue(i);
             if(isUpdateableColumn(value, attribute.getType())) {
             	values.add(value);
@@ -66,8 +66,8 @@
     public String createSqlString(BatchQuery batch) {
         UpdateBatchQuery updateBatch = (UpdateBatchQuery) batch;
         String table = batch.getDbEntity().getFullyQualifiedName();
-        List idDbAttributes = updateBatch.getQualifierAttributes();
-        List updatedDbAttributes = updateBatch.getUpdatedAttributes();
+        List<DbAttribute> idDbAttributes = updateBatch.getQualifierAttributes();
+        List<DbAttribute> updatedDbAttributes = updateBatch.getUpdatedAttributes();
         StringBuffer query = new StringBuffer("UPDATE ");
         query.append(table).append(" SET ");
 
@@ -77,15 +77,15 @@
                 query.append(", ");
             }
 
-            DbAttribute attribute = (DbAttribute) updatedDbAttributes.get(i);
+            DbAttribute attribute = updatedDbAttributes.get(i);
             query.append(attribute.getName()).append(" = ");
             appendUpdatedParameter(query, attribute, batch.getValue(i));
         }
 
         query.append(" WHERE ");
-        Iterator i = idDbAttributes.iterator();
+        Iterator<DbAttribute> i = idDbAttributes.iterator();
         while (i.hasNext()) {
-            DbAttribute attribute = (DbAttribute) i.next();
+            DbAttribute attribute = i.next();
             appendDbAttribute(query, attribute);
             query.append(" = ?");
             if (i.hasNext()) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/OrderingTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/OrderingTranslator.java?rev=600721&r1=600720&r2=600721&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/OrderingTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/OrderingTranslator.java
Mon Dec  3 15:08:46 2007
@@ -36,7 +36,7 @@
  */
 public class OrderingTranslator extends QueryAssemblerHelper {
 
-    protected List orderByColumnList = new ArrayList();
+    protected List<String> orderByColumnList = new ArrayList<String>();
     
     public OrderingTranslator(QueryAssembler queryAssembler) {
         super(queryAssembler);
@@ -54,23 +54,18 @@
             return null;
 
         StringBuffer buf = new StringBuffer();
-        List list = ((SelectQuery) q).getOrderings();
-        int len = list.size();
 
-        for (int i = 0; i < len; i++) {
-            if (i > 0)
+        for (Ordering ord : ((SelectQuery) q).getOrderings()) {
+            if (buf.length() > 0)
                 buf.append(", ");
 
             StringBuffer ordComp = new StringBuffer();
-
-            Ordering ord = (Ordering) list.get(i);
-
+            
             //UPPER is (I think) part of the SQL99 standard, and I'm not convinced it's universally
available
             // - should the syntax used here be defined by the Db specific adaptor perhaps,
or at least
             // possibly specified by the db adaptor (a DB specific OrderingTranslator hook)?
             if (ord.isCaseInsensitive()) {
                 ordComp.append("UPPER(");
-
             }
 
             Expression exp = ord.getSortSpec();
@@ -108,7 +103,7 @@
      * order by, an element of the list would be 
      * <code>UPPER(&lt;column reference&gt;)</code>
      */    
-    public List getOrderByColumnList() {
+    public List<String> getOrderByColumnList() {
         return orderByColumnList;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/ProcedureTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/ProcedureTranslator.java?rev=600721&r1=600720&r2=600721&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/ProcedureTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/ProcedureTranslator.java
Mon Dec  3 15:08:46 2007
@@ -57,7 +57,7 @@
 
     private static NotInParam OUT_PARAM = new NotInParam("[OUT]");
 
-    protected List callParams;
+    protected List<ProcedureParameter> callParams;
     protected List values;
 
     /**
@@ -140,11 +140,11 @@
      */
     protected void initStatement(CallableStatement stmt) throws Exception {
         if (values != null && values.size() > 0) {
-            List params = getProcedure().getCallParameters();
+            List<ProcedureParameter> params = getProcedure().getCallParameters();
 
             int len = values.size();
             for (int i = 0; i < len; i++) {
-                ProcedureParameter param = (ProcedureParameter) params.get(i);
+                ProcedureParameter param = params.get(i);
 
                 // !Stored procedure parameter can be both in and out
                 // at the same time
@@ -166,9 +166,7 @@
         // make an assumption that a missing value is NULL
         // Any reason why this is bad?
 
-        Iterator it = callParams.iterator();
-        while (it.hasNext()) {
-            ProcedureParameter param = (ProcedureParameter) it.next();
+        for (ProcedureParameter param : callParams) {
 
             if (param.getDirection() == ProcedureParameter.OUT_PARAMETER) {
                 values.add(OUT_PARAM);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QueryAssembler.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QueryAssembler.java?rev=600721&r1=600720&r2=600721&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QueryAssembler.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QueryAssembler.java
Mon Dec  3 15:08:46 2007
@@ -37,7 +37,7 @@
 public abstract class QueryAssembler extends QueryTranslator {
 
     /** PreparedStatement values. */
-    protected List values = new ArrayList();
+    protected List<Object> values = new ArrayList<Object>();
 
     /**
      * PreparedStatement attributes matching entries in <code>values</code> list.
@@ -77,7 +77,7 @@
     }
 
     /**
-     * Registers <code>anObject</code> as a PreparedStatement paramter.
+     * Registers <code>anObject</code> as a PreparedStatement parameter.
      * 
      * @param anObject object that represents a value of DbAttribute
      * @param dbAttr DbAttribute being processed.

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QueryAssemblerHelper.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QueryAssemblerHelper.java?rev=600721&r1=600720&r2=600721&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QueryAssemblerHelper.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QueryAssemblerHelper.java
Mon Dec  3 15:08:46 2007
@@ -84,7 +84,7 @@
     /** Processes parts of the OBJ_PATH expression. */
     protected void appendObjPath(StringBuffer buf, Expression pathExp) {
 
-        Iterator it = getObjEntity().resolvePathComponents(pathExp);
+        Iterator<Object> it = getObjEntity().resolvePathComponents(pathExp);
         ObjRelationship lastRelationship = null;
 
         while (it.hasNext()) {
@@ -100,9 +100,8 @@
                 }
                 else {
                     // find and add joins ....
-                    Iterator relit = rel.getDbRelationships().iterator();
-                    while (relit.hasNext()) {
-                        queryAssembler.dbRelationshipAdded((DbRelationship) relit.next());
+                    for (DbRelationship dbRel : rel.getDbRelationships()) {
+                        queryAssembler.dbRelationshipAdded(dbRel);
                     }
                 }
                 lastRelationship = rel;
@@ -110,9 +109,8 @@
             else {
                 ObjAttribute objAttr = (ObjAttribute) pathComp;
                 if (lastRelationship != null) {
-                    List lastDbRelList = lastRelationship.getDbRelationships();
-                    DbRelationship lastDbRel =
-                        (DbRelationship) lastDbRelList.get(lastDbRelList.size() - 1);
+                    List<DbRelationship> lastDbRelList = lastRelationship.getDbRelationships();
+                    DbRelationship lastDbRel = lastDbRelList.get(lastDbRelList.size() - 1);
                     processColumn(buf, objAttr.getDbAttribute(), lastDbRel);
                 }
                 else {
@@ -123,7 +121,7 @@
     }
 
     protected void appendDbPath(StringBuffer buf, Expression pathExp) {
-        Iterator it = getDbEntity().resolvePathComponents(pathExp);
+        Iterator<Object> it = getDbEntity().resolvePathComponents(pathExp);
 
         while (it.hasNext()) {
             Object pathComp = it.next();
@@ -232,7 +230,7 @@
                 throw new CayenneRuntimeException("Can't use NEW object as a query parameter.");
             }
 
-            Map snap = id.getIdSnapshot();
+            Map<String, Object> snap = id.getIdSnapshot();
             if (snap.size() != 1) {
                 StringBuffer msg = new StringBuffer();
                 msg
@@ -324,9 +322,9 @@
                     }
                     else if (last instanceof ObjRelationship) {
                         ObjRelationship objRelationship = (ObjRelationship) last;
-                        List dbPath = objRelationship.getDbRelationships();
+                        List<DbRelationship> dbPath = objRelationship.getDbRelationships();
                         if (dbPath.size() > 0) {
-                            relationship = (DbRelationship) dbPath.get(dbPath.size() - 1);
+                            relationship = dbPath.get(dbPath.size() - 1);
                             break;
                         }
                     }
@@ -367,11 +365,11 @@
       */
     protected void processRelTermination(StringBuffer buf, ObjRelationship rel) {
 
-        Iterator dbRels = rel.getDbRelationships().iterator();
+        Iterator<DbRelationship> dbRels = rel.getDbRelationships().iterator();
 
         // scan DbRelationships
         while (dbRels.hasNext()) {
-            DbRelationship dbRel = (DbRelationship) dbRels.next();
+            DbRelationship dbRel = dbRels.next();
 
             // if this is a last relationship in the path,
             // it needs special handling
@@ -399,7 +397,7 @@
         }
 
         // get last DbRelationship on the list
-        List joins = rel.getJoins();
+        List<DbJoin> joins = rel.getJoins();
         if (joins.size() != 1) {
             StringBuffer msg = new StringBuffer();
             msg
@@ -412,7 +410,7 @@
             throw new CayenneRuntimeException(msg.toString());
         }
 
-        DbJoin join = (DbJoin) joins.get(0);
+        DbJoin join = joins.get(0);
 
         DbAttribute attribute = null;
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java?rev=600721&r1=600720&r2=600721&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java
Mon Dec  3 15:08:46 2007
@@ -689,7 +689,7 @@
             msg.append("Alias not found, DbEntity: '").append(
                     ent != null ? ent.getName() : "<null entity>").append(
                     "'\nExisting aliases:");
-
+            
             int len = aliasList.size();
             for (int i = 0; i < len; i++) {
                 String dbeName = (tableList.get(i) != null)

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/UpdateBatchQueryBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/UpdateBatchQueryBuilder.java?rev=600721&r1=600720&r2=600721&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/UpdateBatchQueryBuilder.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/UpdateBatchQueryBuilder.java
Mon Dec  3 15:08:46 2007
@@ -45,8 +45,8 @@
     public String createSqlString(BatchQuery batch) {
         UpdateBatchQuery updateBatch = (UpdateBatchQuery) batch;
         String table = batch.getDbEntity().getFullyQualifiedName();
-        List qualifierAttributes = updateBatch.getQualifierAttributes();
-        List updatedDbAttributes = updateBatch.getUpdatedAttributes();
+        List<DbAttribute> qualifierAttributes = updateBatch.getQualifierAttributes();
+        List<DbAttribute> updatedDbAttributes = updateBatch.getUpdatedAttributes();
 
         StringBuffer query = new StringBuffer("UPDATE ");
         query.append(table).append(" SET ");
@@ -57,15 +57,15 @@
                 query.append(", ");
             }
 
-            DbAttribute attribute = (DbAttribute) updatedDbAttributes.get(i);
+            DbAttribute attribute = updatedDbAttributes.get(i);
             query.append(attribute.getName()).append(" = ?");
         }
 
         query.append(" WHERE ");
 
-        Iterator i = qualifierAttributes.iterator();
+        Iterator<DbAttribute> i = qualifierAttributes.iterator();
         while (i.hasNext()) {
-            DbAttribute attribute = (DbAttribute) i.next();
+            DbAttribute attribute = i.next();
             appendDbAttribute(query, attribute);
             query.append(updateBatch.isNull(attribute) ? " IS NULL" : " = ?");
 
@@ -84,15 +84,15 @@
             throws SQLException, Exception {
 
         UpdateBatchQuery updateBatch = (UpdateBatchQuery) query;
-        List qualifierAttributes = updateBatch.getQualifierAttributes();
-        List updatedDbAttributes = updateBatch.getUpdatedAttributes();
+        List<DbAttribute> qualifierAttributes = updateBatch.getQualifierAttributes();
+        List<DbAttribute> updatedDbAttributes = updateBatch.getUpdatedAttributes();
 
         int len = updatedDbAttributes.size();
         int parameterIndex = 1;
         for (int i = 0; i < len; i++) {
             Object value = query.getValue(i);
 
-            DbAttribute attribute = (DbAttribute) updatedDbAttributes.get(i);
+            DbAttribute attribute = updatedDbAttributes.get(i);
             adapter.bindParameter(
                     statement,
                     value,
@@ -103,7 +103,7 @@
 
         for (int i = 0; i < qualifierAttributes.size(); i++) {
             Object value = query.getValue(len + i);
-            DbAttribute attribute = (DbAttribute) qualifierAttributes.get(i);
+            DbAttribute attribute = qualifierAttributes.get(i);
 
             // skip null attributes... they are translated as "IS NULL"
             if (updateBatch.isNull(attribute)) {



Mime
View raw message