Project

General

Profile

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

    
42
	/* Max number of taxa to be saved with one service call */
43
	private int limitSave = 5000;
44
	private Reference<?> auctReference;
45

    
46
	@Override
47
    @SuppressWarnings("unchecked")
48
	protected void makeIoClassList() {
49
		ioClassList = new Class[] {
50
				FaunaEuropaeaAuthorImport.class,
51
				FaunaEuropaeaUsersImport.class,
52
				FaunaEuropaeaTaxonNameImport.class,
53
				FaunaEuropaeaRelTaxonIncludeImport.class,
54
				FaunaEuropaeaRefImport.class,
55

    
56
				FaunaEuropaeaDistributionImport.class,
57
				FaunaEuropaeaHeterotypicSynonymImport.class,
58
				FaunaEuropaeaAdditionalTaxonDataImport.class,
59
				FaunaEuropaeaVernacularNamesImport.class
60
		};
61
	};
62

    
63
	public static FaunaEuropaeaImportConfigurator NewInstance(Source source, ICdmDataSource destination){
64
		return new FaunaEuropaeaImportConfigurator(source, destination);
65
}
66

    
67
	private FaunaEuropaeaImportConfigurator(Source source, ICdmDataSource destination) {
68
		super(defaultTransformer);
69
		setSource(source);
70
		setDestination(destination);
71
		setNomenclaturalCode(NomenclaturalCode.ICZN);
72
	}
73

    
74
//	public static FaunaEuropaeaImportConfigurator NewInstance(ICdmDataSource source, ICdmDataSource destination){
75
//		return new FaunaEuropaeaImportConfigurator(source, destination);
76
//}
77

    
78
//	private FaunaEuropaeaImportConfigurator(ICdmDataSource source, ICdmDataSource destination) {
79
//		super(defaultTransformer);
80
//		setSource(source);
81
//		setDestination(destination);
82
//		setNomenclaturalCode(NomenclaturalCode.ICBN);
83
//	}
84

    
85

    
86
	/* (non-Javadoc)
87
	 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
88
	 */
89
	@Override
90
	public Reference<?> getSourceReference() {
91
		//TODO
92
		if (this.sourceReference == null){
93
			logger.warn("getSource Reference not yet fully implemented");
94
			sourceReference = ReferenceFactory.newDatabase();
95

    
96
			sourceReference.setTitleCache("Fauna Europaea database", true);
97
			if (this.getSourceRefUuid() != null){
98
				sourceReference.setUuid(this.getSourceRefUuid());
99
			}
100
		}
101
		return sourceReference;
102
	}
103

    
104

    
105
	/* (non-Javadoc)
106
	 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
107
	 */
108
	public Reference<?> getAuctReference() {
109
		//TODO
110
		if (auctReference == null){
111
			auctReference = ReferenceFactory.newPersonalCommunication();
112

    
113
			auctReference.setTitleCache("auct.", true);
114
			auctReference.setUuid(PesiTransformer.uuidSourceRefAuct);
115
		}
116
		return auctReference;
117
	}
118

    
119
	/* (non-Javadoc)
120
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
121
	 */
122
	@Override
123
    public String getSourceNameString() {
124
		if (this.getSource() == null) {
125
			return null;
126
		}else{
127
			return this.getSource().toString();
128
		}
129
	}
130

    
131
	/* (non-Javadoc)
132
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
133
	 */
134
	@Override
135
    public FaunaEuropaeaImportState getNewState() {
136
		return new FaunaEuropaeaImportState(this);
137
	}
138

    
139
	/**
140
	 * @return the doBasionyms
141
	 */
142
	public boolean isDoBasionyms() {
143
		return doBasionyms;
144
	}
145

    
146
	/**
147
	 * @param doBasionyms the doBasionyms to set
148
	 */
149
	public void setDoBasionyms(boolean doBasionyms) {
150
		this.doBasionyms = doBasionyms;
151
	}
152

    
153
	/**
154
	 * @return the doTaxonomicallyIncluded
155
	 */
156
	public boolean isDoTaxonomicallyIncluded() {
157
		return doTaxonomicallyIncluded;
158
	}
159

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

    
167
	/**
168
	 * @return the doMisappliedNames
169
	 */
170
	public boolean isDoMisappliedNames() {
171
		return doMisappliedNames;
172
	}
173

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

    
181
	/**
182
	 * @return the doHeterotypicSynonyms
183
	 */
184
	public boolean isDoHeterotypicSynonyms() {
185
		return doHeterotypicSynonyms;
186
	}
187

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

    
195
	/**
196
	 * @param auctReference the auctReference to set
197
	 */
198
	public void setAuctReference(Reference<?> auctReference) {
199
		this.auctReference = auctReference;
200
	}
201

    
202
	/**
203
	 * @return the limitSave
204
	 */
205
	public int getLimitSave() {
206
		return limitSave;
207
	}
208

    
209
	/**
210
	 * @param limitSave the limitSave to set
211
	 */
212
	public void setLimitSave(int limitSave) {
213
		this.limitSave = limitSave;
214
	}
215

    
216
	/**
217
	 * @param doHeterotypicSynonymsForBasionyms the doHeterotypicSynonymsForBasionyms to set
218
	 */
219
	public void setDoHeterotypicSynonymsForBasionyms(
220
			boolean doHeterotypicSynonymsForBasionyms) {
221
		this.doHeterotypicSynonymsForBasionyms = doHeterotypicSynonymsForBasionyms;
222
	}
223

    
224
	/**
225
	 * @return the doHeterotypicSynonymsForBasionyms
226
	 */
227
	public boolean isDoHeterotypicSynonymsForBasionyms() {
228
		return doHeterotypicSynonymsForBasionyms;
229
	}
230

    
231

    
232
	/* (non-Javadoc)
233
	 * @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#isDoOccurrence()
234
	 */
235
	public boolean isDoOccurrence() {
236
		return doOccurrence;
237
	}
238
	/* (non-Javadoc)
239
	 * @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#setDoOccurrence(boolean)
240
	 */
241
	public void setDoOccurrence(boolean doOccurrence) {
242
		this.doOccurrence = doOccurrence;
243
	}
244

    
245

    
246
	private boolean doAuthors = true;
247
	//references
248
	private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
249
	//names
250
	private final boolean doTypes = true;
251

    
252
	//taxa
253
	private boolean doTaxa = true;
254
	private boolean doRelTaxa = true;
255

    
256
	public boolean isDoAuthors() {
257
		return doAuthors;
258
	}
259
	public void setDoAuthors(boolean doAuthors) {
260
		this.doAuthors = doAuthors;
261
	}
262

    
263
	public DO_REFERENCES getDoReferences() {
264
		return doReferences;
265
	}
266
	public void setDoReferences(DO_REFERENCES doReferences) {
267
		this.doReferences = doReferences;
268
	}
269

    
270
//	public boolean isDoTypes() {
271
//		return doTypes;
272
//	}
273
//	public void setDoTypes(boolean doTypes) {
274
//		this.doTypes = doTypes;
275
//	}
276

    
277
	public boolean isDoTaxa() {
278
		return doTaxa;
279
	}
280
	public void setDoTaxa(boolean doTaxa) {
281
		this.doTaxa = doTaxa;
282
	}
283

    
284
	public boolean isDoRelTaxa() {
285
		return doRelTaxa;
286
	}
287
	public void setDoRelTaxa(boolean doRelTaxa) {
288
		this.doRelTaxa = doRelTaxa;
289
	}
290

    
291

    
292
}
(8-8/20)