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.model.reference.Reference;
|
19
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
20
|
|
21
|
/**
|
22
|
* @author e.-m.lee
|
23
|
* @date 12.02.2010
|
24
|
*
|
25
|
*/
|
26
|
public class PesiExportConfigurator extends DbExportConfiguratorBase<PesiExportState> implements IExportConfigurator<PesiExportState> {
|
27
|
@SuppressWarnings("unused")
|
28
|
private static Logger logger = Logger.getLogger(PesiExportConfigurator.class);
|
29
|
private int limitSave = 2000;
|
30
|
|
31
|
private Reference<?> auctReference;
|
32
|
|
33
|
|
34
|
private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
|
35
|
private boolean doTaxa = true;
|
36
|
private boolean doRelTaxa = true;
|
37
|
private boolean doNotes = true;
|
38
|
private boolean doNoteSources = true;
|
39
|
private boolean doAdditionalTaxonSource = true;
|
40
|
private boolean doOccurrence = true;
|
41
|
private boolean doOccurrenceSource = true;
|
42
|
private boolean doImages = true;
|
43
|
|
44
|
private int nameIdStart = 10000000;
|
45
|
|
46
|
|
47
|
public static PesiExportConfigurator NewInstance(Source pesiDestination, ICdmDataSource source) {
|
48
|
return new PesiExportConfigurator(pesiDestination, source);
|
49
|
}
|
50
|
|
51
|
@SuppressWarnings("unchecked")
|
52
|
protected void makeIoClassList() {
|
53
|
ioClassList = new Class[]{
|
54
|
PesiSourceExport.class,
|
55
|
PesiTaxonExport.class,
|
56
|
PesiRelTaxonExport.class, // RelTaxonId's could be deleted from state hashmap
|
57
|
PesiNoteExport.class,
|
58
|
PesiNoteSourceExport.class, // NoteId's could be deleted from state hashmap
|
59
|
PesiAdditionalTaxonSourceExport.class,
|
60
|
PesiOccurrenceExport.class,
|
61
|
PesiOccurrenceSourceExport.class,
|
62
|
PesiImageExport.class,
|
63
|
};
|
64
|
|
65
|
}
|
66
|
|
67
|
/**
|
68
|
* @param pesiSource
|
69
|
* @param cdmSource
|
70
|
*/
|
71
|
private PesiExportConfigurator(Source pesiSource, ICdmDataSource cdmSource) {
|
72
|
super();
|
73
|
setSource(cdmSource);
|
74
|
setDestination(pesiSource);
|
75
|
}
|
76
|
|
77
|
/* (non-Javadoc)
|
78
|
* @see eu.etaxonomy.cdm.io.common.IExportConfigurator#getNewState()
|
79
|
*/
|
80
|
public PesiExportState getNewState() {
|
81
|
return new PesiExportState(this);
|
82
|
}
|
83
|
|
84
|
/**
|
85
|
* @return the limitSave
|
86
|
*/
|
87
|
public int getLimitSave() {
|
88
|
return limitSave;
|
89
|
}
|
90
|
|
91
|
/**
|
92
|
* @param limitSave the limitSave to set
|
93
|
*/
|
94
|
public void setLimitSave(int limitSave) {
|
95
|
this.limitSave = limitSave;
|
96
|
}
|
97
|
|
98
|
/**
|
99
|
* Returns the Reference for a Misapplied Name.
|
100
|
* Copied from FaunaEuropaeaImportConfigurator.
|
101
|
* @return
|
102
|
*/
|
103
|
public Reference<?> getAuctReference() {
|
104
|
if (auctReference == null){
|
105
|
auctReference = ReferenceFactory.newGeneric();
|
106
|
|
107
|
auctReference.setTitleCache("auct.", true);
|
108
|
}
|
109
|
return auctReference;
|
110
|
}
|
111
|
|
112
|
public boolean isDoOccurrence() {
|
113
|
return doOccurrence;
|
114
|
}
|
115
|
public void setDoOccurrence(boolean doOccurrence) {
|
116
|
this.doOccurrence = doOccurrence;
|
117
|
}
|
118
|
|
119
|
|
120
|
public boolean isDoImages() {
|
121
|
return doImages;
|
122
|
}
|
123
|
public void setDoImages(boolean doImages) {
|
124
|
this.doImages = doImages;
|
125
|
}
|
126
|
|
127
|
|
128
|
|
129
|
public DO_REFERENCES getDoReferences() {
|
130
|
return doReferences;
|
131
|
}
|
132
|
public void setDoReferences(DO_REFERENCES doReferences) {
|
133
|
this.doReferences = doReferences;
|
134
|
}
|
135
|
|
136
|
public boolean isDoTaxa() {
|
137
|
return doTaxa;
|
138
|
}
|
139
|
public void setDoTaxa(boolean doTaxa) {
|
140
|
this.doTaxa = doTaxa;
|
141
|
}
|
142
|
|
143
|
public boolean isDoRelTaxa() {
|
144
|
return doRelTaxa;
|
145
|
}
|
146
|
public void setDoRelTaxa(boolean doRelTaxa) {
|
147
|
this.doRelTaxa = doRelTaxa;
|
148
|
}
|
149
|
|
150
|
/**
|
151
|
* Number that is added to the cdm id in case a name is stored by its own id
|
152
|
* not the taxons id.
|
153
|
* @return
|
154
|
*/
|
155
|
public int getNameIdStart() {
|
156
|
return nameIdStart;
|
157
|
}
|
158
|
|
159
|
public void setNameIdStart(int nameIdStart) {
|
160
|
this.nameIdStart = nameIdStart;
|
161
|
}
|
162
|
|
163
|
public boolean isDoNotes() {
|
164
|
return doNotes;
|
165
|
}
|
166
|
|
167
|
public void setDoNotes(boolean doNotes) {
|
168
|
this.doNotes = doNotes;
|
169
|
}
|
170
|
|
171
|
public boolean isDoNoteSources() {
|
172
|
return doNoteSources;
|
173
|
}
|
174
|
|
175
|
public void setDoNoteSources(boolean doNoteSources) {
|
176
|
this.doNoteSources = doNoteSources;
|
177
|
}
|
178
|
|
179
|
public boolean isDoAdditionalTaxonSource() {
|
180
|
return doAdditionalTaxonSource;
|
181
|
}
|
182
|
|
183
|
public void setDoAdditionalTaxonSource(boolean doAdditionalTaxonSource) {
|
184
|
this.doAdditionalTaxonSource = doAdditionalTaxonSource;
|
185
|
}
|
186
|
|
187
|
public boolean isDoOccurrenceSource() {
|
188
|
return doOccurrenceSource;
|
189
|
}
|
190
|
|
191
|
public void setDoOccurrenceSource(boolean doOccurrenceSource) {
|
192
|
this.doOccurrenceSource = doOccurrenceSource;
|
193
|
}
|
194
|
|
195
|
|
196
|
|
197
|
|
198
|
|
199
|
}
|