Project

General

Profile

Download (6.21 KB) Statistics
| Branch: | Revision:
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, PesiTransformer> implements IExportConfigurator<PesiExportState, PesiTransformer> {
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
	private boolean doTreeIndex = true;
44
	private boolean doParentAndBiota = 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, PesiTransformer transformer) {
53
			return new PesiExportConfigurator(pesiDestination, source, transformer);
54
	}
55

    
56
	@Override
57
    @SuppressWarnings("unchecked")
58
	protected void makeIoClassList() {
59
		ioClassList = new Class[]{
60
				PesiSourceExport.class,
61
				PesiTaxonExport.class,
62
				PesiRelTaxonExport.class, // RelTaxonId's could be deleted from state hashmap
63
				PesiDescriptionExport.class,
64
				PesiFinalUpdateExport.class
65
//				PesiNoteExport.class,
66
//				PesiNoteSourceExport.class, // NoteId's could be deleted from state hashmap
67
//				PesiAdditionalTaxonSourceExport.class,
68
//				PesiOccurrenceExport.class,
69
//				PesiOccurrenceSourceExport.class,
70
//				PesiImageExport.class,
71
		};
72

    
73
	}
74

    
75
	/**
76
	 * @param pesiSource
77
	 * @param cdmSource
78
	 * @param transformer
79
	 */
80
	private PesiExportConfigurator(Source pesiSource, ICdmDataSource cdmSource, PesiTransformer transformer) {
81
	   super(transformer);
82
	   setSource(cdmSource);
83
	   setDestination(pesiSource);
84
	}
85

    
86
	/* (non-Javadoc)
87
	 * @see eu.etaxonomy.cdm.io.common.IExportConfigurator#getNewState()
88
	 */
89
	@Override
90
    public PesiExportState getNewState() {
91
		return new PesiExportState(this);
92
	}
93

    
94
	/**
95
	 * @return the limitSave
96
	 */
97
	public int getLimitSave() {
98
		return limitSave;
99
	}
100

    
101
	/**
102
	 * @param limitSave the limitSave to set
103
	 */
104
	public void setLimitSave(int limitSave) {
105
		this.limitSave = limitSave;
106
	}
107

    
108
	/**
109
	 * Returns the Reference for a Misapplied Name.
110
	 * Copied from FaunaEuropaeaImportConfigurator.
111
	 * @return
112
	 */
113
	public Reference getAuctReference() {
114
		if (auctReference == null){
115
			auctReference = ReferenceFactory.newGeneric();
116

    
117
			auctReference.setTitleCache("auct.", true);
118
		}
119
		return auctReference;
120
	}
121

    
122
	public boolean isDoOccurrence() {
123
		return doOccurrence;
124
	}
125
	public void setDoOccurrence(boolean doOccurrence) {
126
		this.doOccurrence = doOccurrence;
127
	}
128

    
129

    
130
	public boolean isDoImages() {
131
		return doImages;
132
	}
133
	public void setDoImages(boolean doImages) {
134
		this.doImages = doImages;
135
	}
136

    
137

    
138

    
139
	public DO_REFERENCES getDoReferences() {
140
		return doReferences;
141
	}
142
	public void setDoReferences(DO_REFERENCES doReferences) {
143
		this.doReferences = doReferences;
144
	}
145

    
146
	public boolean isDoTaxa() {
147
		return doTaxa;
148
	}
149
	public void setDoTaxa(boolean doTaxa) {
150
		this.doTaxa = doTaxa;
151
	}
152

    
153
	public boolean isDoRelTaxa() {
154
		return doRelTaxa;
155
	}
156
	public void setDoRelTaxa(boolean doRelTaxa) {
157
		this.doRelTaxa = doRelTaxa;
158
	}
159

    
160
	/**
161
	 * Number that is added to the cdm id in case a name is stored by its own id
162
	 * not the taxons id.
163
	 * @return
164
	 */
165
	public int getNameIdStart() {
166
		return nameIdStart;
167
	}
168

    
169
	public void setNameIdStart(int nameIdStart) {
170
		this.nameIdStart = nameIdStart;
171
	}
172

    
173
	public boolean isDoNotes() {
174
		return doNotes;
175
	}
176

    
177
	public void setDoNotes(boolean doNotes) {
178
		this.doNotes = doNotes;
179
	}
180

    
181
	public boolean isDoNoteSources() {
182
		return doNoteSources;
183
	}
184

    
185
	public void setDoNoteSources(boolean doNoteSources) {
186
		this.doNoteSources = doNoteSources;
187
	}
188

    
189
	public boolean isDoAdditionalTaxonSource() {
190
		return doAdditionalTaxonSource;
191
	}
192

    
193
	public void setDoAdditionalTaxonSource(boolean doAdditionalTaxonSource) {
194
		this.doAdditionalTaxonSource = doAdditionalTaxonSource;
195
	}
196

    
197
	public boolean isDoOccurrenceSource() {
198
		return doOccurrenceSource;
199
	}
200

    
201
	public void setDoOccurrenceSource(boolean doOccurrenceSource) {
202
		this.doOccurrenceSource = doOccurrenceSource;
203
	}
204

    
205
	public boolean isDoTreeIndex() {
206
		return this.doTreeIndex;
207
	}
208

    
209
	public void setDoTreeIndex(boolean doTreeIndex) {
210
		this.doTreeIndex = doTreeIndex;
211
	}
212

    
213
	public boolean isDoInferredSynonyms() {
214
		return doInferredSynonyms;
215
	}
216

    
217
	public void setDoInferredSynonyms(boolean doInferredSynonyms) {
218
		this.doInferredSynonyms = doInferredSynonyms;
219
	}
220

    
221
	public boolean isDoRank() {
222
		return doRank;
223
	}
224

    
225
	public void setDoRank(boolean doRank) {
226
		this.doRank = doRank;
227
	}
228

    
229
	public boolean isDoPureNames() {
230
		return doPureNames;
231
	}
232

    
233
	public void setDoPureNames(boolean doPureNames) {
234
		this.doPureNames = doPureNames;
235
	}
236

    
237
	public boolean isDoDescription() {
238
		return doDescription;
239
	}
240

    
241
	public void setDoDescription(boolean doDescription) {
242
		this.doDescription = doDescription;
243
	}
244

    
245
	public boolean isDoParentAndBiota() {
246
		return doParentAndBiota;
247
	}
248

    
249
	public void setDoParentAndBiota(boolean doParentAndBiota) {
250
		this.doParentAndBiota = doParentAndBiota;
251
	}
252

    
253

    
254

    
255

    
256
}
(5-5/12)