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
				FaunaEuropaeaRefImport.class,
71

    
72
				FaunaEuropaeaDistributionImport.class,
73
				FaunaEuropaeaHeterotypicSynonymImport.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
			sourceReference = ReferenceFactory.newDatabase();
111

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

    
120

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
247

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

    
261

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

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

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

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

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

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

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

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

    
316

    
317
}
(8-8/20)