Project

General

Profile

Download (8.63 KB) Statistics
| Branch: | Revision:
1
/**
2
* Copyright (C) 2008 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.faunaEuropaea;
10

    
11
import org.apache.log4j.Logger;
12

    
13
import eu.etaxonomy.cdm.database.ICdmDataSource;
14
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
15
import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
16
import eu.etaxonomy.cdm.io.common.Source;
17
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
18
import eu.etaxonomy.cdm.io.pesi.out.PesiTransformer;
19
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
20
import eu.etaxonomy.cdm.model.reference.Reference;
21
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
22

    
23
/**
24
 * @author a.babadshanjan
25
 * @created 08.05.2009
26
 * @version 1.0
27
 */
28
public class FaunaEuropaeaImportConfigurator extends ImportConfiguratorBase<FaunaEuropaeaImportState, Source> implements IImportConfigurator {
29
	private static final Logger logger = Logger.getLogger(FaunaEuropaeaImportConfigurator.class);
30

    
31
	//TODO
32
	private static IInputTransformer defaultTransformer = null;
33

    
34
	private boolean doBasionyms = true;
35
	private boolean doTaxonomicallyIncluded = true;
36
	private boolean doMisappliedNames = true;
37
	private boolean doHeterotypicSynonyms = true;
38
	private boolean doHeterotypicSynonymsForBasionyms ;
39
	private boolean doOccurrence = true;
40
	private boolean doVernacularNames = true;
41
	private boolean doAssociatedSpecialists = true;
42
	private boolean doInferredSynonyms = true;
43

    
44
	public boolean isDoVernacularNames() {
45
		return doVernacularNames;
46
	}
47

    
48
	public void setDoVernacularNames(boolean doVernacularNames) {
49
		this.doVernacularNames = doVernacularNames;
50
	}
51

    
52
	public boolean isDoTypes() {
53
		return doTypes;
54
	}
55

    
56

    
57

    
58

    
59
	/* Max number of taxa to be saved with one service call */
60
	private int limitSave = 5000;
61
	private Reference<?> auctReference;
62

    
63
	@Override
64
    @SuppressWarnings("unchecked")
65
	protected void makeIoClassList() {
66
		ioClassList = new Class[] {
67
				FaunaEuropaeaAuthorImport.class,
68
				FaunaEuropaeaUsersImport.class,
69
				FaunaEuropaeaTaxonNameImport.class,
70
				FaunaEuropaeaRelTaxonIncludeImport.class,
71
				FaunaEuropaeaDistributionImport.class,
72
				FaunaEuropaeaHeterotypicSynonymImport.class,
73
				FaunaEuropaeaRefImport.class,
74
				FaunaEuropaeaAdditionalTaxonDataImport.class,
75
				FaunaEuropaeaVernacularNamesImport.class
76
		};
77
	};
78

    
79
	public static FaunaEuropaeaImportConfigurator NewInstance(Source source, ICdmDataSource destination){
80
		return new FaunaEuropaeaImportConfigurator(source, destination);
81
}
82

    
83
	private FaunaEuropaeaImportConfigurator(Source source, ICdmDataSource destination) {
84
		super(defaultTransformer);
85
		setSource(source);
86
		setDestination(destination);
87
		setNomenclaturalCode(NomenclaturalCode.ICZN);
88
	}
89

    
90
//	public static FaunaEuropaeaImportConfigurator NewInstance(ICdmDataSource source, ICdmDataSource destination){
91
//		return new FaunaEuropaeaImportConfigurator(source, destination);
92
//}
93

    
94
//	private FaunaEuropaeaImportConfigurator(ICdmDataSource source, ICdmDataSource destination) {
95
//		super(defaultTransformer);
96
//		setSource(source);
97
//		setDestination(destination);
98
//		setNomenclaturalCode(NomenclaturalCode.ICBN);
99
//	}
100

    
101

    
102
	/* (non-Javadoc)
103
	 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
104
	 */
105
	@Override
106
	public Reference<?> getSourceReference() {
107
		//TODO
108
		if (this.sourceReference == null){
109
			logger.warn("getSource Reference not yet fully implemented");
110

    
111
			sourceReference = ReferenceFactory.newDatabase();
112

    
113
			sourceReference.setTitleCache("Fauna Europaea database", true);
114
			if (this.getSourceRefUuid() != null){
115
				sourceReference.setUuid(this.getSourceRefUuid());
116
			}
117
		}
118
		return sourceReference;
119
	}
120

    
121

    
122
	/* (non-Javadoc)
123
	 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
124
	 */
125
	public Reference<?> getAuctReference() {
126
		//TODO
127
		if (auctReference == null){
128
			auctReference = ReferenceFactory.newPersonalCommunication();
129

    
130
			auctReference.setTitleCache("auct.", true);
131
			auctReference.setUuid(PesiTransformer.uuidSourceRefAuct);
132
		}
133
		return auctReference;
134
	}
135

    
136
	/* (non-Javadoc)
137
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
138
	 */
139
	@Override
140
    public String getSourceNameString() {
141
		if (this.getSource() == null) {
142
			return null;
143
		}else{
144
			return this.getSource().toString();
145
		}
146
	}
147

    
148
	/* (non-Javadoc)
149
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
150
	 */
151
	@Override
152
    public FaunaEuropaeaImportState getNewState() {
153
		return new FaunaEuropaeaImportState(this);
154
	}
155

    
156
	/**
157
	 * @return the doBasionyms
158
	 */
159
	public boolean isDoBasionyms() {
160
		return doBasionyms;
161
	}
162

    
163
	/**
164
	 * @param doBasionyms the doBasionyms to set
165
	 */
166
	public void setDoBasionyms(boolean doBasionyms) {
167
		this.doBasionyms = doBasionyms;
168
	}
169

    
170
	/**
171
	 * @return the doTaxonomicallyIncluded
172
	 */
173
	public boolean isDoTaxonomicallyIncluded() {
174
		return doTaxonomicallyIncluded;
175
	}
176

    
177
	/**
178
	 * @param doTaxonomicallyIncluded the doTaxonomicallyIncluded to set
179
	 */
180
	public void setDoTaxonomicallyIncluded(boolean doTaxonomicallyIncluded) {
181
		this.doTaxonomicallyIncluded = doTaxonomicallyIncluded;
182
	}
183

    
184
	/**
185
	 * @return the doMisappliedNames
186
	 */
187
	public boolean isDoMisappliedNames() {
188
		return doMisappliedNames;
189
	}
190

    
191
	/**
192
	 * @param doMisappliedNames the doMisappliedNames to set
193
	 */
194
	public void setDoMisappliedNames(boolean doMisappliedNames) {
195
		this.doMisappliedNames = doMisappliedNames;
196
	}
197

    
198
	/**
199
	 * @return the doHeterotypicSynonyms
200
	 */
201
	public boolean isDoHeterotypicSynonyms() {
202
		return doHeterotypicSynonyms;
203
	}
204

    
205
	/**
206
	 * @param doHeterotypicSynonyms the doHeterotypicSynonyms to set
207
	 */
208
	public void setDoHeterotypicSynonyms(boolean doHeterotypicSynonyms) {
209
		this.doHeterotypicSynonyms = doHeterotypicSynonyms;
210
	}
211

    
212
	/**
213
	 * @param auctReference the auctReference to set
214
	 */
215
	public void setAuctReference(Reference<?> auctReference) {
216
		this.auctReference = auctReference;
217
	}
218

    
219
	/**
220
	 * @return the limitSave
221
	 */
222
	public int getLimitSave() {
223
		return limitSave;
224
	}
225

    
226
	/**
227
	 * @param limitSave the limitSave to set
228
	 */
229
	public void setLimitSave(int limitSave) {
230
		this.limitSave = limitSave;
231
	}
232

    
233
	/**
234
	 * @param doHeterotypicSynonymsForBasionyms the doHeterotypicSynonymsForBasionyms to set
235
	 */
236
	public void setDoHeterotypicSynonymsForBasionyms(
237
			boolean doHeterotypicSynonymsForBasionyms) {
238
		this.doHeterotypicSynonymsForBasionyms = doHeterotypicSynonymsForBasionyms;
239
	}
240

    
241
	/**
242
	 * @return the doHeterotypicSynonymsForBasionyms
243
	 */
244
	public boolean isDoHeterotypicSynonymsForBasionyms() {
245
		return doHeterotypicSynonymsForBasionyms;
246
	}
247

    
248

    
249
	/* (non-Javadoc)
250
	 * @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#isDoOccurrence()
251
	 */
252
	public boolean isDoOccurrence() {
253
		return doOccurrence;
254
	}
255
	/* (non-Javadoc)
256
	 * @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#setDoOccurrence(boolean)
257
	 */
258
	public void setDoOccurrence(boolean doOccurrence) {
259
		this.doOccurrence = doOccurrence;
260
	}
261

    
262

    
263
	private boolean doAuthors = true;
264
	//references
265
	private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
266
	//names
267
	private final boolean doTypes = true;
268

    
269
	//taxa
270
	private boolean doTaxa = true;
271
	private boolean doRelTaxa = true;
272

    
273
	public boolean isDoAuthors() {
274
		return doAuthors;
275
	}
276
	public void setDoAuthors(boolean doAuthors) {
277
		this.doAuthors = doAuthors;
278
	}
279

    
280
	public DO_REFERENCES getDoReferences() {
281
		return doReferences;
282
	}
283
	public void setDoReferences(DO_REFERENCES doReferences) {
284
		this.doReferences = doReferences;
285
	}
286

    
287
//	public boolean isDoTypes() {
288
//		return doTypes;
289
//	}
290
//	public void setDoTypes(boolean doTypes) {
291
//		this.doTypes = doTypes;
292
//	}
293

    
294
	public boolean isDoTaxa() {
295
		return doTaxa;
296
	}
297
	public void setDoTaxa(boolean doTaxa) {
298
		this.doTaxa = doTaxa;
299
	}
300

    
301
	public boolean isDoRelTaxa() {
302
		return doRelTaxa;
303
	}
304
	public void setDoRelTaxa(boolean doRelTaxa) {
305
		this.doRelTaxa = doRelTaxa;
306
	}
307

    
308
	public boolean isDoAssociatedSpecialists() {
309

    
310
		return this.doAssociatedSpecialists;
311
	}
312

    
313
	public void setDoAssociatedSpecialists(boolean doAssociatedSpecialists){
314
		this.doAssociatedSpecialists = doAssociatedSpecialists;
315
	}
316

    
317
    /**
318
     * @return the doInferredSynonyms
319
     */
320
    public boolean isDoInferredSynonyms() {
321
        return doInferredSynonyms;
322
    }
323

    
324
    public void setDoInferredSynonyms(boolean doInferredSynonyms){
325
        this.doInferredSynonyms = doInferredSynonyms;
326
    }
327

    
328
}
(8-8/20)