Project

General

Profile

Download (17.5 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.berlinModel.in;
11

    
12
import java.io.File;
13
import java.lang.reflect.Method;
14
import java.net.MalformedURLException;
15
import java.net.URL;
16
import java.util.UUID;
17

    
18
import org.apache.log4j.Logger;
19

    
20
import eu.etaxonomy.cdm.database.ICdmDataSource;
21
import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelTaxonImport.PublishMarkerChooser;
22
import eu.etaxonomy.cdm.io.berlinModel.in.validation.BerlinModelGeneralImportValidator;
23
import eu.etaxonomy.cdm.io.common.DbImportConfiguratorBase;
24
import eu.etaxonomy.cdm.io.common.Source;
25
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
26
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
27

    
28
/**
29
 * @author a.mueller
30
 * @since 20.03.2008
31
 */
32
public class BerlinModelImportConfigurator extends DbImportConfiguratorBase<BerlinModelImportState>{
33
    private static final long serialVersionUID = 70300913255425256L;
34

    
35
    private static Logger logger = Logger.getLogger(BerlinModelImportConfigurator.class);
36

    
37
	public static BerlinModelImportConfigurator NewInstance(Source berlinModelSource, ICdmDataSource destination){
38
			return new BerlinModelImportConfigurator(berlinModelSource, destination);
39
	}
40

    
41
	private PublishMarkerChooser taxonPublishMarker = PublishMarkerChooser.ALL;
42

    
43
	//TODO
44
	private static IInputTransformer defaultTransformer = null;
45

    
46
	private boolean doNameStatus = true;
47
	private boolean doRelNames = true;
48
	private boolean doCommonNames = true;
49
	private boolean doOccurrence = true;
50
	private boolean doMarker = true;
51
	private boolean doUser = true;
52
	private boolean doFacts = true;
53
	private boolean doNameFacts = true;
54
	private boolean doAuthors = true;
55
	private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
56
	private boolean doTaxonNames = true;
57
	private boolean doTypes = true;
58

    
59
	private boolean isSalvador = false;
60
	private boolean isEuroMed = false;
61

    
62
	//taxa
63
	private boolean doTaxa = true;
64
	private boolean doRelTaxa = true;
65

    
66
	private boolean useSingleClassification = false;
67
	private boolean includeFlatClassifications = false;  //concepts with no taxon relationship (even no misapplied name or synonym rel)
68
	private boolean includeAllNonMisappliedRelatedClassifications = true;  //all concepts with any relationship except for misapplied name relationships
69
	private boolean useLastScrutinyAsSec = false;
70

    
71
	private boolean warnForDifferingSynonymReference = true;   //do not warn for E+M as it uses last scrutiny
72

    
73
	//occurrences
74
	private boolean isSplitTdwgCodes = true;
75

    
76
	private boolean useEmAreaVocabulary = false;
77

    
78
	private boolean includesEmCode = true;  // in Campanula we do not have an EMCOde
79
	private boolean allowInfraSpecTaxonRank = true;
80

    
81
	private Method namerelationshipTypeMethod;
82
	private Method uuidForDefTermMethod;
83
	private Method nameTypeDesignationStatusMethod;
84

    
85
	// NameFact stuff
86
	private URL mediaUrl;
87
	private File mediaPath;
88
	private int maximumNumberOfNameFacts;
89
	private boolean isIgnore0AuthorTeam = false;
90

    
91
	private boolean switchSpeciesGroup = false;
92

    
93
	//Term labels
94
	private String infrGenericRankAbbrev = null;
95
	private String infrSpecificRankAbbrev = null;
96

    
97
	private boolean removeHttpMapsAnchor = false;
98

    
99
	//Data Filter
100
	private String taxonTable = "PTaxon";
101
	private String classificationQuery = null;
102
	private String relTaxaIdQuery = null;
103
	private String nameIdTable = null;
104
	private String referenceIdTable = null;
105
	private String authorTeamFilter = null;
106
	private String authorFilter = null;
107
	private String factFilter = null;
108
	private String refDetailFilter = null;
109
	private String commonNameFilter = null;
110
	private String occurrenceFilter = null;
111
	private String occurrenceSourceFilter = null;
112
	private String webMarkerFilter = null;
113

    
114
	//specific functions
115
	private Method 	makeUrlForTaxon = null;
116

    
117
	private UUID featureTreeUuid;
118
	private String featureTreeTitle;
119

    
120
    private boolean isTaxonNoteAsFeature = false;
121

    
122

    
123
    public boolean isTaxonNoteAsFeature() {return isTaxonNoteAsFeature;}
124
    public void setTaxonNoteAsFeature(boolean isTaxonNoteAsFeature) {this.isTaxonNoteAsFeature = isTaxonNoteAsFeature;}
125

    
126
    @Override
127
    protected void makeIoClassList(){
128
		ioClassList = new Class[]{
129
				BerlinModelGeneralImportValidator.class
130
				, BerlinModelUserImport.class
131
				, BerlinModelAuthorImport.class
132
				, BerlinModelAuthorTeamImport.class
133
				, BerlinModelRefDetailImport.class
134
				, BerlinModelReferenceImport.class
135
				, BerlinModelTaxonNameImport.class
136
				, BerlinModelTaxonNameRelationImport.class
137
				, BerlinModelNameStatusImport.class
138
				, BerlinModelNameFactsImport.class
139
				, BerlinModelTypesImport.class
140
				, BerlinModelTaxonImport.class
141
				, BerlinModelFactsImport.class
142
				, BerlinModelCommonNamesImport.class
143
				, BerlinModelOccurrenceImport.class
144
				, BerlinModelOccurrenceSourceImport.class
145
				, BerlinModelWebMarkerCategoryImport.class
146
				, BerlinModelWebMarkerImport.class
147
				, BerlinModelTaxonRelationImport.class
148
		};
149
	}
150

    
151

    
152

    
153
	/* (non-Javadoc)
154
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
155
	 */
156
	@Override
157
    public BerlinModelImportState getNewState() {
158
		return new BerlinModelImportState(this);
159
	}
160

    
161

    
162

    
163
	/**
164
	 * @param berlinModelSource
165
	 * @param sourceReference
166
	 * @param destination
167
	 */
168
	protected BerlinModelImportConfigurator(Source berlinModelSource, ICdmDataSource destination) {
169
	   super(berlinModelSource, destination, NomenclaturalCode.ICNAFP, defaultTransformer); //default for Berlin Model
170
	}
171

    
172

    
173
	/**
174
	 * Import name relationships yes/no?.
175
	 * @return
176
	 */
177
	public boolean isDoRelNames() {
178
		return doRelNames;
179
	}
180
	public void setDoRelNames(boolean doRelNames) {
181
		this.doRelNames = doRelNames;
182
	}
183

    
184
	/**
185
	 * @return the mediaUrl
186
	 */
187
	public URL getMediaUrl() {
188
		return mediaUrl;
189
	}
190

    
191
	/**
192
	 * @param mediaUrl the mediaUrl to set
193
	 */
194
	public void setMediaUrl(URL mediaUrl) {
195
		this.mediaUrl = mediaUrl;
196
	}
197

    
198
	/**
199
	 * @return the mediaPath
200
	 */
201
	public File getMediaPath() {
202
		return mediaPath;
203
	}
204

    
205
	/**
206
	 * @param mediaPath the mediaPath to set
207
	 */
208
	public void setMediaPath(File mediaPath) {
209
		this.mediaPath = mediaPath;
210
	}
211

    
212
	public void setMediaPath(String mediaPathString){
213
		this.mediaPath = new File(mediaPathString);
214
	}
215

    
216
	public void setMediaUrl(String mediaUrlString) {
217
		try {
218
			this.mediaUrl = new URL(mediaUrlString);
219
		} catch (MalformedURLException e) {
220
			logger.error("Could not set mediaUrl because it was malformed: " + mediaUrlString);
221
		}
222
	}
223

    
224
	/**
225
	 * @return the maximumNumberOfNameFacts
226
	 */
227
	public int getMaximumNumberOfNameFacts() {
228
		return maximumNumberOfNameFacts;
229
	}
230

    
231
	/**
232
	 * set to 0 for unlimited
233
	 *
234
	 * @param maximumNumberOfNameFacts the maximumNumberOfNameFacts to set
235
	 */
236
	public void setMaximumNumberOfNameFacts(int maximumNumberOfNameFacts) {
237
		this.maximumNumberOfNameFacts = maximumNumberOfNameFacts;
238
	}
239

    
240
	/**
241
	 * If true, an authorTeam with authorTeamId = 0 is not imported (casus Salvador)
242
	 * @return the isIgnore0AuthorTeam
243
	 */
244
	public boolean isIgnore0AuthorTeam() {
245
		return isIgnore0AuthorTeam;
246
	}
247

    
248
	/**
249
	 * @param isIgnore0AuthorTeam the isIgnore0AuthorTeam to set
250
	 */
251
	public void setIgnore0AuthorTeam(boolean isIgnore0AuthorTeam) {
252
		this.isIgnore0AuthorTeam = isIgnore0AuthorTeam;
253
	}
254

    
255
	/**
256
	 * @return the namerelationshipTypeMethod
257
	 */
258
	public Method getNamerelationshipTypeMethod() {
259
		return namerelationshipTypeMethod;
260
	}
261

    
262
	/**
263
	 * @param namerelationshipTypeMethod the namerelationshipTypeMethod to set
264
	 */
265
	public void setNamerelationshipTypeMethod(Method namerelationshipTypeMethod) {
266
		this.namerelationshipTypeMethod = namerelationshipTypeMethod;
267
	}
268

    
269
	/**
270
	 * @return the taxonPublishMarker
271
	 */
272
	public BerlinModelTaxonImport.PublishMarkerChooser getTaxonPublishMarker() {
273
		return taxonPublishMarker;
274
	}
275

    
276
	/**
277
	 * @param taxonPublishMarker the taxonPublishMarker to set
278
	 */
279
	public void setTaxonPublishMarker(
280
			BerlinModelTaxonImport.PublishMarkerChooser taxonPublishMarker) {
281
		this.taxonPublishMarker = taxonPublishMarker;
282
	}
283

    
284

    
285

    
286
	/**
287
	 * @return the uuidForDefTermMethod
288
	 */
289
	public Method getUuidForDefTermMethod() {
290
		return uuidForDefTermMethod;
291
	}
292

    
293
	/**
294
	 * @param uuidForDefTermMethod the uuidForDefTermMethod to set
295
	 */
296
	public void setUuidForDefTermMethod(Method uuidForDefTermMethod) {
297
		this.uuidForDefTermMethod = uuidForDefTermMethod;
298
	}
299

    
300

    
301

    
302

    
303
	/**
304
	 * @return the nameTypeDesignationStatusMethod
305
	 */
306
	public Method getNameTypeDesignationStatusMethod() {
307
		return nameTypeDesignationStatusMethod;
308
	}
309

    
310

    
311
	/**
312
	 * @param nameTypeDesignationStatusMethod the nameTypeDesignationStatusMethod to set
313
	 */
314
	public void setNameTypeDesignationStatusMethod(
315
			Method nameTypeDesignationStatusMethod) {
316
		this.nameTypeDesignationStatusMethod = nameTypeDesignationStatusMethod;
317
	}
318

    
319
	public boolean isDoNameStatus() {
320
		return doNameStatus;
321
	}
322
	public void setDoNameStatus(boolean doNameStatus) {
323
		this.doNameStatus = doNameStatus;
324
	}
325

    
326

    
327
	public boolean isDoCommonNames() {
328
		return doCommonNames;
329
	}
330

    
331

    
332
	/**
333
	 * @param doCommonNames
334
	 */
335
	public void setDoCommonNames(boolean doCommonNames) {
336
		this.doCommonNames = doCommonNames;
337

    
338
	}
339

    
340
	public boolean isDoFacts() {
341
		return doFacts;
342
	}
343
	public void setDoFacts(boolean doFacts) {
344
		this.doFacts = doFacts;
345
	}
346

    
347

    
348
	public boolean isDoOccurrence() {
349
		return doOccurrence;
350
	}
351
	public void setDoOccurrence(boolean doOccurrence) {
352
		this.doOccurrence = doOccurrence;
353
	}
354

    
355

    
356
	public boolean isDoMarker() {
357
		return doMarker;
358
	}
359

    
360
	public void setDoMarker(boolean doMarker) {
361
		this.doMarker = doMarker;
362
	}
363

    
364
	public boolean isDoUser() {
365
		return doUser;
366
	}
367
	public void setDoUser(boolean doUser) {
368
		this.doUser = doUser;
369
	}
370

    
371
	public boolean isDoNameFacts() {
372
		return doNameFacts;
373
	}
374
	public void setDoNameFacts(boolean doNameFacts) {
375
		this.doNameFacts = doNameFacts;
376
	}
377

    
378
	public boolean isDoAuthors() {
379
		return doAuthors;
380
	}
381
	public void setDoAuthors(boolean doAuthors) {
382
		this.doAuthors = doAuthors;
383
	}
384

    
385
	public DO_REFERENCES getDoReferences() {
386
		return doReferences;
387
	}
388
	public void setDoReferences(DO_REFERENCES doReferences) {
389
		this.doReferences = doReferences;
390
	}
391

    
392
	public boolean isDoTaxonNames() {
393
		return doTaxonNames;
394
	}
395
	public void setDoTaxonNames(boolean doTaxonNames) {
396
		this.doTaxonNames = doTaxonNames;
397
	}
398

    
399
	public boolean isDoTypes() {
400
		return doTypes;
401
	}
402
	public void setDoTypes(boolean doTypes) {
403
		this.doTypes = doTypes;
404
	}
405

    
406
	public boolean isDoTaxa() {
407
		return doTaxa;
408
	}
409
	public void setDoTaxa(boolean doTaxa) {
410
		this.doTaxa = doTaxa;
411
	}
412

    
413
	public boolean isDoRelTaxa() {
414
		return doRelTaxa;
415
	}
416
	public void setDoRelTaxa(boolean doRelTaxa) {
417
		this.doRelTaxa = doRelTaxa;
418
	}
419

    
420

    
421
	public String getTaxonTable() {
422
		return this.taxonTable ;
423
	}
424
	/**
425
	 * @param taxonTable the taxonTable to set
426
	 */
427
	public void setTaxonTable(String taxonTable) {
428
		this.taxonTable = taxonTable;
429
	}
430

    
431

    
432

    
433
	public String getClassificationQuery() {
434
		return this.classificationQuery ;
435
	}
436
	/**
437
	 * @param classificationQuery the classificationQuery to set
438
	 */
439
	public void setClassificationQuery(String classificationQuery) {
440
		this.classificationQuery = classificationQuery;
441
	}
442

    
443
	/**
444
	 * @param relTaxaIdQuery the relTaxaIdQuery to set
445
	 */
446
	public void setRelTaxaIdQuery(String relTaxaIdQuery) {
447
		this.relTaxaIdQuery = relTaxaIdQuery;
448
	}
449
	public String getRelTaxaIdQuery() {
450
		return this.relTaxaIdQuery ;
451
	}
452

    
453

    
454
	/**
455
	 * @return the nameIdTable
456
	 */
457
	public String getNameIdTable() {
458
		return nameIdTable;
459
	}
460
	/**
461
	 * @param nameIdTable the nameIdTable to set
462
	 */
463
	public void setNameIdTable(String nameIdTable) {
464
		this.nameIdTable = nameIdTable;
465
	}
466

    
467

    
468
	public void setReferenceIdTable(String referenceIdTable) {
469
		this.referenceIdTable = referenceIdTable;
470
	}
471
	public String getReferenceIdTable() {
472
		return referenceIdTable;
473
	}
474

    
475
	public void setFactFilter(String factFilter) {
476
		this.factFilter = factFilter;
477
	}
478
	public String getFactFilter() {
479
		return factFilter;
480
	}
481

    
482
	public void setRefDetailFilter(String refDetailFilter) {
483
		this.refDetailFilter = refDetailFilter;
484
	}
485
	public String getRefDetailFilter() {
486
		return refDetailFilter;
487
	}
488

    
489

    
490

    
491
	public String getOccurrenceFilter() {
492
		return occurrenceFilter;
493
	}
494
	public void setOccurrenceFilter(String occurrenceFilter) {
495
		this.occurrenceFilter = occurrenceFilter;
496
	}
497

    
498

    
499

    
500
	public String getCommonNameFilter() {
501
		return commonNameFilter;
502
	}
503
	public void setCommonNameFilter(String commonNameFilter) {
504
		this.commonNameFilter = commonNameFilter;
505
	}
506

    
507

    
508

    
509
	public String getOccurrenceSourceFilter() {
510
		return occurrenceSourceFilter;
511
	}
512
	public void setOccurrenceSourceFilter(String occurrenceSourceFilter) {
513
		this.occurrenceSourceFilter = occurrenceSourceFilter;
514
	}
515

    
516

    
517

    
518
	public String getWebMarkerFilter() {
519
		return webMarkerFilter;
520
	}
521
	public void setWebMarkerFilter(String webMarkerFilter) {
522
		this.webMarkerFilter = webMarkerFilter;
523
	}
524

    
525

    
526
	public boolean isUseSingleClassification() {
527
		return useSingleClassification;
528
	}
529
	public void setUseSingleClassification(boolean useSingleClassification) {
530
		this.useSingleClassification = useSingleClassification;
531
	}
532

    
533

    
534
	public void setAuthorTeamFilter(String authorTeamFilter) {
535
		this.authorTeamFilter = authorTeamFilter;
536
	}
537
	public String getAuthorTeamFilter() {
538
		return authorTeamFilter;
539
	}
540

    
541

    
542
	public String getAuthorFilter() {
543
		return authorFilter;
544
	}
545
	public void setAuthorFilter(String authorFilter) {
546
		this.authorFilter = authorFilter;
547
	}
548

    
549

    
550

    
551
	public boolean isSwitchSpeciesGroup() {
552
		return switchSpeciesGroup;
553
	}
554
	/**
555
	 * If true, the rankId for speicesGroup is changed from 59 to 57 and
556
	 * 59 is used for coll. species instead
557
	 * @param switchSpeciesGroup
558
	 */
559
	public void setSwitchSpeciesGroup(boolean switchSpeciesGroup) {
560
		this.switchSpeciesGroup = switchSpeciesGroup;
561
	}
562

    
563

    
564
	public boolean isSplitTdwgCodes() {
565
		return isSplitTdwgCodes;
566
	}
567
	public void setSplitTdwgCodes(boolean isSplitTdwgCodes) {
568
		this.isSplitTdwgCodes = isSplitTdwgCodes;
569
	}
570

    
571

    
572
	public Method getMakeUrlForTaxon() {
573
		return makeUrlForTaxon;
574
	}
575
	public void setMakeUrlForTaxon(Method makeUrlForTaxon) {
576
		this.makeUrlForTaxon = makeUrlForTaxon;
577
	}
578

    
579

    
580
	public String getInfrGenericRankAbbrev() {
581
		return infrGenericRankAbbrev;
582
	}
583
	public void setInfrGenericRankAbbrev(String infrGenericRankAbbrev) {
584
		this.infrGenericRankAbbrev = infrGenericRankAbbrev;
585
	}
586

    
587

    
588
	public String getInfrSpecificRankAbbrev() {
589
		return infrSpecificRankAbbrev;
590
	}
591
	public void setInfrSpecificRankAbbrev(String infrSpecificRankAbbrev) {
592
		this.infrSpecificRankAbbrev = infrSpecificRankAbbrev;
593
	}
594

    
595

    
596
	public boolean isRemoveHttpMapsAnchor() {
597
		return removeHttpMapsAnchor;
598
	}
599
	public void setRemoveHttpMapsAnchor(boolean removeHttpMapsAnchor) {
600
		this.removeHttpMapsAnchor = removeHttpMapsAnchor;
601
	}
602

    
603

    
604
	public boolean isIncludeFlatClassifications() {
605
		return includeFlatClassifications;
606
	}
607
	public void setIncludeFlatClassifications(boolean includeFlatClassifications) {
608
		this.includeFlatClassifications = includeFlatClassifications;
609
	}
610

    
611

    
612
	public boolean isIncludesAreaEmCode() {
613
		return includesEmCode;
614
	}
615
	public void setIncludesEmCode(boolean includesEmCode) {
616
		this.includesEmCode = includesEmCode;
617

    
618
	}
619

    
620

    
621
	public boolean isAllowInfraSpecTaxonRank() {
622
		return allowInfraSpecTaxonRank ;
623
	}
624
	public void setAllowInfraSpecTaxonRank(boolean allowInfraSpecTaxonRank) {
625
		this.allowInfraSpecTaxonRank = allowInfraSpecTaxonRank;
626
	}
627

    
628

    
629
	public boolean isIncludeAllNonMisappliedRelatedClassifications() {
630
		return includeAllNonMisappliedRelatedClassifications;
631
	}
632
	public void setIncludeAllNonMisappliedRelatedClassifications(boolean includeAllNonMisappliedRelatedClassifications) {
633
		this.includeAllNonMisappliedRelatedClassifications = includeAllNonMisappliedRelatedClassifications;
634
	}
635

    
636

    
637
	public boolean isUseEmAreaVocabulary() {
638
		return useEmAreaVocabulary;
639
	}
640
	public void setUseEmAreaVocabulary(boolean useEmAreaVocabulary) {
641
		this.useEmAreaVocabulary = useEmAreaVocabulary;
642
	}
643

    
644

    
645
    public boolean isSalvador() {return isSalvador;}
646
    public void setSalvador(boolean isSalvador) {this.isSalvador = isSalvador;}
647

    
648
    public boolean isEuroMed() {return isEuroMed;}
649
    public void setEuroMed(boolean isEuroMed) {this.isEuroMed = isEuroMed;}
650

    
651
    public UUID getFeatureTreeUuid() {
652
        return featureTreeUuid;
653
    }
654
    public void setFeatureTreeUuid(UUID featureTreeUuid) {
655
        this.featureTreeUuid = featureTreeUuid;
656
    }
657

    
658
    @Override
659
    public String getFeatureTreeTitle() {
660
        return featureTreeTitle;
661
    }
662
    @Override
663
    public void setFeatureTreeTitle(String featureTreeTitle) {
664
        this.featureTreeTitle = featureTreeTitle;
665
    }
666

    
667
    public boolean isUseLastScrutinyAsSec() {
668
        return useLastScrutinyAsSec;
669
    }
670
    public void setUseLastScrutinyAsSec(boolean useLastScrutinyAsSec) {
671
        this.useLastScrutinyAsSec = useLastScrutinyAsSec;
672
    }
673

    
674
    public boolean isWarnForDifferingSynonymReference() {
675
        return warnForDifferingSynonymReference;
676
    }
677
    public void setWarnForDifferingSynonymReference(boolean warnForDifferingSynonymReference) {
678
        this.warnForDifferingSynonymReference = warnForDifferingSynonymReference;
679
    }
680

    
681
}
(6-6/21)