Project

General

Profile

Download (8.67 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
 * @since 08.05.2009
26
 */
27
public class FaunaEuropaeaImportConfigurator extends ImportConfiguratorBase<FaunaEuropaeaImportState, Source> implements IImportConfigurator {
28

    
29
    private static final long serialVersionUID = 3218446329444903409L;
30
    private static final Logger logger = Logger.getLogger(FaunaEuropaeaImportConfigurator.class);
31

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

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

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

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

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

    
57

    
58

    
59

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

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

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

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

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

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

    
102

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

    
112
			sourceReference = ReferenceFactory.newDatabase();
113

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

    
122

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
249

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

    
263

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

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

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

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

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

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

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

    
309
	public boolean isDoAssociatedSpecialists() {
310

    
311
		return this.doAssociatedSpecialists;
312
	}
313

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

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

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

    
329
}
(8-8/20)