Project

General

Profile

« Previous | Next » 

Revision 01146fd8

Added by Andreas Müller over 3 years ago

cleanup

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/cyprus/CyprusExcelImport.java
6 6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
 * See LICENSE.TXT at the top of this package for the full license terms.
8 8
 */
9

  
10 9
package eu.etaxonomy.cdm.io.cyprus;
11 10

  
12 11
import java.util.Arrays;
......
49 48
 * @author a.babadshanjan
50 49
 * @since 08.01.2009
51 50
 */
52

  
53 51
@Component
54 52
public class CyprusExcelImport
55 53
        extends ExcelImportBase<CyprusImportState, CyprusImportConfigurator, ExcelRowBase> {
......
58 56

  
59 57
    private static final Logger logger = Logger.getLogger(CyprusExcelImport.class);
60 58

  
61
	public static Set<String> validMarkers = new HashSet<String>(Arrays.asList(new String[]{"", "valid", "accepted", "a", "v", "t"}));
62
	public static Set<String> synonymMarkers = new HashSet<String>(Arrays.asList(new String[]{"", "invalid", "synonym", "s", "i"}));
59
	public static Set<String> validMarkers = new HashSet<>(Arrays.asList(new String[]{"", "valid", "accepted", "a", "v", "t"}));
60
	public static Set<String> synonymMarkers = new HashSet<>(Arrays.asList(new String[]{"", "invalid", "synonym", "s", "i"}));
63 61

  
64 62

  
65 63
	@Override
......
67 65
		return ! state.getConfig().isDoTaxa();
68 66
	}
69 67

  
70

  
71
	/* (non-Javadoc)
72
	 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#doCheck(eu.etaxonomy.cdm.io.common.IoStateBase)
73
	 */
74 68
	@Override
75 69
	protected boolean doCheck(CyprusImportState state) {
76 70
		logger.warn("DoCheck not yet implemented for CyprusExcelImport");
......
91 85
	protected static final String RED_DATA_BOOK_CATEGORY_COLUMN = "red data book category";
92 86
	protected static final String SYSTEMATICS_COLUMN = "systematics";
93 87

  
94

  
95

  
96 88
	// TODO: This enum is for future use (perhaps).
97 89
	protected enum Columns {
98 90
//		Id("Id"),
......
122 114
		}
123 115
	}
124 116

  
125

  
126 117
	@Override
127 118
    protected void analyzeRecord(Map<String, String> record, CyprusImportState state) {
128 119

  
......
154 145
    			continue;
155 146
    		}
156 147

  
157

  
158 148
    		if (key.equalsIgnoreCase(SPECIES_COLUMN)) {
159 149
//    			int ivalue = floatString2IntValue(value);
160 150
    			cyprusRow.setSpecies(value);
......
231 221
				getTermService().save(endemism);
232 222

  
233 223
				//status
234

  
235 224
				UUID indigenousUuid = transformer.getPresenceTermUuid("IN");
236 225
				indigenous = this.getPresenceTerm(state, indigenousUuid, "indigenous", "Indigenous", "IN", false);
237 226
				getTermService().save(indigenous);
......
243 232
				cultivatedDoubtful = this.getPresenceTerm(state, cultivatedDoubtfulUuid, "cultivated?", "Cultivated?", "CU?", false);
244 233
				getTermService().save(cultivatedDoubtful);
245 234

  
246

  
247 235
				UUID casualUuid = transformer.getPresenceTermUuid("CA");
248 236
				casual = this.getPresenceTerm(state, casualUuid, "casual", "Casual", "CA", false);
249 237
				getTermService().save(casual);
......
251 239
				casualDoubtful = this.getPresenceTerm(state, casualDoubtfulUuid, "casual?", "Casual?", "CA?", false);
252 240
				getTermService().save(casualDoubtful);
253 241

  
254

  
255 242
				UUID nonInvasiveUuid = transformer.getPresenceTermUuid("NN");
256 243
				nonInvasive = this.getPresenceTerm(state, nonInvasiveUuid, "naturalized  non-invasive", "Naturalized  non-invasive", "NN", false);
257 244
				getTermService().save(nonInvasive);
......
349 336
		return;
350 337
    }
351 338

  
352

  
353 339
	private void makeHigherTaxa(CyprusImportState state, CyprusRow taxonLight, Taxon speciesTaxon, Reference citation, String microCitation) {
354 340
		String divisionStr = taxonLight.getDivision();
355 341
		String genusStr = taxonLight.getGenus();
......
434 420
		}
435 421
	}
436 422

  
437

  
438 423
	private void makeStatus(String statusString, Taxon mainTaxon) {
439 424
		//status
440 425
		if (StringUtils.isNotBlank(statusString)){
......
483 468
		}
484 469
	}
485 470

  
486

  
487 471
	private void makeRedBookCategory(String redBookCategory, Taxon mainTaxon) {
488 472
		//red data book category
489 473
		if (StringUtils.isNotBlank(redBookCategory)){
......
494 478
		}
495 479
	}
496 480

  
497

  
498

  
499

  
500 481
	/**
501 482
	 *  Stores parent-child, synonym and common name relationships
502 483
	 */
......
506 487
		return;
507 488
	}
508 489

  
509

  
510

  
511
	/**
512
	 * @param state
513
	 * @param rank
514
	 * @param taxonNameStr
515
	 * @param authorStr
516
	 * @param nameStatus
517
	 * @param nc
518
	 * @return
519
	 */
520 490
	private TaxonBase<?> createTaxon(CyprusImportState state, Rank rank, String taxonNameStr,
521 491
			Class<?> statusClass, NomenclaturalCode nc) {
522 492
		TaxonBase<?> taxonBase;
......
530 500
			taxonNameBase = parser.parseFullName(taxonNameStr, nc, rank);
531 501

  
532 502
			//taxonNameBase.setNameCache(taxonNameStr);
533

  
534 503
		}
535 504

  
536 505
		//Create the taxon
......
565 534
		}
566 535
		return success;
567 536
	}
568

  
569

  
570

  
571 537
}

Also available in: Unified diff