From: Andreas Müller Date: Tue, 5 Oct 2010 20:37:57 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 3.0.3~468 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/cdmlib.git/commitdiff_plain/48c8204d5c34f6b930aa5dd15a01e93910f399a7 --- diff --git a/cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/ipni/IpniService.java b/cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/ipni/IpniService.java index fbbd960cbf..7f020c47a8 100644 --- a/cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/ipni/IpniService.java +++ b/cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/ipni/IpniService.java @@ -304,6 +304,13 @@ public class IpniService implements IIpniService{ } + /** + * @param line + * @param parameterMap + * @param appConfig + * @param config + * @return + */ private ReferenceBase getPublicationFromLine(String line, Map parameterMap, ICdmApplicationConfiguration appConfig, IpniServicePublicationConfigurator config) { //fill value map String[] splits = line.split("%"); @@ -330,30 +337,45 @@ public class IpniService implements IIpniService{ ref.setPlacePublished(valueMap.get(PLACE)); String author = valueMap.get(PUBLICATION_AUTHOR_TEAM); - Team team = Team.NewTitledInstance(author, author); - ref.setAuthorTeam(team); + if (StringUtils.isNotBlank(author)){ + Team team = Team.NewTitledInstance(author, author); + ref.setAuthorTeam(team); + } //remarks String remarks = valueMap.get(REMARKS); Annotation annotation = Annotation.NewInstance(remarks, AnnotationType.EDITORIAL(), Language.ENGLISH()); ref.addAnnotation(annotation); + + String tl2AuthorString = valueMap.get(TL2_AUTHOR); + if (ref.getAuthorTeam() == null){ + Team tl2Author = Team.NewTitledInstance(tl2AuthorString, null); + ref.setAuthorTeam(tl2Author); + }else{ + //TODO parse name, + ref.getAuthorTeam().setTitleCache(tl2AuthorString, true); + ref.addAnnotation(Annotation.NewInstance(tl2AuthorString, AnnotationType.EDITORIAL(), Language.ENGLISH())); + } + + //dates TimePeriod date = TimePeriod.parseString(valueMap.get(DATE)); ref.setDatePublished(date); + //source ReferenceBase citation = getIpniCitation(appConfig); ref.addSource(valueMap.get(ID), "Publication", citation, valueMap.get(VERSION)); + /* TODO BPH number Authors role In publication facade LC number Preceded by - TL2 author TL2 number TDWG abbreviation */ diff --git a/cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/ipni/IpniServiceTest.java b/cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/ipni/IpniServiceTest.java index eb0c570135..811e87b5e8 100644 --- a/cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/ipni/IpniServiceTest.java +++ b/cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/ipni/IpniServiceTest.java @@ -155,10 +155,21 @@ public class IpniServiceTest { //20009158-1%1.2%Pinaceae%%N%Abies%%N%alba%apennina%subsp.%Brullo, Scelsi & Spamp.%%Brullo, Scelsi & Spamp.%Abies alba subsp. apennina%Vegetaz. Aspromonte%41 (2001)%2001%%%%%%Italy%tax. nov. Assert.assertEquals("There should be exactly 1 result for 'Species Plantarum, Edition 3'", 1, refList.size()); - ReferenceBase name = refList.get(0); + ReferenceBase ref = refList.get(0); //title cache - Assert.assertEquals("Title Cache for Abies albertiana should be 'Species Plantarum, Edition 3'", "Species Plantarum, Edition 3. 1764", name.getTitleCache()); + //the author title may be improved in future + Assert.assertEquals("Title Cache should be 'Linnaeus, Carl, Species Plantarum, Edition 3'", "Linnaeus, Carl, Species Plantarum, Edition 3. 1764", ref.getTitleCache()); + + refList = service1.getPublications("Flora of Macar", null, services, config); + Assert.assertNotNull("Empty resultset should not throw exception and should not be null", refList); + + refList = service1.getPublications("Flora Europaea [ed. 2]", null, services, config); + Assert.assertEquals("There should be exactly 1 result for 'Flora Europaea [ed. 2]'", 1, refList.size()); + ref = refList.get(0); + Assert.assertEquals("", "Tutin, Thomas Gaskell", ref.getAuthorTeam().getTitleCache()); + + // for (ReferenceBase ref : refList){ // System.out.println(ref.getTitleCache()); // }