From: Andreas Müller Date: Thu, 23 Sep 2010 23:34:20 +0000 (+0000) Subject: Update for tcs import X-Git-Tag: 3.0.3~520 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/cdmlib.git/commitdiff_plain/5693f6f2bae923502a00c4580f23e13a018c18bc Update for tcs import --- diff --git a/app-import/src/main/java/eu/etaxonomy/cdm/app/tcs/TcsXmlTestActivator.java b/app-import/src/main/java/eu/etaxonomy/cdm/app/tcs/TcsXmlTestActivator.java index 717b944d7e..99dada8a18 100644 --- a/app-import/src/main/java/eu/etaxonomy/cdm/app/tcs/TcsXmlTestActivator.java +++ b/app-import/src/main/java/eu/etaxonomy/cdm/app/tcs/TcsXmlTestActivator.java @@ -39,9 +39,9 @@ public class TcsXmlTestActivator { //database validation status (create, update, validate ...) static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE; static final String tcsSource = TcsSources.tcsXml_cichorium(); - static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_andreasM(); +// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_andreasM(); // static final ICdmDataSource cdmDestination = CdmDestinations.localH2(); -// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_postgres_CdmTest(); + static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_postgres_CdmTest(); static final UUID treeUuid = UUID.fromString("00000000-0c97-48ac-8d33-6099ed68c625"); static final String sourceSecId = "TestTCS"; diff --git a/app-import/src/main/resources/tcs/Cichorium_tcs.xml b/app-import/src/main/resources/tcs/Cichorium_tcs.xml index c428c8bbbc..e1167b8036 100644 --- a/app-import/src/main/resources/tcs/Cichorium_tcs.xml +++ b/app-import/src/main/resources/tcs/Cichorium_tcs.xml @@ -18,78 +18,91 @@ Sp. Pl. + Sp. Pl. 1753 - Voyage Yemen + Voyage Yemen 1889 + Voyage Yemen 1889 in Schweinfurth, Beitr. Fl. Äthiop. + in Schweinfurth, Beitr. Fl. Äthiop. 1867 Consp. Fl. Graec. 2 + Consp. Fl. Graec. 2 1902 in Willdenowia 37 + in Willdenowia 37 2007 Observ. Bot. 4 + Observ. Bot. 4 1771 Syn. Gen. Compos. + Syn. Gen. Compos. 1832 Compos. Ind. + Compos. Ind. 1876 Prodr. Stirp. Chap. Allerton. + Prodr. Stirp. Chap. Allerton. 1796 in Lamarck & Candolle, Fl. Franç. ed. 3, 4 + in Lamarck & Candolle, Fl. Franç. ed. 3, 4 1805 Prodr. 7 + Prodr. 7 1838 Fl. Portug. 2 + Fl. Portug. 2 1825-1828 in Komarov, Fl. SSSR 29 + in Komarov, Fl. SSSR 29 1964 diff --git a/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/DefaultTcsXmlPlaceholders.java b/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/DefaultTcsXmlPlaceholders.java index 462ca2292a..72e33e88ab 100644 --- a/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/DefaultTcsXmlPlaceholders.java +++ b/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/DefaultTcsXmlPlaceholders.java @@ -54,17 +54,49 @@ public class DefaultTcsXmlPlaceholders implements ITcsXmlPlaceholderClass { } if (elPublicationDetailed == null){ return true; + }else{ + publication.setProtectedTitleCache(false); } - String childName = "DatePublished"; - boolean obligatory = false; - Namespace ns = config.getTcsXmlNamespace(); - Element elDatePublished = XmlHelp.getSingleChildElement(success, elPublicationDetailed, childName, ns, obligatory); - if (elDatePublished != null){ - String strDatePublished = elDatePublished.getTextNormalize(); - TimePeriod datePublished = TimePeriod.parseString(strDatePublished); - publication.setDatePublished(datePublished); + String childName; + Namespace tcsNs = config.getTcsXmlNamespace(); + for (Object o : elPublicationDetailed.getChildren()){ + Element element = (Element)o; + String value = element.getTextNormalize(); + + childName = "Title"; + if (element.getName().equalsIgnoreCase(childName) && element.getNamespace().equals(tcsNs)){ + publication.setTitle(value); + continue; + } + + childName = "DatePublished"; + if (element.getName().equalsIgnoreCase(childName) && element.getNamespace().equals(tcsNs)){ + TimePeriod datePublished = TimePeriod.parseString(value); + publication.setDatePublished(datePublished); + continue; + } + + logger.warn("Unhandled Publication Detailed child element: " + element.getName()); + } +// String childName = "Title"; +// boolean obligatory = false; +// Element elTitle = XmlHelp.getSingleChildElement(success, elPublicationDetailed, childName, ns, obligatory); +// if (elTitle != null){ +// String strTitle = elTitle.getTextNormalize(); +// publication.setTitle(strTitle); +// } + +// childName = "DatePublished"; +// obligatory = false; +// ns = config.getTcsXmlNamespace(); +// Element elDatePublished = XmlHelp.getSingleChildElement(success, elPublicationDetailed, childName, ns, obligatory); +// if (elDatePublished != null){ +// String strDatePublished = elDatePublished.getTextNormalize(); +// TimePeriod datePublished = TimePeriod.parseString(strDatePublished); +// publication.setDatePublished(datePublished); +// } //Do nothing //TODO implement EDIT TcsMetaData extension