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.pesi.indexFungorum;
|
11
|
|
12
|
import org.apache.log4j.Logger;
|
13
|
|
14
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
15
|
import eu.etaxonomy.cdm.io.common.DbImportConfiguratorBase;
|
16
|
import eu.etaxonomy.cdm.io.common.Source;
|
17
|
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
|
18
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
19
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
20
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
21
|
|
22
|
/**
|
23
|
* @author a.mueller
|
24
|
* @since 20.03.2008
|
25
|
*/
|
26
|
public class IndexFungorumImportConfigurator
|
27
|
extends DbImportConfiguratorBase<IndexFungorumImportState> {
|
28
|
|
29
|
private static final long serialVersionUID = -6354012088315750673L;
|
30
|
@SuppressWarnings("unused")
|
31
|
private static Logger logger = Logger.getLogger(IndexFungorumImportConfigurator.class);
|
32
|
|
33
|
public static IndexFungorumImportConfigurator NewInstance(Source source, ICdmDataSource destination){
|
34
|
return new IndexFungorumImportConfigurator(source, destination);
|
35
|
}
|
36
|
|
37
|
/* Max number of records to be saved with one service call */
|
38
|
private int recordsPerTransaction = 1000; //defaultValue
|
39
|
|
40
|
private boolean doOccurrence = true;
|
41
|
private boolean doTaxa = true;
|
42
|
private boolean doRelTaxa = true;
|
43
|
|
44
|
|
45
|
private static IInputTransformer defaultTransformer = new IndexFungorumTransformer();
|
46
|
|
47
|
@SuppressWarnings("unchecked")
|
48
|
@Override
|
49
|
protected void makeIoClassList(){
|
50
|
ioClassList = new Class[]{
|
51
|
IndexFungorumSupraGeneraImport.class
|
52
|
, IndexFungorumHigherClassificationImport.class
|
53
|
, IndexFungorumGeneraImport.class
|
54
|
, IndexFungorumSpeciesImport.class
|
55
|
, IndexFungorumSubSpeciesImport.class
|
56
|
, IndexFungorumDistributionImport.class
|
57
|
};
|
58
|
}
|
59
|
|
60
|
@SuppressWarnings("unchecked")
|
61
|
@Override
|
62
|
public IndexFungorumImportState getNewState() {
|
63
|
return new IndexFungorumImportState(this);
|
64
|
}
|
65
|
|
66
|
private IndexFungorumImportConfigurator(Source source, ICdmDataSource destination) {
|
67
|
super(source, destination, NomenclaturalCode.ICNAFP, defaultTransformer);//default for IF
|
68
|
}
|
69
|
|
70
|
@Override
|
71
|
public Source getSource() {
|
72
|
return super.getSource();
|
73
|
}
|
74
|
@Override
|
75
|
public void setSource(Source berlinModelSource) {
|
76
|
super.setSource(berlinModelSource);
|
77
|
}
|
78
|
|
79
|
@Override
|
80
|
public Reference getSourceReference() {
|
81
|
if (sourceReference == null){
|
82
|
sourceReference = ReferenceFactory.newDatabase();
|
83
|
if (getSource() != null){
|
84
|
sourceReference.setTitleCache(getSource().getDatabase(), true);
|
85
|
}
|
86
|
if (this.getSourceRefUuid() != null){
|
87
|
sourceReference.setUuid(this.getSourceRefUuid());
|
88
|
}
|
89
|
}
|
90
|
return sourceReference;
|
91
|
}
|
92
|
|
93
|
@Override
|
94
|
public String getSourceNameString() {
|
95
|
if (this.getSource() == null){
|
96
|
return null;
|
97
|
}else{
|
98
|
return this.getSource().getDatabase();
|
99
|
}
|
100
|
}
|
101
|
|
102
|
@Override
|
103
|
public int getRecordsPerTransaction() {
|
104
|
return recordsPerTransaction;
|
105
|
}
|
106
|
@Override
|
107
|
public void setRecordsPerTransaction(int recordsPerTransaction) {
|
108
|
this.recordsPerTransaction = recordsPerTransaction;
|
109
|
}
|
110
|
|
111
|
public boolean isDoTaxa() {
|
112
|
return doTaxa;
|
113
|
}
|
114
|
public void setDoTaxa(boolean doTaxa) {
|
115
|
this.doTaxa = doTaxa;
|
116
|
}
|
117
|
|
118
|
public boolean isDoOccurrence() {
|
119
|
return doOccurrence;
|
120
|
}
|
121
|
public void setDoOccurrence(boolean doOccurrence) {
|
122
|
this.doOccurrence = doOccurrence;
|
123
|
}
|
124
|
|
125
|
public boolean isDoRelTaxa() {
|
126
|
return doRelTaxa;
|
127
|
}
|
128
|
public void setDoRelTaxa(boolean doRelTaxa) {
|
129
|
this.doRelTaxa = doRelTaxa;
|
130
|
}
|
131
|
}
|