james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joac...@apache.org
Subject svn commit: r482635 - in /james/server/trunk/src/java/org/apache/james/mailboxmanager/torque: TorqueMailbox.java om/MessageFlagsPeer.java om/MessageRow.java om/MessageRowPeer.java
Date Tue, 05 Dec 2006 13:07:49 GMT
Author: joachim
Date: Tue Dec  5 05:07:48 2006
New Revision: 482635

URL: http://svn.apache.org/viewvc?view=rev&rev=482635
Log:
overwritten Torque's join logic (another improvement for JAMES-720)

Modified:
    james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
    james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageFlagsPeer.java
    james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageRow.java
    james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageRowPeer.java

Modified: james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java?view=diff&rev=482635&r1=482634&r2=482635
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
(original)
+++ james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
Tue Dec  5 05:07:48 2006
@@ -249,7 +249,7 @@
         try {
             Criteria c = criteriaForMessageSet(set);
             c.add(MessageFlagsPeer.MAILBOX_ID,getMailboxRow().getMailboxId());
-            List l = MessageFlagsPeer.doSelectJoinMessageRow(c);
+            List l = MessageRowPeer.doSelectJoinMessageFlags(c);
             MessageResult[] messageResults = fillMessageResult(l, result
                     | MessageResult.UID | MessageResult.FLAGS);
             checkForScanGap(range.getFromUid());
@@ -280,15 +280,7 @@
         MessageResult[] messageResults = new MessageResult[messageRows.size()];
         int i = 0;
         for (Iterator iter = messageRows.iterator(); iter.hasNext();) {
-            MessageRow messageRow;
-            Object next=iter.next();
-            if (next instanceof MessageRow) {
-                messageRow=(MessageRow)next;
-            } else {
-                MessageFlags messageFlags=(MessageFlags)next;
-                messageRow=messageFlags.getMessageRow();
-                messageRow.setMessageFlags(messageFlags);
-            }
+            MessageRow messageRow=(MessageRow)iter.next();
             messageResults[i] = fillMessageResult(messageRow, result);
             i++;
         }

Modified: james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageFlagsPeer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageFlagsPeer.java?view=diff&rev=482635&r1=482634&r2=482635
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageFlagsPeer.java
(original)
+++ james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageFlagsPeer.java
Tue Dec  5 05:07:48 2006
@@ -46,7 +46,5 @@
         }
     }
     
-    public static List doSelectJoinMessageRow(Criteria criteria) throws TorqueException {
-       return BaseMessageFlagsPeer.doSelectJoinMessageRow(criteria);
-    }
+
 }

Modified: james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageRow.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageRow.java?view=diff&rev=482635&r1=482634&r2=482635
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageRow.java
(original)
+++ james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageRow.java
Tue Dec  5 05:07:48 2006
@@ -36,7 +36,7 @@
     }
 
     public void setMessageFlags(MessageFlags messageFlags) {
-        this.collMessageFlagss=new ArrayList();
+        this.collMessageFlagss=new ArrayList(1);
         collMessageFlagss.add(messageFlags);
     }
 

Modified: james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageRowPeer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageRowPeer.java?view=diff&rev=482635&r1=482634&r2=482635
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageRowPeer.java
(original)
+++ james/server/trunk/src/java/org/apache/james/mailboxmanager/torque/om/MessageRowPeer.java
Tue Dec  5 05:07:48 2006
@@ -1,5 +1,14 @@
 package org.apache.james.mailboxmanager.torque.om;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.torque.TorqueException;
+import org.apache.torque.util.BasePeer;
+import org.apache.torque.util.Criteria;
+
+import com.workingdogs.village.Record;
+
 
 /**
  * The skeleton for this class was autogenerated by Torque on:
@@ -18,6 +27,34 @@
      */
     private static final long serialVersionUID = 1708650986440774692L;
 
+    public static List doSelectJoinMessageFlags(Criteria criteria)
+            throws TorqueException {
+        
+        MessageRowPeer.addSelectColumns(criteria);
+        int offset = numColumns + 1;
+        MessageFlagsPeer.addSelectColumns(criteria);
 
+        criteria.addJoin(MessageRowPeer.MAILBOX_ID, MessageFlagsPeer.MAILBOX_ID);
+        criteria.addJoin(MessageRowPeer.UID, MessageFlagsPeer.UID);
+        
+        List rows = BasePeer.doSelect(criteria);
+        List result = new ArrayList(rows.size());
+        
+        for (int i = 0; i < rows.size(); i++) {
+            Record row = (Record) rows.get(i);
+            
+            Class omClass = MessageRowPeer.getOMClass();
+            MessageRow messageRow = (MessageRow) MessageRowPeer.row2Object(row,
+                    1, omClass);
+            
+            omClass = MessageFlagsPeer.getOMClass();
+            MessageFlags messageFlags = (MessageFlags) MessageFlagsPeer.row2Object(row,
+                    offset, omClass);            
+            messageRow.setMessageFlags(messageFlags);
+            
+            result.add(messageRow);
+        }
+        return result;
+    }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message