Project

General

Profile

Download (8.32 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

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

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

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

    
55
	
56

    
57

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

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

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

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

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

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

    
100

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

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

    
119

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
246

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

    
260

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

    
267
	//taxa
268
	private boolean doTaxa = true;
269
	private boolean doRelTaxa = true;
270

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

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

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

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

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

    
306
	public boolean isDoAssociatedSpecialists() {
307
		
308
		return this.doAssociatedSpecialists;
309
	}
310
	
311
	public void setDoAssociatedSpecialists(boolean doAssociatedSpecialists){
312
		this.doAssociatedSpecialists = doAssociatedSpecialists;
313
	}
314

    
315

    
316
}
(8-8/20)