finalizing preferred refactoring
authorn.hoffmann <n.hoffmann@localhost>
Mon, 29 Jun 2009 14:03:03 +0000 (14:03 +0000)
committern.hoffmann <n.hoffmann@localhost>
Mon, 29 Jun 2009 14:03:03 +0000 (14:03 +0000)
.gitattributes
taxeditor-store/plugin.xml
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/io/AbstractImportWizard.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/io/BerlinModelImportWizard.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/SpecimenTypeDesignationStatusMenuPreferences.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonRelationshipTypeMenuPreferences.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/store/VocabularyStore.java
taxeditor-store/src/test/java/eu/etaxonomy/taxeditor/store/CdmStoreTest.java

index 2070ec57e7b0543533188b381abef0ecd33bfd26..53811ccee276e284c411ed99de20bd04bbeeb4e1 100644 (file)
@@ -1072,6 +1072,8 @@ taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalCod
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalStatusTypeMenuPreferences.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/RankMenuPreferences.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalStatusTypeMenuPreferences.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/RankMenuPreferences.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/SpecimenTypeDesignationStatusMenuPreferences.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonRelationshipTypeMenuPreferences.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicPreferences.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/wizards/FeatureWizard.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/wizards/FeatureWizardEditPage.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicPreferences.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/wizards/FeatureWizard.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/wizards/FeatureWizardEditPage.java -text
index 8d2044070b0fc3a912206372f163292e24c9716e..c515e0b3418d0b51d0e7e1576e55f0e86a43756e 100644 (file)
@@ -3,6 +3,28 @@
 <plugin>
    <extension
          point="org.eclipse.ui.preferencePages">
 <plugin>
    <extension
          point="org.eclipse.ui.preferencePages">
+      <page
+            class="eu.etaxonomy.taxeditor.preference.DescriptionPreferences"
+            id="eu.etaxonomy.taxeditor.preferences.description"
+            name="Description">
+      </page>
+      <page
+            category="eu.etaxonomy.taxeditor.preferences.description"
+            class="eu.etaxonomy.taxeditor.preference.FeatureMenuPreferences"
+            id="eu.etaxonomy.taxeditor.preferences.feature"
+            name="Features">
+      </page>
+      <page
+            category="eu.etaxonomy.taxeditor.preferences.description"
+            class="eu.etaxonomy.taxeditor.preference.DistributionStatusMenuPreferences"
+            id="eu.etaxonomy.taxeditor.preferences.distributionStatus"
+            name="Distribution Status">
+      </page>
+      <page
+            class="eu.etaxonomy.taxeditor.preference.TaxonomicPreferences"
+            id="eu.etaxonomy.taxeditor.preferences.taxonomic"
+            name="Taxonomic">
+      </page>
       <page
             category="eu.etaxonomy.taxeditor.preferences.taxonomic"
             class="eu.etaxonomy.taxeditor.preference.NomenclaturalCodePreferences"
       <page
             category="eu.etaxonomy.taxeditor.preferences.taxonomic"
             class="eu.etaxonomy.taxeditor.preference.NomenclaturalCodePreferences"
             id="eu.etaxonomy.taxeditor.preferences.initdb"
             name="Initialize Datastore">
       </page-->
             id="eu.etaxonomy.taxeditor.preferences.initdb"
             name="Initialize Datastore">
       </page-->
-      <page
-            category="eu.etaxonomy.taxeditor.preferences.description"
-            class="eu.etaxonomy.taxeditor.preference.FeatureMenuPreferences"
-            id="eu.etaxonomy.taxeditor.preferences.feature"
-            name="Features">
-      </page>
       <page
             category="eu.etaxonomy.taxeditor.preferences.taxonomic"
             class="eu.etaxonomy.taxeditor.preference.RankMenuPreferences"
             id="eu.etaxonomy.taxeditor.preferences.ranks"
             name="Ranks">
       </page>
       <page
             category="eu.etaxonomy.taxeditor.preferences.taxonomic"
             class="eu.etaxonomy.taxeditor.preference.RankMenuPreferences"
             id="eu.etaxonomy.taxeditor.preferences.ranks"
             name="Ranks">
       </page>
-      <page
-            category="eu.etaxonomy.taxeditor.preferences.description"
-            class="eu.etaxonomy.taxeditor.preference.DistributionStatusMenuPreferences"
-            id="eu.etaxonomy.taxeditor.preferences.distributionStatus"
-            name="Distribution States">
-      </page>
       <page
             category="eu.etaxonomy.taxeditor.preferences.taxonomic"
             class="eu.etaxonomy.taxeditor.preference.NomenclaturalStatusTypeMenuPreferences"
       <page
             category="eu.etaxonomy.taxeditor.preferences.taxonomic"
             class="eu.etaxonomy.taxeditor.preference.NomenclaturalStatusTypeMenuPreferences"
             name="Name Relationship Type">
       </page>
       <page
             name="Name Relationship Type">
       </page>
       <page
-            class="eu.etaxonomy.taxeditor.preference.TaxonomicPreferences"
-            id="eu.etaxonomy.taxeditor.preferences.taxonomic"
-            name="Taxonomic">
+            category="eu.etaxonomy.taxeditor.preferences.taxonomic"
+            class="eu.etaxonomy.taxeditor.preference.TaxonRelationshipTypeMenuPreferences"
+            id="taxeditor-store.page1"
+            name="Taxon Realationship Type">
       </page>
       <page
       </page>
       <page
-            class="eu.etaxonomy.taxeditor.preference.DescriptionPreferences"
-            id="eu.etaxonomy.taxeditor.preferences.description"
-            name="Description">
+            category="eu.etaxonomy.taxeditor.preferences.taxonomic"
+            class="eu.etaxonomy.taxeditor.preference.SpecimenTypeDesignationStatusMenuPreferences"
+            id="eu.etaxonomy.taxeditor.preferences.specimenTypeDesignationStatus"
+            name="Specimen Type Designation Status">
       </page>
    </extension>
    <extension
       </page>
    </extension>
    <extension
index faade6401d6ac602c660606438f4ef38e095f8d9..47f485e5f9a7641b67d0f395684d72392fd47609 100644 (file)
@@ -134,18 +134,25 @@ public abstract class AbstractImportWizard<CONFIG extends IIoConfigurator> exten
         * @return
         */
        public boolean doImportInternal(final IImportConfigurator configurator){
         * @return
         */
        public boolean doImportInternal(final IImportConfigurator configurator){
-               importer = new CdmDefaultImport();
                
                
-               Job importJob = new Job("Import"){
-                       @Override
-                       protected IStatus run(IProgressMonitor monitor) {
-                               return importer.invoke(configurator) ? Status.OK_STATUS : Status.CANCEL_STATUS;
-                       }
-               };              
+               if(configurator == null){
+                       throw new IllegalArgumentException("Configuration may not be null");
+               }
                
                
-               importJob.schedule();
+               importer = new CdmDefaultImport();
+//             
+//             Job importJob = new Job("Import"){
+//                     @Override
+//                     protected IStatus run(IProgressMonitor monitor) {
+//                             return importer.invoke(configurator) ? Status.OK_STATUS : Status.CANCEL_STATUS;
+//                     }
+//             };              
+//             
+//             importJob.schedule();
                
                
-               return true;
+               importer.setCdmAppController(configurator.getCdmAppController());
+               
+               return importer.invoke(configurator);
        }
 
        /* (non-Javadoc)
        }
 
        /* (non-Javadoc)
index 7f5b3d025acd30070a1a0e19a181424dd9802c61..e18ab472f4d0e0094e33894f5a39389bedbaa4f0 100644 (file)
@@ -16,8 +16,10 @@ import org.eclipse.ui.IWorkbench;
 
 import eu.etaxonomy.cdm.database.ICdmDataSource;
 import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator;
 
 import eu.etaxonomy.cdm.database.ICdmDataSource;
 import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator;
+import eu.etaxonomy.cdm.io.common.Source;
 import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
 import eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceTypeSelectionWizardPage;
 import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
 import eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceTypeSelectionWizardPage;
+import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
  * @author n.hoffmann
 
 /**
  * @author n.hoffmann
@@ -54,11 +56,22 @@ public class BerlinModelImportWizard extends AbstractImportWizard<BerlinModelImp
                }
                
                // save the new dataSource to repository
                }
                
                // save the new dataSource to repository
-               CdmDataSourceRepository.getDefault().save(dataSourceName, dataSource);
+//             CdmDataSourceRepository.getDefault().save(dataSourceName, dataSource);
                
                
-               configurator.setDestination(dataSource);
+               Source source = new Source(Source.SQL_SERVER_2005, 
+                               dataSource.getServer(),
+                               dataSource.getDatabase(),
+                               dataSource.getPort());
+               source.setUserAndPwd(dataSource.getUsername(), dataSource.getPassword());
                
                
-               return doImportExternal(configurator);
+               
+               configurator.setSource(source);
+               
+               configurator.setDestination(CdmDataSourceRepository.getDefault().getCurrentDataSource());
+               
+               configurator.setCdmAppController(CdmStore.getApplicationController());
+               
+               return doImportInternal(configurator);
        }
 
        /* (non-Javadoc)
        }
 
        /* (non-Javadoc)
index 3a0ee0487d454160e1cd0a39c1f53428dad1fc69..7316eb654283e7bda7c8276d3c1a75273b8db199 100644 (file)
@@ -26,7 +26,9 @@ import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
 import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;\r
 import eu.etaxonomy.cdm.model.name.NonViralName;\r
 import eu.etaxonomy.cdm.model.name.Rank;\r
 import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;\r
 import eu.etaxonomy.cdm.model.name.NonViralName;\r
 import eu.etaxonomy.cdm.model.name.Rank;\r
+import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;\r
 import eu.etaxonomy.cdm.model.name.ZoologicalName;\r
 import eu.etaxonomy.cdm.model.name.ZoologicalName;\r
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;\r
 import eu.etaxonomy.taxeditor.model.Resources;\r
 import eu.etaxonomy.taxeditor.store.VocabularyStore;\r
 import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;\r
 import eu.etaxonomy.taxeditor.model.Resources;\r
 import eu.etaxonomy.taxeditor.store.VocabularyStore;\r
 import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;\r
@@ -149,6 +151,13 @@ public class PreferencesUtil {
                return preferredTerms;          \r
        }\r
        \r
                return preferredTerms;          \r
        }\r
        \r
+       \r
+       /** @return a <code>List</code> containing user preferred <code>Feature</code> terms */\r
+       public static List<SpecimenTypeDesignationStatus> getPreferredSpecimenTypeDesignationStatus() { return getPreferredTerms(VocabularyStore.getSpecimenTypeDesignationStatus());}\r
+       \r
+       /** @return a <code>List</code> containing user preferred <code>Feature</code> terms */\r
+       public static List<TaxonRelationshipType> getPreferredTaxonRelationshipTypes() { return getPreferredTerms(VocabularyStore.getTaxonRelationshipTypes());}\r
+       \r
        /** @return a <code>List</code> containing user preferred <code>Feature</code> terms */\r
        public static List<Feature> getPreferredFeatures() { return getPreferredTerms(VocabularyStore.getFeatures());}\r
 \r
        /** @return a <code>List</code> containing user preferred <code>Feature</code> terms */\r
        public static List<Feature> getPreferredFeatures() { return getPreferredTerms(VocabularyStore.getFeatures());}\r
 \r
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/SpecimenTypeDesignationStatusMenuPreferences.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/SpecimenTypeDesignationStatusMenuPreferences.java
new file mode 100644 (file)
index 0000000..737955e
--- /dev/null
@@ -0,0 +1,34 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.preference;
+
+import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
+import eu.etaxonomy.taxeditor.store.VocabularyStore;
+
+/**
+ * @author n.hoffmann
+ * @created 25.06.2009
+ * @version 1.0
+ */
+public class SpecimenTypeDesignationStatusMenuPreferences extends
+               AbstractMenuPreferences<SpecimenTypeDesignationStatus> {
+       /**
+        * @param initialVocabulary
+        * @param title
+        * @param description
+        */
+       public SpecimenTypeDesignationStatusMenuPreferences() {
+               super(VocabularyStore.getSpecimenTypeDesignationStatus(), 
+                               "Specimen Type Designation Status Preferences", 
+                               "Configure specimen type desigantion status");
+       }
+
+}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonRelationshipTypeMenuPreferences.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonRelationshipTypeMenuPreferences.java
new file mode 100644 (file)
index 0000000..6cc7adf
--- /dev/null
@@ -0,0 +1,35 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.preference;
+
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
+import eu.etaxonomy.taxeditor.store.VocabularyStore;
+
+/**
+ * @author n.hoffmann
+ * @created 25.06.2009
+ * @version 1.0
+ */
+public class TaxonRelationshipTypeMenuPreferences extends
+               AbstractMenuPreferences<TaxonRelationshipType> {
+
+       /**
+        * @param initialVocabulary
+        * @param title
+        * @param description
+        */
+       public TaxonRelationshipTypeMenuPreferences() {
+               super(VocabularyStore.getTaxonRelationshipTypes(), 
+                               "Taxon Relationship Type Preferences", 
+                               "Configure taxon relationship types");
+       }
+       
+}
index fd81cac2980fbb76d07dab5a2f3fd56555eb50fb..8baa4657f79d211e5d2b7e7066146ac53a814537 100644 (file)
@@ -13,8 +13,6 @@ package eu.etaxonomy.taxeditor.store;
 import java.util.Set;
 import java.util.SortedSet;
 
 import java.util.Set;
 import java.util.SortedSet;
 
-import org.apache.log4j.Logger;
-
 import eu.etaxonomy.cdm.api.application.CdmApplicationController;
 import eu.etaxonomy.cdm.api.service.ITermService;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.api.application.CdmApplicationController;
 import eu.etaxonomy.cdm.api.service.ITermService;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
@@ -42,8 +40,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
  * @version 1.0
  */
 public class VocabularyStore {
  * @version 1.0
  */
 public class VocabularyStore {
-       private static final Logger logger = Logger.getLogger(VocabularyStore.class);
-       
+
        /**
         * The singleton instance
         */
        /**
         * The singleton instance
         */
@@ -82,6 +79,8 @@ public class VocabularyStore {
        /**
         * 
         * @return
        /**
         * 
         * @return
+        * 
+        * @deprecated handle via preferences
         */
        public static SortedSet<TaxonRelationshipType> getConceptRelationshipTypes() {
                SortedSet<TaxonRelationshipType> conceptRelationshipTypes = getTaxonRelationshipTypes();
         */
        public static SortedSet<TaxonRelationshipType> getConceptRelationshipTypes() {
                SortedSet<TaxonRelationshipType> conceptRelationshipTypes = getTaxonRelationshipTypes();
index 101de028db52b88815ea2491c45d83ccafe0935e..6701db67ebecc2bc0c66f167b8368bd5ed4f451b 100644 (file)
@@ -69,7 +69,7 @@ public class CdmStoreTest /*extends CdmIntegrationTest */{
        @Ignore
        public void testGetConceptRelationshipTypes(){
                conversation.bind();
        @Ignore
        public void testGetConceptRelationshipTypes(){
                conversation.bind();
-               Set<TaxonRelationshipType> conceptRelationshipTypes = VocabularyStore.getConceptRelationshipTypes();
+               Set<TaxonRelationshipType> conceptRelationshipTypes = VocabularyStore.getTaxonRelationshipTypes();
                Assert.assertNotNull(conceptRelationshipTypes);
        }
 }
                Assert.assertNotNull(conceptRelationshipTypes);
        }
 }