From eb65588c27c18da95c6dc41a5a2c7a65c6b56e42 Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Tue, 22 Apr 2008 08:52:48 +0000
Subject: [PATCH] attach lazy loading chado feature to GFFStreamFeature

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@7275 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
 uk/ac/sanger/artemis/io/GFFDocumentEntry.java | 27 ++++++++++++++++---
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/uk/ac/sanger/artemis/io/GFFDocumentEntry.java b/uk/ac/sanger/artemis/io/GFFDocumentEntry.java
index d933bcaa0..e89732f47 100644
--- a/uk/ac/sanger/artemis/io/GFFDocumentEntry.java
+++ b/uk/ac/sanger/artemis/io/GFFDocumentEntry.java
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/GFFDocumentEntry.java,v 1.52 2007-10-15 08:39:29 tjc Exp $
+ * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/GFFDocumentEntry.java,v 1.53 2008-04-22 08:52:48 tjc Exp $
  */
 
 package uk.ac.sanger.artemis.io;
@@ -43,7 +43,7 @@ import java.sql.Timestamp;
  *  A DocumentEntry that can read an GFF entry from a Document.
  *
  *  @author Kim Rutherford
- *  @version $Id: GFFDocumentEntry.java,v 1.52 2007-10-15 08:39:29 tjc Exp $
+ *  @version $Id: GFFDocumentEntry.java,v 1.53 2008-04-22 08:52:48 tjc Exp $
  **/
 
 public class GFFDocumentEntry extends SimpleDocumentEntry
@@ -266,9 +266,28 @@ public class GFFDocumentEntry extends SimpleDocumentEntry
       }
   
       //
-      // load /similarity - lazily
+      // 
       if(getDocument() instanceof DatabaseDocument)
-        loadSimilarityLazyData(original_features);
+      {
+        DatabaseDocument doc = (DatabaseDocument)getDocument();
+          
+        if(!doc.isLazyFeatureLoad())
+          loadSimilarityLazyData(original_features); // load /similarity - lazily
+        else
+        {
+          // using lazy loading - add the lazy chado feature to GFFStreamFeature
+          final Hashtable idFeatureStore = doc.getIdFeatureStore();
+          for(int i = 0 ; i < original_features.size() ; ++i) 
+          {
+            this_feature = original_features.featureAt(i);
+            String featureId = (String) this_feature.getQualifierByName("feature_id").getValues().get(0);
+            org.gmod.schema.sequence.Feature chadoLazyFeature = 
+              (org.gmod.schema.sequence.Feature)idFeatureStore.get(featureId);
+            ((GFFStreamFeature)this_feature).setChadoLazyFeature(chadoLazyFeature);
+          }
+          idFeatureStore.clear();
+        }
+      }
 
       // now join exons
       //combineFeatures();
-- 
GitLab