1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2009 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.cdm.io.pesi.out;
|
11
|
|
12
|
import org.apache.log4j.Logger;
|
13
|
|
14
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
15
|
import eu.etaxonomy.cdm.io.common.DbExportConfiguratorBase;
|
16
|
import eu.etaxonomy.cdm.io.common.IExportConfigurator;
|
17
|
import eu.etaxonomy.cdm.io.common.Source;
|
18
|
import eu.etaxonomy.cdm.io.common.mapping.out.IExportTransformer;
|
19
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
20
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
21
|
|
22
|
/**
|
23
|
* @author e.-m.lee
|
24
|
* @date 12.02.2010
|
25
|
*
|
26
|
*/
|
27
|
public class PesiExportConfigurator extends DbExportConfiguratorBase<PesiExportState> implements IExportConfigurator<PesiExportState> {
|
28
|
@SuppressWarnings("unused")
|
29
|
private static Logger logger = Logger.getLogger(PesiExportConfigurator.class);
|
30
|
private int limitSave = 2000;
|
31
|
|
32
|
private Reference<?> auctReference;
|
33
|
|
34
|
|
35
|
private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
|
36
|
private boolean doTaxa = true;
|
37
|
private boolean doRelTaxa = true;
|
38
|
private boolean doNotes = true;
|
39
|
private boolean doNoteSources = true;
|
40
|
private boolean doAdditionalTaxonSource = true;
|
41
|
private boolean doOccurrence = true;
|
42
|
private boolean doOccurrenceSource = true;
|
43
|
private boolean doImages = true;
|
44
|
private boolean doTreeIndex = true;
|
45
|
private boolean doInferredSynonyms = true;
|
46
|
private boolean doRank = true;
|
47
|
private boolean doPureNames = true;
|
48
|
private boolean doDescription = true;
|
49
|
|
50
|
private int nameIdStart = 10000000;
|
51
|
|
52
|
public static PesiExportConfigurator NewInstance(Source pesiDestination, ICdmDataSource source, IExportTransformer transformer) {
|
53
|
return new PesiExportConfigurator(pesiDestination, source, transformer);
|
54
|
}
|
55
|
|
56
|
@SuppressWarnings("unchecked")
|
57
|
protected void makeIoClassList() {
|
58
|
ioClassList = new Class[]{
|
59
|
PesiSourceExport.class,
|
60
|
PesiTaxonExport.class,
|
61
|
PesiRelTaxonExport.class, // RelTaxonId's could be deleted from state hashmap
|
62
|
PesiDescriptionExport.class,
|
63
|
// PesiNoteExport.class,
|
64
|
// PesiNoteSourceExport.class, // NoteId's could be deleted from state hashmap
|
65
|
// PesiAdditionalTaxonSourceExport.class,
|
66
|
// PesiOccurrenceExport.class,
|
67
|
// PesiOccurrenceSourceExport.class,
|
68
|
// PesiImageExport.class,
|
69
|
};
|
70
|
|
71
|
}
|
72
|
|
73
|
/**
|
74
|
* @param pesiSource
|
75
|
* @param cdmSource
|
76
|
* @param transformer
|
77
|
*/
|
78
|
private PesiExportConfigurator(Source pesiSource, ICdmDataSource cdmSource, IExportTransformer transformer) {
|
79
|
super(transformer);
|
80
|
setSource(cdmSource);
|
81
|
setDestination(pesiSource);
|
82
|
}
|
83
|
|
84
|
/* (non-Javadoc)
|
85
|
* @see eu.etaxonomy.cdm.io.common.IExportConfigurator#getNewState()
|
86
|
*/
|
87
|
public PesiExportState getNewState() {
|
88
|
return new PesiExportState(this);
|
89
|
}
|
90
|
|
91
|
/**
|
92
|
* @return the limitSave
|
93
|
*/
|
94
|
public int getLimitSave() {
|
95
|
return limitSave;
|
96
|
}
|
97
|
|
98
|
/**
|
99
|
* @param limitSave the limitSave to set
|
100
|
*/
|
101
|
public void setLimitSave(int limitSave) {
|
102
|
this.limitSave = limitSave;
|
103
|
}
|
104
|
|
105
|
/**
|
106
|
* Returns the Reference for a Misapplied Name.
|
107
|
* Copied from FaunaEuropaeaImportConfigurator.
|
108
|
* @return
|
109
|
*/
|
110
|
public Reference<?> getAuctReference() {
|
111
|
if (auctReference == null){
|
112
|
auctReference = ReferenceFactory.newGeneric();
|
113
|
|
114
|
auctReference.setTitleCache("auct.", true);
|
115
|
}
|
116
|
return auctReference;
|
117
|
}
|
118
|
|
119
|
public boolean isDoOccurrence() {
|
120
|
return doOccurrence;
|
121
|
}
|
122
|
public void setDoOccurrence(boolean doOccurrence) {
|
123
|
this.doOccurrence = doOccurrence;
|
124
|
}
|
125
|
|
126
|
|
127
|
public boolean isDoImages() {
|
128
|
return doImages;
|
129
|
}
|
130
|
public void setDoImages(boolean doImages) {
|
131
|
this.doImages = doImages;
|
132
|
}
|
133
|
|
134
|
|
135
|
|
136
|
public DO_REFERENCES getDoReferences() {
|
137
|
return doReferences;
|
138
|
}
|
139
|
public void setDoReferences(DO_REFERENCES doReferences) {
|
140
|
this.doReferences = doReferences;
|
141
|
}
|
142
|
|
143
|
public boolean isDoTaxa() {
|
144
|
return doTaxa;
|
145
|
}
|
146
|
public void setDoTaxa(boolean doTaxa) {
|
147
|
this.doTaxa = doTaxa;
|
148
|
}
|
149
|
|
150
|
public boolean isDoRelTaxa() {
|
151
|
return doRelTaxa;
|
152
|
}
|
153
|
public void setDoRelTaxa(boolean doRelTaxa) {
|
154
|
this.doRelTaxa = doRelTaxa;
|
155
|
}
|
156
|
|
157
|
/**
|
158
|
* Number that is added to the cdm id in case a name is stored by its own id
|
159
|
* not the taxons id.
|
160
|
* @return
|
161
|
*/
|
162
|
public int getNameIdStart() {
|
163
|
return nameIdStart;
|
164
|
}
|
165
|
|
166
|
public void setNameIdStart(int nameIdStart) {
|
167
|
this.nameIdStart = nameIdStart;
|
168
|
}
|
169
|
|
170
|
public boolean isDoNotes() {
|
171
|
return doNotes;
|
172
|
}
|
173
|
|
174
|
public void setDoNotes(boolean doNotes) {
|
175
|
this.doNotes = doNotes;
|
176
|
}
|
177
|
|
178
|
public boolean isDoNoteSources() {
|
179
|
return doNoteSources;
|
180
|
}
|
181
|
|
182
|
public void setDoNoteSources(boolean doNoteSources) {
|
183
|
this.doNoteSources = doNoteSources;
|
184
|
}
|
185
|
|
186
|
public boolean isDoAdditionalTaxonSource() {
|
187
|
return doAdditionalTaxonSource;
|
188
|
}
|
189
|
|
190
|
public void setDoAdditionalTaxonSource(boolean doAdditionalTaxonSource) {
|
191
|
this.doAdditionalTaxonSource = doAdditionalTaxonSource;
|
192
|
}
|
193
|
|
194
|
public boolean isDoOccurrenceSource() {
|
195
|
return doOccurrenceSource;
|
196
|
}
|
197
|
|
198
|
public void setDoOccurrenceSource(boolean doOccurrenceSource) {
|
199
|
this.doOccurrenceSource = doOccurrenceSource;
|
200
|
}
|
201
|
|
202
|
public boolean isDoTreeIndex() {
|
203
|
return this.doTreeIndex;
|
204
|
}
|
205
|
|
206
|
public void setDoTreeIndex(boolean doTreeIndex) {
|
207
|
this.doTreeIndex = doTreeIndex;
|
208
|
}
|
209
|
|
210
|
public boolean isDoInferredSynonyms() {
|
211
|
return doInferredSynonyms;
|
212
|
}
|
213
|
|
214
|
public void setDoInferredSynonyms(boolean doInferredSynonyms) {
|
215
|
this.doInferredSynonyms = doInferredSynonyms;
|
216
|
}
|
217
|
|
218
|
public boolean isDoRank() {
|
219
|
return doRank;
|
220
|
}
|
221
|
|
222
|
public void setDoRank(boolean doRank) {
|
223
|
this.doRank = doRank;
|
224
|
}
|
225
|
|
226
|
public boolean isDoPureNames() {
|
227
|
return doPureNames;
|
228
|
}
|
229
|
|
230
|
public void setDoPureNames(boolean doPureNames) {
|
231
|
this.doPureNames = doPureNames;
|
232
|
}
|
233
|
|
234
|
public boolean isDoDescription() {
|
235
|
return doDescription;
|
236
|
}
|
237
|
|
238
|
public void setDoDescription(boolean doDescription) {
|
239
|
this.doDescription = doDescription;
|
240
|
}
|
241
|
|
242
|
|
243
|
|
244
|
|
245
|
}
|