Project

General

Profile

Download (16.8 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

    
70
	//occurrences
71
	private boolean isSplitTdwgCodes = true;
72

    
73
	private boolean useEmAreaVocabulary = false;
74

    
75
	private boolean includesEmCode = true;  // in Campanula we do not have an EMCOde
76
	private boolean allowInfraSpecTaxonRank = true;
77

    
78
	private Method namerelationshipTypeMethod;
79
	private Method uuidForDefTermMethod;
80
	private Method nameTypeDesignationStatusMethod;
81

    
82
	// NameFact stuff
83
	private URL mediaUrl;
84
	private File mediaPath;
85
	private int maximumNumberOfNameFacts;
86
	private boolean isIgnore0AuthorTeam = false;
87

    
88
	private boolean switchSpeciesGroup = false;
89

    
90
	//Term labels
91
	private String infrGenericRankAbbrev = null;
92
	private String infrSpecificRankAbbrev = null;
93

    
94
	private boolean removeHttpMapsAnchor = false;
95

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

    
111
	//specific functions
112
	private Method 	makeUrlForTaxon = null;
113

    
114
	private UUID featureTreeUuid;
115
	private String featureTreeTitle;
116

    
117
    private boolean isTaxonNoteAsFeature = false;
118

    
119

    
120
    public boolean isTaxonNoteAsFeature() {return isTaxonNoteAsFeature;}
121
    public void setTaxonNoteAsFeature(boolean isTaxonNoteAsFeature) {this.isTaxonNoteAsFeature = isTaxonNoteAsFeature;}
122

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

    
148

    
149

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

    
158

    
159

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

    
169

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

    
181
	/**
182
	 * @return the mediaUrl
183
	 */
184
	public URL getMediaUrl() {
185
		return mediaUrl;
186
	}
187

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

    
195
	/**
196
	 * @return the mediaPath
197
	 */
198
	public File getMediaPath() {
199
		return mediaPath;
200
	}
201

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

    
209
	public void setMediaPath(String mediaPathString){
210
		this.mediaPath = new File(mediaPathString);
211
	}
212

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

    
221
	/**
222
	 * @return the maximumNumberOfNameFacts
223
	 */
224
	public int getMaximumNumberOfNameFacts() {
225
		return maximumNumberOfNameFacts;
226
	}
227

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

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

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

    
252
	/**
253
	 * @return the namerelationshipTypeMethod
254
	 */
255
	public Method getNamerelationshipTypeMethod() {
256
		return namerelationshipTypeMethod;
257
	}
258

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

    
266
	/**
267
	 * @return the taxonPublishMarker
268
	 */
269
	public BerlinModelTaxonImport.PublishMarkerChooser getTaxonPublishMarker() {
270
		return taxonPublishMarker;
271
	}
272

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

    
281

    
282

    
283
	/**
284
	 * @return the uuidForDefTermMethod
285
	 */
286
	public Method getUuidForDefTermMethod() {
287
		return uuidForDefTermMethod;
288
	}
289

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

    
297

    
298

    
299

    
300
	/**
301
	 * @return the nameTypeDesignationStatusMethod
302
	 */
303
	public Method getNameTypeDesignationStatusMethod() {
304
		return nameTypeDesignationStatusMethod;
305
	}
306

    
307

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

    
316
	public boolean isDoNameStatus() {
317
		return doNameStatus;
318
	}
319
	public void setDoNameStatus(boolean doNameStatus) {
320
		this.doNameStatus = doNameStatus;
321
	}
322

    
323

    
324
	public boolean isDoCommonNames() {
325
		return doCommonNames;
326
	}
327

    
328

    
329
	/**
330
	 * @param doCommonNames
331
	 */
332
	public void setDoCommonNames(boolean doCommonNames) {
333
		this.doCommonNames = doCommonNames;
334

    
335
	}
336

    
337
	public boolean isDoFacts() {
338
		return doFacts;
339
	}
340
	public void setDoFacts(boolean doFacts) {
341
		this.doFacts = doFacts;
342
	}
343

    
344

    
345
	public boolean isDoOccurrence() {
346
		return doOccurrence;
347
	}
348
	public void setDoOccurrence(boolean doOccurrence) {
349
		this.doOccurrence = doOccurrence;
350
	}
351

    
352

    
353
	public boolean isDoMarker() {
354
		return doMarker;
355
	}
356

    
357
	public void setDoMarker(boolean doMarker) {
358
		this.doMarker = doMarker;
359
	}
360

    
361
	public boolean isDoUser() {
362
		return doUser;
363
	}
364
	public void setDoUser(boolean doUser) {
365
		this.doUser = doUser;
366
	}
367

    
368
	public boolean isDoNameFacts() {
369
		return doNameFacts;
370
	}
371
	public void setDoNameFacts(boolean doNameFacts) {
372
		this.doNameFacts = doNameFacts;
373
	}
374

    
375
	public boolean isDoAuthors() {
376
		return doAuthors;
377
	}
378
	public void setDoAuthors(boolean doAuthors) {
379
		this.doAuthors = doAuthors;
380
	}
381

    
382
	public DO_REFERENCES getDoReferences() {
383
		return doReferences;
384
	}
385
	public void setDoReferences(DO_REFERENCES doReferences) {
386
		this.doReferences = doReferences;
387
	}
388

    
389
	public boolean isDoTaxonNames() {
390
		return doTaxonNames;
391
	}
392
	public void setDoTaxonNames(boolean doTaxonNames) {
393
		this.doTaxonNames = doTaxonNames;
394
	}
395

    
396
	public boolean isDoTypes() {
397
		return doTypes;
398
	}
399
	public void setDoTypes(boolean doTypes) {
400
		this.doTypes = doTypes;
401
	}
402

    
403
	public boolean isDoTaxa() {
404
		return doTaxa;
405
	}
406
	public void setDoTaxa(boolean doTaxa) {
407
		this.doTaxa = doTaxa;
408
	}
409

    
410
	public boolean isDoRelTaxa() {
411
		return doRelTaxa;
412
	}
413
	public void setDoRelTaxa(boolean doRelTaxa) {
414
		this.doRelTaxa = doRelTaxa;
415
	}
416

    
417

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

    
428

    
429

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

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

    
450

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

    
464

    
465
	public void setReferenceIdTable(String referenceIdTable) {
466
		this.referenceIdTable = referenceIdTable;
467
	}
468
	public String getReferenceIdTable() {
469
		return referenceIdTable;
470
	}
471

    
472
	public void setFactFilter(String factFilter) {
473
		this.factFilter = factFilter;
474
	}
475
	public String getFactFilter() {
476
		return factFilter;
477
	}
478

    
479
	public void setRefDetailFilter(String refDetailFilter) {
480
		this.refDetailFilter = refDetailFilter;
481
	}
482
	public String getRefDetailFilter() {
483
		return refDetailFilter;
484
	}
485

    
486

    
487

    
488
	public String getOccurrenceFilter() {
489
		return occurrenceFilter;
490
	}
491
	public void setOccurrenceFilter(String occurrenceFilter) {
492
		this.occurrenceFilter = occurrenceFilter;
493
	}
494

    
495

    
496

    
497
	public String getCommonNameFilter() {
498
		return commonNameFilter;
499
	}
500
	public void setCommonNameFilter(String commonNameFilter) {
501
		this.commonNameFilter = commonNameFilter;
502
	}
503

    
504

    
505

    
506
	public String getOccurrenceSourceFilter() {
507
		return occurrenceSourceFilter;
508
	}
509
	public void setOccurrenceSourceFilter(String occurrenceSourceFilter) {
510
		this.occurrenceSourceFilter = occurrenceSourceFilter;
511
	}
512

    
513

    
514

    
515
	public String getWebMarkerFilter() {
516
		return webMarkerFilter;
517
	}
518
	public void setWebMarkerFilter(String webMarkerFilter) {
519
		this.webMarkerFilter = webMarkerFilter;
520
	}
521

    
522

    
523
	public boolean isUseSingleClassification() {
524
		return useSingleClassification;
525
	}
526
	public void setUseSingleClassification(boolean useSingleClassification) {
527
		this.useSingleClassification = useSingleClassification;
528
	}
529

    
530

    
531
	public void setAuthorTeamFilter(String authorTeamFilter) {
532
		this.authorTeamFilter = authorTeamFilter;
533
	}
534
	public String getAuthorTeamFilter() {
535
		return authorTeamFilter;
536
	}
537

    
538

    
539
	public String getAuthorFilter() {
540
		return authorFilter;
541
	}
542
	public void setAuthorFilter(String authorFilter) {
543
		this.authorFilter = authorFilter;
544
	}
545

    
546

    
547

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

    
560

    
561
	public boolean isSplitTdwgCodes() {
562
		return isSplitTdwgCodes;
563
	}
564
	public void setSplitTdwgCodes(boolean isSplitTdwgCodes) {
565
		this.isSplitTdwgCodes = isSplitTdwgCodes;
566
	}
567

    
568

    
569
	public Method getMakeUrlForTaxon() {
570
		return makeUrlForTaxon;
571
	}
572
	public void setMakeUrlForTaxon(Method makeUrlForTaxon) {
573
		this.makeUrlForTaxon = makeUrlForTaxon;
574
	}
575

    
576

    
577
	public String getInfrGenericRankAbbrev() {
578
		return infrGenericRankAbbrev;
579
	}
580
	public void setInfrGenericRankAbbrev(String infrGenericRankAbbrev) {
581
		this.infrGenericRankAbbrev = infrGenericRankAbbrev;
582
	}
583

    
584

    
585
	public String getInfrSpecificRankAbbrev() {
586
		return infrSpecificRankAbbrev;
587
	}
588
	public void setInfrSpecificRankAbbrev(String infrSpecificRankAbbrev) {
589
		this.infrSpecificRankAbbrev = infrSpecificRankAbbrev;
590
	}
591

    
592

    
593
	public boolean isRemoveHttpMapsAnchor() {
594
		return removeHttpMapsAnchor;
595
	}
596
	public void setRemoveHttpMapsAnchor(boolean removeHttpMapsAnchor) {
597
		this.removeHttpMapsAnchor = removeHttpMapsAnchor;
598
	}
599

    
600

    
601
	public boolean isIncludeFlatClassifications() {
602
		return includeFlatClassifications;
603
	}
604
	public void setIncludeFlatClassifications(boolean includeFlatClassifications) {
605
		this.includeFlatClassifications = includeFlatClassifications;
606
	}
607

    
608

    
609
	public boolean isIncludesAreaEmCode() {
610
		return includesEmCode;
611
	}
612
	public void setIncludesEmCode(boolean includesEmCode) {
613
		this.includesEmCode = includesEmCode;
614

    
615
	}
616

    
617

    
618
	public boolean isAllowInfraSpecTaxonRank() {
619
		return allowInfraSpecTaxonRank ;
620
	}
621
	public void setAllowInfraSpecTaxonRank(boolean allowInfraSpecTaxonRank) {
622
		this.allowInfraSpecTaxonRank = allowInfraSpecTaxonRank;
623
	}
624

    
625

    
626
	public boolean isIncludeAllNonMisappliedRelatedClassifications() {
627
		return includeAllNonMisappliedRelatedClassifications;
628
	}
629
	public void setIncludeAllNonMisappliedRelatedClassifications(boolean includeAllNonMisappliedRelatedClassifications) {
630
		this.includeAllNonMisappliedRelatedClassifications = includeAllNonMisappliedRelatedClassifications;
631
	}
632

    
633

    
634
	public boolean isUseEmAreaVocabulary() {
635
		return useEmAreaVocabulary;
636
	}
637
	public void setUseEmAreaVocabulary(boolean useEmAreaVocabulary) {
638
		this.useEmAreaVocabulary = useEmAreaVocabulary;
639
	}
640

    
641

    
642
    public boolean isSalvador() {return isSalvador;}
643
    public void setSalvador(boolean isSalvador) {this.isSalvador = isSalvador;}
644

    
645
    public boolean isEuroMed() {return isEuroMed;}
646
    public void setEuroMed(boolean isEuroMed) {this.isEuroMed = isEuroMed;}
647

    
648
    public UUID getFeatureTreeUuid() {
649
        return featureTreeUuid;
650
    }
651
    public void setFeatureTreeUuid(UUID featureTreeUuid) {
652
        this.featureTreeUuid = featureTreeUuid;
653
    }
654

    
655
    @Override
656
    public String getFeatureTreeTitle() {
657
        return featureTreeTitle;
658
    }
659
    @Override
660
    public void setFeatureTreeTitle(String featureTreeTitle) {
661
        this.featureTreeTitle = featureTreeTitle;
662
    }
663

    
664

    
665

    
666

    
667
}
(6-6/21)