From bcf480b4ddfdb82f810ce537a96909ec797c1f5f Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Fri, 7 Mar 2008 14:30:17 +0000
Subject: [PATCH] add in analysis row for each similarity qualifier added

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@7208 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
 uk/ac/sanger/artemis/chado/ArtemisUtils.java    |  1 +
 uk/ac/sanger/artemis/chado/GmodDAO.java         | 10 ++++++++++
 uk/ac/sanger/artemis/chado/IBatisDAO.java       |  5 +++++
 uk/ac/sanger/artemis/util/DatabaseDocument.java | 10 ++++++++--
 4 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/uk/ac/sanger/artemis/chado/ArtemisUtils.java b/uk/ac/sanger/artemis/chado/ArtemisUtils.java
index b40c6b273..2c357a12a 100644
--- a/uk/ac/sanger/artemis/chado/ArtemisUtils.java
+++ b/uk/ac/sanger/artemis/chado/ArtemisUtils.java
@@ -323,6 +323,7 @@ public class ArtemisUtils
         ";");
 
     analysis.setProgram((String) qualifier_strings.get(0));
+    analysis.setProgramVersion("1.0");
 
     // primary dbxref
     DbXRef dbXRef_1 = new DbXRef();
diff --git a/uk/ac/sanger/artemis/chado/GmodDAO.java b/uk/ac/sanger/artemis/chado/GmodDAO.java
index bf7ad170a..a9e41d916 100644
--- a/uk/ac/sanger/artemis/chado/GmodDAO.java
+++ b/uk/ac/sanger/artemis/chado/GmodDAO.java
@@ -150,6 +150,16 @@ public abstract class GmodDAO
   }
  
   
+  public List getFeaturesByOrganism(Organism organism)
+  {
+    return null;
+  }
+  
+  public List getFeaturesByUniqueNames(List name)
+  {
+    return null;  
+  }
+  
   //////
   ////// SchemaDaoI
   //////
diff --git a/uk/ac/sanger/artemis/chado/IBatisDAO.java b/uk/ac/sanger/artemis/chado/IBatisDAO.java
index a177ab2d0..76612f15e 100644
--- a/uk/ac/sanger/artemis/chado/IBatisDAO.java
+++ b/uk/ac/sanger/artemis/chado/IBatisDAO.java
@@ -943,6 +943,11 @@ public class IBatisDAO extends GmodDAO
     subjectLoc.setFeatureByFeatureId(matchFeature);
     sqlMap.insert("insertFeatureLoc", subjectLoc);
     
+    
+    // insert analysis
+    Integer analysisId =  (Integer) sqlMap.insert("insertAnalysis", analysisFeature.getAnalysis());
+    analysisFeature.getAnalysis().setAnalysisId(analysisId.intValue());
+    
     // insert analysis feature
     matchFeature.setFeatureId(matchFeatureId);
     analysisFeature.setFeature(matchFeature);
diff --git a/uk/ac/sanger/artemis/util/DatabaseDocument.java b/uk/ac/sanger/artemis/util/DatabaseDocument.java
index 4913545b3..4de4caecf 100644
--- a/uk/ac/sanger/artemis/util/DatabaseDocument.java
+++ b/uk/ac/sanger/artemis/util/DatabaseDocument.java
@@ -2240,9 +2240,9 @@ public class DatabaseDocument extends Document
       
       schema_list = dao.getOrganisms();
       
-      Organism org = new Organism();
+      /*Organism org = new Organism();
       org.setCommonName("web");
-      schema_list.add(org);
+      schema_list.add(org);*/
       
       final List pg_schemas = dao.getSchema();
       
@@ -2271,6 +2271,12 @@ public class DatabaseDocument extends Document
         final Organism organism = (Organism)it.next();
         String orgName = organism.getCommonName();
         
+        if(orgName == null || orgName.equals(""))
+        {
+          orgName = organism.getGenus() + "." + organism.getSpecies();
+          organism.setCommonName(orgName);
+        }
+        
         // search to see if this is in its own schema
         Iterator schemasIt = pg_schemas.iterator();
         while(schemasIt.hasNext())
-- 
GitLab