new source SQLServer2008 added
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / tcsrdf / TcsRdfImportConfigurator.java
index 1f1bfa43f125a3157dcfbbe2541c6ab227fd599f..16a11beb1baa48c53dc63a051a79fd36dbbaa0cf 100644 (file)
@@ -21,29 +21,35 @@ import eu.etaxonomy.cdm.common.XmlHelp;
 import eu.etaxonomy.cdm.database.ICdmDataSource;\r
 import eu.etaxonomy.cdm.io.common.IImportConfigurator;\r
 import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;\r
-import eu.etaxonomy.cdm.model.reference.Database;\r
+import eu.etaxonomy.cdm.model.reference.IDatabase;\r
 import eu.etaxonomy.cdm.model.reference.ReferenceBase;\r
+import eu.etaxonomy.cdm.model.reference.ReferenceFactory;\r
 \r
 /**\r
  * @author a.mueller\r
  * @created 29.05.2008\r
  * @version 1.0\r
  */\r
-public class TcsRdfImportConfigurator extends ImportConfiguratorBase implements IImportConfigurator {\r
+public class TcsRdfImportConfigurator extends ImportConfiguratorBase<TcsRdfImportState> implements IImportConfigurator {\r
        private static final Logger logger = Logger.getLogger(TcsRdfImportConfigurator.class);\r
        \r
+       //if false references in this rdf file are not published in the bibliography list\r
+       private boolean isPublishReferences = true;\r
+       \r
        //rdfNamespace\r
-       Namespace rdfNamespace;\r
+       private Namespace rdfNamespace;\r
        //TaxonConcept namespace\r
-       Namespace tcNamespace;\r
+       private Namespace tcNamespace;\r
        //TaxonName namespace\r
-       Namespace tnNamespace;\r
+       private Namespace tnNamespace;\r
        //TDWG common namespace\r
-       Namespace commonNamespace;\r
+       private Namespace commonNamespace;\r
        //TDWG geoNamespace\r
-       Namespace geoNamespace;\r
+       private Namespace geoNamespace;\r
        //publicationNamespace\r
-       Namespace publicationNamespace;\r
+       private Namespace publicationNamespace;\r
+       //palmNamespace\r
+       private Namespace palmNamespace;\r
        \r
 //TODO \r
        protected static Namespace nsTcom = Namespace.getNamespace("http://rs.tdwg.org/ontology/voc/Common#");\r
@@ -55,11 +61,11 @@ public class TcsRdfImportConfigurator extends ImportConfiguratorBase implements
 \r
        protected void makeIoClassList(){\r
                ioClassList = new Class[]{\r
-                       TcsRdfReferenceIO.class\r
-                       , TcsRdfTaxonNameIO.class\r
-                       , TcsRdfTaxonNameRelationsIO.class\r
-                       , TcsRdfTaxonIO.class\r
-                       , TcsRdfTaxonRelationsIO.class\r
+                       TcsRdfReferenceImport.class\r
+                       , TcsRdfTaxonNameImport.class\r
+                       , TcsRdfTaxonNameRelationsImport.class\r
+                       , TcsRdfTaxonImport.class\r
+                       , TcsRdfTaxonRelationsImport.class\r
                };\r
        };\r
        \r
@@ -138,8 +144,13 @@ public class TcsRdfImportConfigurator extends ImportConfiguratorBase implements
                geoNamespace = root.getNamespace(prefix);\r
                prefix = "tpub";\r
                publicationNamespace = root.getNamespace(prefix);\r
+               \r
+               prefix = "tpalm";\r
+               palmNamespace = root.getNamespace(prefix);\r
+               \r
                if (rdfNamespace == null || tcNamespace == null || tnNamespace == null ||\r
-                               commonNamespace == null ||      geoNamespace == null || publicationNamespace == null){\r
+                               commonNamespace == null ||      geoNamespace == null || publicationNamespace == null \r
+                               || palmNamespace == null){\r
                        logger.warn("At least one Namespace is NULL");\r
                }\r
                return true;\r
@@ -154,7 +165,8 @@ public class TcsRdfImportConfigurator extends ImportConfiguratorBase implements
                //TODO\r
                if (this.sourceReference == null){\r
                        logger.warn("getSource Reference not yet fully implemented");\r
-                       sourceReference = Database.NewInstance();\r
+                       ReferenceFactory refFactory = ReferenceFactory.newInstance();\r
+                       sourceReference = refFactory.newDatabase();\r
                        sourceReference.setTitleCache("XXX");\r
                }\r
                return sourceReference;\r
@@ -219,6 +231,41 @@ public class TcsRdfImportConfigurator extends ImportConfiguratorBase implements
        public void setPublicationNamespace(Namespace publicationNamespace) {\r
                this.publicationNamespace = publicationNamespace;\r
        }\r
+       /**\r
+        * @return the palmNamespace\r
+        */\r
+       public Namespace getPalmNamespace() {\r
+               return palmNamespace;\r
+       }\r
+\r
+       /**\r
+        * @param palmNamespace the palmNamespace to set\r
+        */\r
+       public void setPalmNamespace(Namespace palmNamespace) {\r
+               this.palmNamespace = palmNamespace;\r
+       }\r
+\r
+       /**\r
+        * if false references in this rdf file are not published in the bibliography list\r
+        * @return the isPublishReferences\r
+        */\r
+       public boolean isPublishReferences() {\r
+               return isPublishReferences;\r
+       }\r
+\r
+       /**\r
+        * @param isPublishReferences the isPublishReferences to set\r
+        */\r
+       public void setPublishReferences(boolean isPublishReferences) {\r
+               this.isPublishReferences = isPublishReferences;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()\r
+        */\r
+       public TcsRdfImportState getNewState() {\r
+               return new TcsRdfImportState(this);\r
+       }\r
        \r
 \r
        \r