Project

General

Profile

Download (6.22 KB) Statistics
| Branch: | Revision:
1
/**
2
* Copyright (C) 2009 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
package eu.etaxonomy.cdm.io.pesi.out;
10

    
11
import org.apache.log4j.Logger;
12

    
13
import eu.etaxonomy.cdm.database.ICdmDataSource;
14
import eu.etaxonomy.cdm.io.common.DbExportConfiguratorBase;
15
import eu.etaxonomy.cdm.io.common.IExportConfigurator;
16
import eu.etaxonomy.cdm.io.common.Source;
17
import eu.etaxonomy.cdm.model.reference.Reference;
18
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
19

    
20
/**
21
 * @author e.-m.lee
22
 * @since 12.02.2010
23
 *
24
 */
25
public class PesiExportConfigurator extends DbExportConfiguratorBase<PesiExportState, PesiTransformer, Source>
26
        implements IExportConfigurator<PesiExportState, PesiTransformer> {
27

    
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 doParentAndBiota = true;
46
	private boolean doInferredSynonyms = true;
47
	private boolean doRank = true;
48
	private boolean doPureNames = true;
49
	private boolean doDescription = true;
50

    
51
	private int nameIdStart = 10000000;
52

    
53
	public static PesiExportConfigurator NewInstance(Source pesiDestination, ICdmDataSource source, PesiTransformer transformer) {
54
			return new PesiExportConfigurator(pesiDestination, source, transformer);
55
	}
56

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

    
74
	}
75

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

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

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

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

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

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

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

    
130

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

    
138

    
139

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
254

    
255

    
256

    
257
}
(5-5/12)