Project

General

Profile

« Previous | Next » 

Revision 48c8204d

Added by Andreas Müller almost 14 years ago

View differences:

cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/ipni/IpniService.java
304 304
	}
305 305

  
306 306

  
307
	/**
308
	 * @param line
309
	 * @param parameterMap
310
	 * @param appConfig
311
	 * @param config
312
	 * @return
313
	 */
307 314
	private ReferenceBase getPublicationFromLine(String line, Map<Integer, String> parameterMap, ICdmApplicationConfiguration appConfig, IpniServicePublicationConfigurator config) {
308 315
		//fill value map
309 316
		String[] splits = line.split("%");
......
330 337
		ref.setPlacePublished(valueMap.get(PLACE));
331 338

  
332 339
		String author = valueMap.get(PUBLICATION_AUTHOR_TEAM);
333
		Team team = Team.NewTitledInstance(author, author);
334
		ref.setAuthorTeam(team);
340
		if (StringUtils.isNotBlank(author)){
341
			Team team = Team.NewTitledInstance(author, author);
342
			ref.setAuthorTeam(team);
343
		}
335 344
		
336 345
		//remarks
337 346
		String remarks = valueMap.get(REMARKS);
338 347
		Annotation annotation = Annotation.NewInstance(remarks, AnnotationType.EDITORIAL(), Language.ENGLISH());
339 348
		ref.addAnnotation(annotation);
340 349

  
350

  
351
		String tl2AuthorString = valueMap.get(TL2_AUTHOR);
352
		if (ref.getAuthorTeam() == null){
353
			Team tl2Author = Team.NewTitledInstance(tl2AuthorString, null);
354
			ref.setAuthorTeam(tl2Author);
355
		}else{
356
			//TODO parse name, 
357
			ref.getAuthorTeam().setTitleCache(tl2AuthorString, true);
358
			ref.addAnnotation(Annotation.NewInstance(tl2AuthorString, AnnotationType.EDITORIAL(), Language.ENGLISH()));
359
		}
360

  
361
		
341 362
		//dates
342 363
		TimePeriod date = TimePeriod.parseString(valueMap.get(DATE));
343 364
		ref.setDatePublished(date);
344 365

  
366

  
345 367
		//source
346 368
		ReferenceBase citation = getIpniCitation(appConfig);
347 369
		ref.addSource(valueMap.get(ID), "Publication", citation, valueMap.get(VERSION));
348 370

  
349 371
		
372
		
350 373
/*		TODO
351 374
		BPH number
352 375
		Authors role
353 376
		In publication facade
354 377
		LC number
355 378
		Preceded by
356
		TL2 author
357 379
		TL2 number
358 380
		TDWG abbreviation
359 381
	*/
cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/ipni/IpniServiceTest.java
155 155
		//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.
156 156

  
157 157
		Assert.assertEquals("There should be exactly 1 result for 'Species Plantarum, Edition 3'", 1, refList.size());
158
		ReferenceBase name = refList.get(0);
158
		ReferenceBase ref = refList.get(0);
159 159
		//title cache
160
		Assert.assertEquals("Title Cache for Abies albertiana should be 'Species Plantarum, Edition 3'", "Species Plantarum, Edition 3. 1764", name.getTitleCache());
160
		//the author title may be improved in future
161
		Assert.assertEquals("Title Cache should be 'Linnaeus, Carl, Species Plantarum, Edition 3'", "Linnaeus, Carl, Species Plantarum, Edition 3. 1764", ref.getTitleCache());
161 162

  
163
		
164
		refList = service1.getPublications("Flora of Macar", null, services, config);
165
		Assert.assertNotNull("Empty resultset should not throw exception and should not be null", refList);
166
			
167
		refList = service1.getPublications("Flora Europaea [ed. 2]", null, services, config);
168
		Assert.assertEquals("There should be exactly 1 result for 'Flora Europaea [ed. 2]'", 1, refList.size());
169
		ref = refList.get(0);
170
		Assert.assertEquals("", "Tutin, Thomas Gaskell", ref.getAuthorTeam().getTitleCache());
171
		
172
		
162 173
//		for (ReferenceBase ref : refList){
163 174
//			System.out.println(ref.getTitleCache());
164 175
//		}

Also available in: Unified diff