Project

General

Profile

Download (6.2 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
	@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
				PesiFinalUpdateExport.class
64
//				PesiNoteExport.class,
65
//				PesiNoteSourceExport.class, // NoteId's could be deleted from state hashmap
66
//				PesiAdditionalTaxonSourceExport.class,
67
//				PesiOccurrenceExport.class,
68
//				PesiOccurrenceSourceExport.class,
69
//				PesiImageExport.class,
70
		};
71

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

    
85
	/* (non-Javadoc)
86
	 * @see eu.etaxonomy.cdm.io.common.IExportConfigurator#getNewState()
87
	 */
88
	public PesiExportState getNewState() {
89
		return new PesiExportState(this);
90
	}
91
	
92
	/**
93
	 * @return the limitSave
94
	 */
95
	public int getLimitSave() {
96
		return limitSave;
97
	}
98

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

    
106
	/**
107
	 * Returns the Reference for a Misapplied Name.
108
	 * Copied from FaunaEuropaeaImportConfigurator.
109
	 * @return
110
	 */
111
	public Reference<?> getAuctReference() {
112
		if (auctReference == null){
113
			auctReference = ReferenceFactory.newGeneric();
114
			
115
			auctReference.setTitleCache("auct.", true);
116
		}
117
		return auctReference;
118
	}
119
	
120
	public boolean isDoOccurrence() {
121
		return doOccurrence;
122
	}
123
	public void setDoOccurrence(boolean doOccurrence) {
124
		this.doOccurrence = doOccurrence;
125
	}
126
	
127
	
128
	public boolean isDoImages() {
129
		return doImages;
130
	}
131
	public void setDoImages(boolean doImages) {
132
		this.doImages = doImages;
133
	}
134
	
135

    
136

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

    
144
	public boolean isDoTaxa() {
145
		return doTaxa;
146
	}
147
	public void setDoTaxa(boolean doTaxa) {
148
		this.doTaxa = doTaxa;
149
	}
150
	
151
	public boolean isDoRelTaxa() {
152
		return doRelTaxa;
153
	}
154
	public void setDoRelTaxa(boolean doRelTaxa) {
155
		this.doRelTaxa = doRelTaxa;
156
	}
157

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

    
167
	public void setNameIdStart(int nameIdStart) {
168
		this.nameIdStart = nameIdStart;
169
	}
170

    
171
	public boolean isDoNotes() {
172
		return doNotes;
173
	}
174

    
175
	public void setDoNotes(boolean doNotes) {
176
		this.doNotes = doNotes;
177
	}
178

    
179
	public boolean isDoNoteSources() {
180
		return doNoteSources;
181
	}
182

    
183
	public void setDoNoteSources(boolean doNoteSources) {
184
		this.doNoteSources = doNoteSources;
185
	}
186

    
187
	public boolean isDoAdditionalTaxonSource() {
188
		return doAdditionalTaxonSource;
189
	}
190

    
191
	public void setDoAdditionalTaxonSource(boolean doAdditionalTaxonSource) {
192
		this.doAdditionalTaxonSource = doAdditionalTaxonSource;
193
	}
194

    
195
	public boolean isDoOccurrenceSource() {
196
		return doOccurrenceSource;
197
	}
198

    
199
	public void setDoOccurrenceSource(boolean doOccurrenceSource) {
200
		this.doOccurrenceSource = doOccurrenceSource;
201
	}
202

    
203
	public boolean isDoTreeIndex() {
204
		return this.doTreeIndex;
205
	}
206

    
207
	public void setDoTreeIndex(boolean doTreeIndex) {
208
		this.doTreeIndex = doTreeIndex;
209
	}
210

    
211
	public boolean isDoInferredSynonyms() {
212
		return doInferredSynonyms;
213
	}
214

    
215
	public void setDoInferredSynonyms(boolean doInferredSynonyms) {
216
		this.doInferredSynonyms = doInferredSynonyms;
217
	}
218

    
219
	public boolean isDoRank() {
220
		return doRank;
221
	}
222

    
223
	public void setDoRank(boolean doRank) {
224
		this.doRank = doRank;
225
	}
226

    
227
	public boolean isDoPureNames() {
228
		return doPureNames;
229
	}
230

    
231
	public void setDoPureNames(boolean doPureNames) {
232
		this.doPureNames = doPureNames;
233
	}
234

    
235
	public boolean isDoDescription() {
236
		return doDescription;
237
	}
238

    
239
	public void setDoDescription(boolean doDescription) {
240
		this.doDescription = doDescription;
241
	}
242

    
243
	public boolean isDoParentAndBiota() {
244
		return doParentAndBiota;
245
	}
246

    
247
	public void setDoParentAndBiota(boolean doParentAndBiota) {
248
		this.doParentAndBiota = doParentAndBiota;
249
	}
250

    
251

    
252

    
253

    
254
}
(5-5/12)