Project

General

Profile

Download (16.6 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
 * @created 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

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

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

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

    
72
	private boolean useEmAreaVocabulary = false;
73

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

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

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

    
87
	private boolean switchSpeciesGroup = false;
88

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

    
93
	private boolean removeHttpMapsAnchor = false;
94

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

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

    
113
	private UUID featureTreeUuid;
114
	private String featureTreeTitle;
115

    
116
    private boolean isTaxonNoteAsFeature = false;
117

    
118

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

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

    
147

    
148

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

    
157

    
158

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

    
168

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
280

    
281

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

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

    
296

    
297

    
298

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

    
306

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

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

    
322

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

    
327

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

    
334
	}
335

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

    
343

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

    
351

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

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

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

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

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

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

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

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

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

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

    
416

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

    
427

    
428

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

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

    
449

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

    
463

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

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

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

    
485

    
486

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

    
494

    
495

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

    
503

    
504

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

    
512

    
513

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

    
521

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

    
529

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

    
537

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

    
545

    
546

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

    
559

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

    
567

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

    
575

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

    
583

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

    
591

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

    
599

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

    
607

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

    
614
	}
615

    
616

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

    
624

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

    
632

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

    
640

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

    
644
    public UUID getFeatureTreeUuid() {
645
        return featureTreeUuid;
646
    }
647
    public void setFeatureTreeUuid(UUID featureTreeUuid) {
648
        this.featureTreeUuid = featureTreeUuid;
649
    }
650

    
651
    public String getFeatureTreeTitle() {
652
        return featureTreeTitle;
653
    }
654
    public void setFeatureTreeTitle(String featureTreeTitle) {
655
        this.featureTreeTitle = featureTreeTitle;
656
    }
657

    
658

    
659

    
660

    
661
}
(6-6/21)