Project

General

Profile

Download (19.9 KB) Statistics
| Branch: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

    
10
package eu.etaxonomy.cdm.io.globis;
11

    
12
import java.sql.ResultSet;
13
import java.sql.SQLException;
14
import java.util.HashMap;
15
import java.util.HashSet;
16
import java.util.Map;
17
import java.util.Set;
18
import java.util.regex.Matcher;
19
import java.util.regex.Pattern;
20

    
21
import org.apache.commons.lang.StringUtils;
22
import org.apache.log4j.Logger;
23
import org.springframework.stereotype.Component;
24

    
25
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
26
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade.DerivedUnitType;
27
import eu.etaxonomy.cdm.common.CdmUtils;
28
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
29
import eu.etaxonomy.cdm.io.common.IOValidator;
30
import eu.etaxonomy.cdm.io.common.ResultSetPartitioner;
31
import eu.etaxonomy.cdm.io.common.mapping.IMappingImport;
32
import eu.etaxonomy.cdm.io.globis.validation.GlobisReferenceImportValidator;
33
import eu.etaxonomy.cdm.io.globis.validation.GlobisSpecTaxaImportValidator;
34
import eu.etaxonomy.cdm.model.common.CdmBase;
35
import eu.etaxonomy.cdm.model.common.Extension;
36
import eu.etaxonomy.cdm.model.common.Marker;
37
import eu.etaxonomy.cdm.model.common.MarkerType;
38
import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;
39
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
40
import eu.etaxonomy.cdm.model.name.Rank;
41
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
42
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
43
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationTest;
44
import eu.etaxonomy.cdm.model.name.ZoologicalName;
45
import eu.etaxonomy.cdm.model.occurrence.Collection;
46
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
47
import eu.etaxonomy.cdm.model.occurrence.DerivationEventType;
48
import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
49
import eu.etaxonomy.cdm.model.occurrence.FieldObservation;
50
import eu.etaxonomy.cdm.model.occurrence.Specimen;
51
import eu.etaxonomy.cdm.model.reference.Reference;
52
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
53
import eu.etaxonomy.cdm.model.reference.ReferenceType;
54
import eu.etaxonomy.cdm.model.taxon.Synonym;
55
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
56
import eu.etaxonomy.cdm.model.taxon.Taxon;
57
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
58
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
59

    
60

    
61
/**
62
 * @author a.mueller
63
 * @created 20.02.2010
64
 * @version 1.0
65
 */
66
@Component
67
public class GlobisSpecTaxImport  extends GlobisImportBase<Reference> implements IMappingImport<Reference, GlobisImportState>{
68
	private static final Logger logger = Logger.getLogger(GlobisSpecTaxImport.class);
69
	
70
	private int modCount = 10000;
71
	private static final String pluralString = "taxa";
72
	private static final String dbTableName = "specTax";
73
	private static final Class cdmTargetClass = Reference.class;
74

    
75
	public GlobisSpecTaxImport(){
76
		super(pluralString, dbTableName, cdmTargetClass);
77
	}
78

    
79

    
80
	
81
	
82
	/* (non-Javadoc)
83
	 * @see eu.etaxonomy.cdm.io.globis.GlobisImportBase#getIdQuery()
84
	 */
85
	@Override
86
	protected String getIdQuery() {
87
		String strRecordQuery = 
88
			" SELECT specTaxId " + 
89
			" FROM " + dbTableName; 
90
		return strRecordQuery;	
91
	}
92

    
93

    
94

    
95

    
96
	/* (non-Javadoc)
97
	 * @see eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportBase#getRecordQuery(eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator)
98
	 */
99
	@Override
100
	protected String getRecordQuery(GlobisImportConfigurator config) {
101
		String strRecordQuery = 
102
			" SELECT t.*, t.DateCreated as Created_When, t.CreatedBy as Created_Who," +
103
			"        t.ModifiedBy as Updated_who, t.DateModified as Updated_When, t.SpecRemarks as Notes " + 
104
			" FROM " + getTableName() + " t " +
105
			" WHERE ( t.specTaxId IN (" + ID_LIST_TOKEN + ") )";
106
		return strRecordQuery;
107
	}
108
	
109

    
110

    
111
	/* (non-Javadoc)
112
	 * @see eu.etaxonomy.cdm.io.globis.GlobisImportBase#doPartition(eu.etaxonomy.cdm.io.common.ResultSetPartitioner, eu.etaxonomy.cdm.io.globis.GlobisImportState)
113
	 */
114
	@Override
115
	public boolean doPartition(ResultSetPartitioner partitioner, GlobisImportState state) {
116
		boolean success = true;
117
		
118
		Set<TaxonBase> objectsToSave = new HashSet<TaxonBase>();
119
		
120
		Map<String, Taxon> taxonMap = (Map<String, Taxon>) partitioner.getObjectMap(TAXON_NAMESPACE);
121
		Map<String, Reference> referenceMap = (Map<String, Reference>) partitioner.getObjectMap(REFERENCE_NAMESPACE);
122
		
123
		ResultSet rs = partitioner.getResultSet();
124

    
125
		try {
126
			
127
			int i = 0;
128

    
129
			//for each reference
130
            while (rs.next()){
131
                
132
        		if ((i++ % modCount) == 0 && i!= 1 ){ logger.info(pluralString + " handled: " + (i-1));}
133
				
134
        		Integer specTaxId = rs.getInt("SpecTaxId");
135
        		Integer acceptedTaxonId = nullSafeInt(rs, "SpecCurrspecID");
136
        		String specSystaxRank = rs.getString("SpecSystaxRank");
137
        		
138
				try {
139
					
140
					//source ref
141
					Reference<?> sourceRef = state.getTransactionalSourceReference();
142
				
143
					Taxon acceptedTaxon =  taxonMap.get(String.valueOf(acceptedTaxonId));
144
					TaxonBase<?> thisTaxon = null;
145
					
146
					if (isBlank(specSystaxRank) ){
147
						//TODO
148
					}else if (specSystaxRank.equals("synonym")){
149
						Synonym synonym = getSynonym(state, rs);
150
						if (acceptedTaxon == null){
151
							//TODO
152
							logger.warn("Accepted taxon (" + acceptedTaxonId + ") not found for synonym "+ specTaxId);
153
						}else{
154
							acceptedTaxon.addSynonym(synonym, SynonymRelationshipType.SYNONYM_OF());
155
							thisTaxon = synonym;
156
						}
157
					}else if (specSystaxRank.equals("species")){
158
						validateAcceptedTaxon(acceptedTaxon, rs, specTaxId, acceptedTaxonId);
159
						thisTaxon = acceptedTaxon;
160
					}else{
161
						logger.warn(String.format("Unhandled specSystaxRank %s in specTaxId %d", specSystaxRank, specTaxId));
162
					}
163
					
164
					if (thisTaxon != null){
165
						ZoologicalName name = CdmBase.deproxy(thisTaxon.getName(), ZoologicalName.class);
166
						
167
						handleNomRef(state, referenceMap, rs, name);
168
					
169
						handleTypeInformation(state,rs, name, specTaxId);
170
					
171
					
172
//						this.doIdCreatedUpdatedNotes(state, ref, rs, refId, REFERENCE_NAMESPACE);
173
					
174
						objectsToSave.add(acceptedTaxon); 
175
					}
176
					
177

    
178
				} catch (Exception e) {
179
					logger.warn("Exception in specTax: SpecTaxId " + specTaxId + ". " + e.getMessage());
180
					e.printStackTrace();
181
				} 
182
                
183
            }
184
           
185
//            logger.warn("Specimen: " + countSpecimen + ", Descriptions: " + countDescriptions );
186

    
187
			logger.warn(pluralString + " to save: " + objectsToSave.size());
188
			getTaxonService().save(objectsToSave);	
189
			
190
			return success;
191
		} catch (Exception e) {
192
			logger.error("Exception: " +  e);
193
			return false;
194
		}
195
	}
196

    
197

    
198
	private Pattern patternAll = Pattern.compile("(.+,\\s.+)(\\(.+\\))");
199
	
200

    
201
	private void handleTypeInformation(GlobisImportState state, ResultSet rs, ZoologicalName name, Integer specTaxId) throws SQLException {
202
		
203
		String specTypeDepositoriesStr = rs.getString("SpecTypeDepository");
204
		String countryString = rs.getString("SpecTypeCountry");
205
		
206
		if (! hasTypeInformation(specTypeDepositoriesStr, countryString)){
207
			return;
208
		}
209
		
210
		FieldObservation fieldObservation = makeTypeFieldObservation(state, countryString);
211
		
212
		String[] specTypeDepositories; 
213
		if (isNotBlank(specTypeDepositoriesStr) ){
214
			specTypeDepositories = specTypeDepositoriesStr.split(";");
215
		}else{
216
			specTypeDepositories = new String[0];
217
		}
218
		//TODO different issues
219
		if (specTypeDepositories.length == 0){
220
			logger.warn("SpecTax has type information but no SpecTypeDepository. specTaxId: " + specTaxId);
221
		}
222
		for (String specTypeDepositoryStr : specTypeDepositories){
223
			specTypeDepositoryStr = specTypeDepositoryStr.trim();
224
			
225
			//Specimen
226
			Specimen specimen = makeSingleTypeSpecimen(fieldObservation);
227

    
228
			if (specTypeDepositoryStr.equals("??")){
229
				//unknown
230
				//TODO
231
				specimen.setTitleCache("??", true);
232
			}else{
233
				specTypeDepositoryStr = makeAdditionalSpecimenInformation( 
234
						specTypeDepositoryStr, specimen);
235
				
236
				makeCollection(specTypeDepositoryStr, specimen);
237
			}
238
			
239
			//type Designation
240
			makeTypeDesignation(name, rs, specimen);
241
		}
242

    
243
		
244
	}
245

    
246

    
247

    
248

    
249
	private boolean hasTypeInformation(String specTypeDepositoriesStr, String countryString) {
250
		boolean result = false;
251
		result |= isNotBlank(specTypeDepositoriesStr) || isNotBlank(countryString);
252
		return result;
253
	}
254

    
255

    
256

    
257
	/**
258
	 * @param specTypeDepositoryStr
259
	 * @param specimen
260
	 */
261
	protected void makeCollection(String specTypeDepositoryStr, Specimen specimen) {
262
		//TODO deduplicate
263
		Map<String, Collection> collectionMap = new HashMap<String, Collection>();
264
		
265
		
266
		//Collection
267
		String[] split = specTypeDepositoryStr.split(",");
268
		if (split.length != 2){
269
			if (split.length == 1 && split[0].startsWith("coll.")){
270
				Collection collection = Collection.NewInstance();
271
				collection.setName(split[0]);
272
			}else{
273
				logger.warn("Split size is not 2: " + specTypeDepositoryStr);
274
			}
275
			
276
		}else{
277
			String collectionStr = split[0];
278
			String location = split[1];
279
			
280
			
281
			Collection collection = collectionMap.get(collectionStr);
282
			if (collection == null){
283
				collection = Collection.NewInstance();
284
				collection.setCode(collectionStr);
285
				collection.setTownOrLocation(split[1]);
286
			}else if (CdmUtils.nullSafeEqual(location, collection.getTownOrLocation())){
287
				String message = "Location (%s) is not equal to location (%s) of existing collection";
288
				logger.warn(String.format(message, location, collection.getTownOrLocation(), collection.getCode()));
289
			}
290
			
291
			specimen.setCollection(collection);
292
			
293
		}
294
	}
295

    
296

    
297

    
298

    
299
	/**
300
	 * @param specTypeDepositoriesStr
301
	 * @param specTypeDepositoryStr
302
	 * @param specimen
303
	 * @return
304
	 */
305
	protected String makeAdditionalSpecimenInformation( String specTypeDepositoryStr,
306
			Specimen specimen) {
307
		//doubful
308
		if (specTypeDepositoryStr.endsWith("?")){
309
			Marker.NewInstance(specimen, true, MarkerType.IS_DOUBTFUL());
310
			specTypeDepositoryStr = specTypeDepositoryStr.substring(0, specTypeDepositoryStr.length() -1).trim();
311
		}
312
		
313
		//brackets
314
		Matcher matcher = patternAll.matcher(specTypeDepositoryStr);
315
		if (matcher.find()){
316
			//has brackets
317
			String brackets = matcher.group(2);
318
			brackets = brackets.substring(1, brackets.length()-1);
319
			
320
			brackets = brackets.replace("[mm]", "\u2642\u2642");
321
			brackets = brackets.replace("[m]", "\u2642");
322
			brackets = brackets.replace("[ff]", "\u2640\u2640");
323
			brackets = brackets.replace("[f]", "\u2640");
324
			
325
			if (brackets.contains("[") || brackets.contains("]")){
326
				logger.warn ("There are still '[', ']' in the bracket part: " + brackets);
327
			}
328
			
329
			//TODO replace mm/ff by Unicode male 
330
			specimen.setTitleCache(brackets, true);
331
			specTypeDepositoryStr = matcher.group(1).trim();
332
		}
333
		return specTypeDepositoryStr;
334
	}
335

    
336

    
337

    
338

    
339
	/**
340
	 * @param fieldObservation
341
	 * @return
342
	 */
343
	protected Specimen makeSingleTypeSpecimen(FieldObservation fieldObservation) {
344
		DerivationEvent derivEvent = DerivationEvent.NewInstance();
345
//			derivEvent.setType(DerivationEventType.ACCESSIONING());
346
		fieldObservation.addDerivationEvent(derivEvent);
347
		Specimen specimen = Specimen.NewInstance();
348
		specimen.setDerivedFrom(derivEvent);
349
		return specimen;
350
	}
351

    
352

    
353

    
354

    
355
	/**
356
	 * @param state
357
	 * @return
358
	 * @throws SQLException
359
	 */
360
	protected FieldObservation makeTypeFieldObservation(GlobisImportState state, 
361
			String countryString) throws SQLException {
362
		
363
		DerivedUnitType unitType = DerivedUnitType.Specimen;
364
		DerivedUnitFacade facade = DerivedUnitFacade.NewInstance(unitType);
365
		
366
		WaterbodyOrCountry typeCountry = getCountry(state, countryString);
367
		facade.setCountry(typeCountry);
368
		FieldObservation fieldObservation = facade.innerFieldObservation();
369
		return fieldObservation;
370
	}
371

    
372

    
373

    
374

    
375
	/**
376
	 * @param name
377
	 * @param rs 
378
	 * @param status
379
	 * @param specimen
380
	 * @throws SQLException 
381
	 */
382
	protected void makeTypeDesignation(ZoologicalName name, ResultSet rs, Specimen specimen) throws SQLException {
383
		//type
384
		String specType = rs.getString("SpecType");
385
		SpecimenTypeDesignationStatus status = getTypeDesigType(specType);
386

    
387
		SpecimenTypeDesignation typeDesignation = SpecimenTypeDesignation.NewInstance();
388
		typeDesignation.setTypeStatus(status);
389
		typeDesignation.setTypeSpecimen(specimen);
390
		
391
		name.addTypeDesignation(typeDesignation, true);
392
	}
393

    
394

    
395

    
396

    
397
	private SpecimenTypeDesignationStatus getTypeDesigType(String specType) {
398
		if (isBlank(specType) ){
399
			return null;
400
		}else if (specType.matches("Holotype(Holotypus)?")){
401
			return SpecimenTypeDesignationStatus.HOLOTYPE();
402
		}else if (specType.matches("Neotype")){
403
			return SpecimenTypeDesignationStatus.NEOTYPE();
404
		}else if (specType.matches("Syntype(\\(s\\))?")){
405
			return SpecimenTypeDesignationStatus.SYNTYPE();
406
		}else if (specType.matches("Lectotype")){
407
			return SpecimenTypeDesignationStatus.LECTOTYPE();
408
		}else{
409
			logger.warn("SpecimenTypeDesignationStatus does not match: " + specType);
410
			return null;
411
		}
412
	}
413

    
414

    
415

    
416

    
417
	/**
418
	 * @param state
419
	 * @param referenceMap
420
	 * @param rs
421
	 * @param name
422
	 * @return
423
	 * @throws SQLException
424
	 */
425
	private Reference<?> handleNomRef(GlobisImportState state, Map<String, Reference> referenceMap, ResultSet rs,
426
			ZoologicalName name) throws SQLException {
427
		//ref
428
		Integer refId = nullSafeInt(rs, "fiSpecRefID");
429
		Reference<?> nomRef = null;
430
		if (refId != null){
431
			nomRef = referenceMap.get(String.valueOf(refId));
432
			if (nomRef == null && state.getConfig().getDoReferences().equals(state.getConfig().getDoReferences().ALL)){
433
				logger.warn("Reference " + refId + " could not be found.");
434
			}else if (nomRef != null){
435
				name.setNomenclaturalReference(nomRef);
436
			}
437
		}
438
		
439
		//refDetail
440
		String refDetail = rs.getString("SpecPage");
441
		if (isNotBlank(refDetail)){
442
			name.setNomenclaturalMicroReference(refDetail);
443
		}
444
		return nomRef;
445
	}
446

    
447

    
448

    
449
	
450
	private void validateAcceptedTaxon(Taxon acceptedTaxon, ResultSet rs, Integer specTaxId, Integer acceptedTaxonId) throws SQLException {
451
		if (acceptedTaxon == null){
452
			logger.warn("Accepted taxon is null for taxon taxon to validate: ");
453
			return;
454
		}
455
		
456
		//TODO 
457
		ZoologicalName name = CdmBase.deproxy(acceptedTaxon.getName(), ZoologicalName.class);
458
		
459
		String specName = rs.getString("SpecName");
460
		if (! name.getSpecificEpithet().equals(specName)){
461
			logger.warn(String.format("Species epithet is not equal for accepted taxon: %s - %s", name.getSpecificEpithet(), specName));
462
		}
463
		//TODO
464
	}
465

    
466

    
467

    
468

    
469
	private Synonym getSynonym(GlobisImportState state, ResultSet rs) throws SQLException {
470
		//rank
471
		String rankStr = rs.getString("SpecRank");
472
		Rank rank = null;
473
		if (isNotBlank(rankStr)){
474
			try {
475
				rank = Rank.getRankByNameOrAbbreviation(rankStr, NomenclaturalCode.ICZN, true);
476
			} catch (UnknownCdmTypeException e) {
477
				e.printStackTrace();
478
			}
479
		}
480
		
481
		//name
482
		ZoologicalName name = ZoologicalName.NewInstance(rank);
483
		makeNamePartsAndCache(state, rs, rankStr, name);
484
		
485

    
486
//		name.setGenusOrUninomial(genusOrUninomial);
487
		String authorStr = rs.getString("SpecAuthor");
488
		String yearStr = rs.getString("SpecYear");
489
		String authorAndYearStr = CdmUtils.concat(", ", authorStr, yearStr);
490
		handleAuthorAndYear(authorAndYearStr, name);
491
				
492
		Synonym synonym = Synonym.NewInstance(name, state.getTransactionalSourceReference());
493
		
494
		return synonym;
495
	}
496

    
497

    
498

    
499

    
500
	private void makeNamePartsAndCache(GlobisImportState state, ResultSet rs, String rank, ZoologicalName name) throws SQLException {
501
		String citedFamily = rs.getString("SpecCitedFamily");
502
		String citedGenus = rs.getString("SpecCitedGenus");
503
		String citedSpecies = rs.getString("SpecCitedSpecies");
504
		String citedSubspecies = rs.getString("SpecCitedSubspecies");
505
		String lastEpithet = rs.getString("SpecName");
506
		
507
		
508
		String cache = CdmUtils.concat(" ", new String[]{citedFamily, citedGenus, citedSpecies, citedSubspecies, rank, lastEpithet});
509
		name.setGenusOrUninomial(citedGenus);
510
		//TODO sperate authors
511
		if (isBlank(citedSpecies)){
512
			name.setSpecificEpithet(lastEpithet);
513
		}else{
514
			name.setSpecificEpithet(citedSpecies);
515
			if (isBlank(citedSubspecies)){
516
				name.setInfraSpecificEpithet(lastEpithet);
517
			}
518
		}
519
		
520
		//TODO check if cache needs protection
521
		name.setNameCache(cache, true);
522
	}
523

    
524

    
525

    
526

    
527
	private boolean isInfraSpecies(GlobisImportState state, ResultSet rs, Rank rank) {
528
		// TODO Auto-generated method stub
529
		return false;
530
	}
531

    
532

    
533

    
534

    
535
	private Reference<?> getJournal(GlobisImportState state, ResultSet rs, String refJournal) throws SQLException {
536
		
537
		
538
		Reference<?> journal = ReferenceFactory.newJournal();
539
		String issn = rs.getString("RefISSN");
540
		if (StringUtils.isNotBlank(issn)){
541
			issn.replaceAll("ISSN", "").trim();
542
			journal.setIssn(issn);			
543
		}
544

    
545
		
546
		
547
		//TODO deduplicate
548
		journal.setTitle(refJournal);
549
		return journal;
550
	}
551

    
552

    
553

    
554

    
555
	/* (non-Javadoc)
556
	 * @see eu.etaxonomy.cdm.io.common.mapping.IMappingImport#createObject(java.sql.ResultSet, eu.etaxonomy.cdm.io.common.ImportStateBase)
557
	 */
558
	public Reference<?> createObject(ResultSet rs, GlobisImportState state)
559
			throws SQLException {
560
		Reference<?> ref;
561
		String refType = rs.getString("RefType");
562
		if (refType == null){
563
			ref = ReferenceFactory.newGeneric();
564
		}else if (refType == "book"){
565
			ref = ReferenceFactory.newBook();
566
		}else if (refType == "paper in journal"){
567
			ref = ReferenceFactory.newArticle();
568
		}else if (refType.startsWith("unpublished") ){
569
			ref = ReferenceFactory.newGeneric();
570
		}else if (refType.endsWith("paper in journal")){
571
			ref = ReferenceFactory.newArticle();
572
		}else if (refType == "paper in book"){
573
			ref = ReferenceFactory.newBookSection();
574
		}else if (refType == "paper in journalwebsite"){
575
			ref = ReferenceFactory.newArticle();
576
		}else{
577
			logger.warn("Unknown reference type: " + refType);
578
			ref = ReferenceFactory.newGeneric();
579
		}
580
		return ref;
581
	}
582

    
583
	/* (non-Javadoc)
584
	 * @see eu.etaxonomy.cdm.io.berlinModel.in.IPartitionedIO#getRelatedObjectsForPartition(java.sql.ResultSet)
585
	 */
586
	public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs) {
587
		String nameSpace;
588
		Class cdmClass;
589
		Set<String> idSet;
590
		Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<Object, Map<String, ? extends CdmBase>>();
591
		try{
592
			Set<String> taxonIdSet = new HashSet<String>();
593
			Set<String> referenceIdSet = new HashSet<String>();
594
			
595
			while (rs.next()){
596
				handleForeignKey(rs, taxonIdSet, "SpecCurrspecID");
597
				handleForeignKey(rs, referenceIdSet, "fiSpecRefID");
598
			}
599
			
600
			//taxon map
601
			nameSpace = TAXON_NAMESPACE;
602
			cdmClass = Taxon.class;
603
			idSet = taxonIdSet;
604
			Map<String, Taxon> objectMap = (Map<String, Taxon>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);
605
			result.put(nameSpace, objectMap);
606

    
607
			//reference map
608
			nameSpace = REFERENCE_NAMESPACE;
609
			cdmClass = Reference.class;
610
			idSet = referenceIdSet;
611
			Map<String, Reference> referenceMap = (Map<String, Reference>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);
612
			result.put(nameSpace, referenceMap);
613
			
614
			
615
		} catch (SQLException e) {
616
			throw new RuntimeException(e);
617
		}
618
		return result;
619
	}
620
	
621
	/* (non-Javadoc)
622
	 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#doCheck(eu.etaxonomy.cdm.io.common.IImportConfigurator)
623
	 */
624
	@Override
625
	protected boolean doCheck(GlobisImportState state){
626
		IOValidator<GlobisImportState> validator = new GlobisSpecTaxaImportValidator();
627
		return validator.validate(state);
628
	}
629
	
630
	
631
	/* (non-Javadoc)
632
	 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#isIgnore(eu.etaxonomy.cdm.io.common.IImportConfigurator)
633
	 */
634
	protected boolean isIgnore(GlobisImportState state){
635
		return ! state.getConfig().isDoSpecTaxa();
636
	}
637

    
638

    
639

    
640

    
641

    
642
}
(8-8/9)