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.IImportConfigurator;
|
17
|
import eu.etaxonomy.cdm.io.common.Source;
|
18
|
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
|
19
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
20
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
21
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
22
|
|
23
|
|
24
|
/**
|
25
|
* @author a.mueller
|
26
|
* @since 20.03.2008
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public class IndexFungorumImportConfigurator extends DbImportConfiguratorBase<IndexFungorumImportState> implements IImportConfigurator{
|
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
|
protected void makeIoClassList(){
|
48
|
ioClassList = new Class[]{
|
49
|
IndexFungorumSupraGeneraImport.class
|
50
|
, IndexFungorumHigherClassificationImport.class
|
51
|
, IndexFungorumGeneraImport.class
|
52
|
, IndexFungorumSpeciesImport.class
|
53
|
, IndexFungorumSubSpeciesImport.class
|
54
|
, IndexFungorumDistributionImport.class
|
55
|
};
|
56
|
}
|
57
|
|
58
|
|
59
|
/* (non-Javadoc)
|
60
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
|
61
|
*/
|
62
|
public IndexFungorumImportState getNewState() {
|
63
|
return new IndexFungorumImportState(this);
|
64
|
}
|
65
|
|
66
|
|
67
|
|
68
|
/**
|
69
|
* @param berlinModelSource
|
70
|
* @param sourceReference
|
71
|
* @param destination
|
72
|
*/
|
73
|
private IndexFungorumImportConfigurator(Source source, ICdmDataSource destination) {
|
74
|
super(source, destination, NomenclaturalCode.ICNAFP, defaultTransformer);//default for IF
|
75
|
}
|
76
|
|
77
|
|
78
|
public Source getSource() {
|
79
|
return (Source)super.getSource();
|
80
|
}
|
81
|
public void setSource(Source berlinModelSource) {
|
82
|
super.setSource(berlinModelSource);
|
83
|
}
|
84
|
|
85
|
/* (non-Javadoc)
|
86
|
* @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#getSourceReference()
|
87
|
*/
|
88
|
public Reference getSourceReference() {
|
89
|
if (sourceReference == null){
|
90
|
sourceReference = ReferenceFactory.newDatabase();
|
91
|
if (getSource() != null){
|
92
|
sourceReference.setTitleCache(getSource().getDatabase(), true);
|
93
|
}
|
94
|
if (this.getSourceRefUuid() != null){
|
95
|
sourceReference.setUuid(this.getSourceRefUuid());
|
96
|
}
|
97
|
}
|
98
|
return sourceReference;
|
99
|
}
|
100
|
|
101
|
|
102
|
/* (non-Javadoc)
|
103
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
|
104
|
*/
|
105
|
public String getSourceNameString() {
|
106
|
if (this.getSource() == null){
|
107
|
return null;
|
108
|
}else{
|
109
|
return this.getSource().getDatabase();
|
110
|
}
|
111
|
}
|
112
|
|
113
|
|
114
|
|
115
|
/**
|
116
|
* @return the limitSave
|
117
|
*/
|
118
|
public int getRecordsPerTransaction() {
|
119
|
return recordsPerTransaction;
|
120
|
}
|
121
|
|
122
|
/**
|
123
|
* @param limitSave the limitSave to set
|
124
|
*/
|
125
|
public void setRecordsPerTransaction(int recordsPerTransaction) {
|
126
|
this.recordsPerTransaction = recordsPerTransaction;
|
127
|
}
|
128
|
|
129
|
|
130
|
|
131
|
public boolean isDoTaxa() {
|
132
|
return doTaxa;
|
133
|
}
|
134
|
public void setDoTaxa(boolean doTaxa) {
|
135
|
this.doTaxa = doTaxa;
|
136
|
}
|
137
|
|
138
|
|
139
|
public boolean isDoOccurrence() {
|
140
|
return doOccurrence;
|
141
|
}
|
142
|
|
143
|
|
144
|
public void setDoOccurrence(boolean doOccurrence) {
|
145
|
this.doOccurrence = doOccurrence;
|
146
|
}
|
147
|
|
148
|
|
149
|
public boolean isDoRelTaxa() {
|
150
|
return doRelTaxa;
|
151
|
}
|
152
|
|
153
|
|
154
|
public void setDoRelTaxa(boolean doRelTaxa) {
|
155
|
this.doRelTaxa = doRelTaxa;
|
156
|
}
|
157
|
|
158
|
|
159
|
|
160
|
|
161
|
}
|