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
			, BerlinModelTaxonRelationImport.class
143
			, BerlinModelAreaImport.class
144
			, BerlinModelOccurrenceImport.class
145
			, BerlinModelOccurrenceSourceImport.class
146
			, BerlinModelWebMarkerCategoryImport.class
147
			, BerlinModelWebMarkerImport.class
148
            , BerlinModelCommonNamesImport.class
149

    
150
		};
151
	}
152

    
153

    
154

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

    
163

    
164

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

    
174

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
286

    
287

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

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

    
302

    
303

    
304

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

    
312

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

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

    
328

    
329
	public boolean isDoCommonNames() {
330
		return doCommonNames;
331
	}
332

    
333

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

    
340
	}
341

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

    
349

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

    
357

    
358
	public boolean isDoMarker() {
359
		return doMarker;
360
	}
361

    
362
	public void setDoMarker(boolean doMarker) {
363
		this.doMarker = doMarker;
364
	}
365

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

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

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

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

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

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

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

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

    
422

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

    
433

    
434

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

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

    
455

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

    
469

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

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

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

    
491

    
492

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

    
500

    
501

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

    
509

    
510

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

    
518

    
519

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

    
527

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

    
535

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

    
543

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

    
551

    
552

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

    
565

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

    
573

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

    
581

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

    
589

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

    
597

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

    
605

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

    
613

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

    
620
	}
621

    
622

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

    
630

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

    
638

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

    
646

    
647
    public boolean isSalvador() {return isSalvador;}
648
    public void setSalvador(boolean isSalvador) {this.isSalvador = isSalvador;}
649

    
650
    public boolean isEuroMed() {return isEuroMed;}
651
    public void setEuroMed(boolean isEuroMed) {this.isEuroMed = isEuroMed;}
652

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

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

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

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

    
683
}
(7-7/22)