Project

General

Profile

« Previous | Next » 

Revision de8788bd

Added by Andreas Müller over 4 years ago

cleanup

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiSourceExport.java
355 355
		String result = "";
356 356

  
357 357
		try {
358
		if (reference != null) {
359
			Set<IdentifiableSource> sourcesAll = reference.getSources();
360
			Set<IdentifiableSource> sourceCandidates = filterOriginalPesiDbSources(sourcesAll);
361

  
362
			if (sourceCandidates.size() == 1) {
363
				Reference citation = sourceCandidates.iterator().next().getCitation();
364
				if (citation != null) {
365
					result = PesiTransformer.databaseString2Abbreviation(citation.getTitleCache()); //or just title
366
				} else {
367
					logger.warn("OriginalDB can not be determined because the citation of this source is NULL: " + sourceCandidates.iterator().next().getUuid());
368
				}
369
			} else if (sourceCandidates.size() > 1) {
370
				logger.warn("Taxon has multiple IdentifiableSources: " + reference.getUuid() + " (" + reference.getTitleCache() + ")");
371
				int count = 1;
372
				for (IdentifiableSource source : sourceCandidates) {
373
					Reference citation = source.getCitation();
374
					if (citation != null) {
375
						result += PesiTransformer.databaseString2Abbreviation(citation.getTitleCache());
376
						if (count < sourceCandidates.size()) {
377
							result += "; ";
378
						}
379
						count++;
380
					}
381
				}
382
			} else {
383
				result = null;
384
			}
385
		}
358
    		if (reference != null) {
359
    			Set<IdentifiableSource> sourcesAll = reference.getSources();
360
    			Set<IdentifiableSource> sourceCandidates = filterOriginalPesiDbSources(sourcesAll);
361

  
362
    			if (sourceCandidates.size() == 1) {
363
    				Reference citation = sourceCandidates.iterator().next().getCitation();
364
    				if (citation != null) {
365
    					result = PesiTransformer.databaseString2Abbreviation(citation.getTitleCache()); //or just title
366
    				} else {
367
    					logger.warn("OriginalDB can not be determined because the citation of this source is NULL: " + sourceCandidates.iterator().next().getUuid());
368
    				}
369
    			} else if (sourceCandidates.size() > 1) {
370
    				logger.warn("Taxon has multiple IdentifiableSources: " + reference.getUuid() + " (" + reference.getTitleCache() + ")");
371
    				int count = 1;
372
    				for (IdentifiableSource source : sourceCandidates) {
373
    					Reference citation = source.getCitation();
374
    					if (citation != null) {
375
    						result += PesiTransformer.databaseString2Abbreviation(citation.getTitleCache());
376
    						if (count < sourceCandidates.size()) {
377
    							result += "; ";
378
    						}
379
    						count++;
380
    					}
381
    				}
382
    			} else {
383
    				result = null;
384
    			}
385
    		}
386 386
		} catch (Exception e) {
387 387
			e.printStackTrace();
388 388
		}

Also available in: Unified diff