Project

General

Profile

Download (7.73 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.IImportConfigurator.DO_REFERENCES;
18
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
19
import eu.etaxonomy.cdm.io.pesi.out.PesiTransformer;
20
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
21
import eu.etaxonomy.cdm.model.reference.Reference;
22
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
23

    
24
/**
25
 * @author a.babadshanjan
26
 * @created 08.05.2009
27
 * @version 1.0
28
 */
29
public class FaunaEuropaeaImportConfigurator extends ImportConfiguratorBase<FaunaEuropaeaImportState, Source> implements IImportConfigurator {
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
	
42
	/* Max number of taxa to be saved with one service call */
43
	private int limitSave = 5000;
44
	private Reference<?> auctReference;
45
	
46
	@SuppressWarnings("unchecked")
47
	protected void makeIoClassList() {
48
		ioClassList = new Class[] {
49
				FaunaEuropaeaAuthorImport.class,
50
				FaunaEuropaeaTaxonNameImport.class,
51
				FaunaEuropaeaRelTaxonIncludeImport.class,
52
				FaunaEuropaeaRefImport.class,
53
				FaunaEuropaeaUsersImport.class,
54
				FaunaEuropaeaDistributionImport.class,
55
				FaunaEuropaeaHeterotypicSynonymImport.class,
56
				FaunaEuropaeaAdditionalTaxonDataImport.class,
57
		};
58
	};
59
	
60
	public static FaunaEuropaeaImportConfigurator NewInstance(Source source, ICdmDataSource destination){
61
		return new FaunaEuropaeaImportConfigurator(source, destination);
62
}
63
	
64
	private FaunaEuropaeaImportConfigurator(Source source, ICdmDataSource destination) {
65
		super(defaultTransformer);
66
		setSource(source);
67
		setDestination(destination);
68
		setNomenclaturalCode(NomenclaturalCode.ICZN);
69
	}
70
	
71
//	public static FaunaEuropaeaImportConfigurator NewInstance(ICdmDataSource source, ICdmDataSource destination){
72
//		return new FaunaEuropaeaImportConfigurator(source, destination);
73
//}
74
	
75
//	private FaunaEuropaeaImportConfigurator(ICdmDataSource source, ICdmDataSource destination) {
76
//		super(defaultTransformer);
77
//		setSource(source);
78
//		setDestination(destination);
79
//		setNomenclaturalCode(NomenclaturalCode.ICBN);
80
//	}
81

    
82
	
83
	/* (non-Javadoc)
84
	 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
85
	 */
86
	@Override
87
	public Reference<?> getSourceReference() {
88
		//TODO
89
		if (this.sourceReference == null){
90
			logger.warn("getSource Reference not yet fully implemented");
91
			sourceReference = ReferenceFactory.newDatabase();
92
			
93
			sourceReference.setTitleCache("Fauna Europaea database", true);
94
			if (this.getSourceRefUuid() != null){
95
				sourceReference.setUuid(this.getSourceRefUuid());
96
			}
97
		}
98
		return sourceReference;
99
	}
100

    
101

    
102
	/* (non-Javadoc)
103
	 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
104
	 */
105
	public Reference<?> getAuctReference() {
106
		//TODO
107
		if (auctReference == null){
108
			auctReference = ReferenceFactory.newPersonalCommunication();
109
			
110
			auctReference.setTitleCache("auct.", true);
111
			auctReference.setUuid(PesiTransformer.uuidSourceRefAuct);
112
		}
113
		return auctReference;
114
	}
115

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

    
127
	/* (non-Javadoc)
128
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
129
	 */
130
	public FaunaEuropaeaImportState getNewState() {
131
		return new FaunaEuropaeaImportState(this);
132
	}
133

    
134
	/**
135
	 * @return the doBasionyms
136
	 */
137
	public boolean isDoBasionyms() {
138
		return doBasionyms;
139
	}
140

    
141
	/**
142
	 * @param doBasionyms the doBasionyms to set
143
	 */
144
	public void setDoBasionyms(boolean doBasionyms) {
145
		this.doBasionyms = doBasionyms;
146
	}
147

    
148
	/**
149
	 * @return the doTaxonomicallyIncluded
150
	 */
151
	public boolean isDoTaxonomicallyIncluded() {
152
		return doTaxonomicallyIncluded;
153
	}
154

    
155
	/**
156
	 * @param doTaxonomicallyIncluded the doTaxonomicallyIncluded to set
157
	 */
158
	public void setDoTaxonomicallyIncluded(boolean doTaxonomicallyIncluded) {
159
		this.doTaxonomicallyIncluded = doTaxonomicallyIncluded;
160
	}
161

    
162
	/**
163
	 * @return the doMisappliedNames
164
	 */
165
	public boolean isDoMisappliedNames() {
166
		return doMisappliedNames;
167
	}
168

    
169
	/**
170
	 * @param doMisappliedNames the doMisappliedNames to set
171
	 */
172
	public void setDoMisappliedNames(boolean doMisappliedNames) {
173
		this.doMisappliedNames = doMisappliedNames;
174
	}
175

    
176
	/**
177
	 * @return the doHeterotypicSynonyms
178
	 */
179
	public boolean isDoHeterotypicSynonyms() {
180
		return doHeterotypicSynonyms;
181
	}
182

    
183
	/**
184
	 * @param doHeterotypicSynonyms the doHeterotypicSynonyms to set
185
	 */
186
	public void setDoHeterotypicSynonyms(boolean doHeterotypicSynonyms) {
187
		this.doHeterotypicSynonyms = doHeterotypicSynonyms;
188
	}
189

    
190
	/**
191
	 * @param auctReference the auctReference to set
192
	 */
193
	public void setAuctReference(Reference<?> auctReference) {
194
		this.auctReference = auctReference;
195
	}
196

    
197
	/**
198
	 * @return the limitSave
199
	 */
200
	public int getLimitSave() {
201
		return limitSave;
202
	}
203

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

    
211
	/**
212
	 * @param doHeterotypicSynonymsForBasionyms the doHeterotypicSynonymsForBasionyms to set
213
	 */
214
	public void setDoHeterotypicSynonymsForBasionyms(
215
			boolean doHeterotypicSynonymsForBasionyms) {
216
		this.doHeterotypicSynonymsForBasionyms = doHeterotypicSynonymsForBasionyms;
217
	}
218

    
219
	/**
220
	 * @return the doHeterotypicSynonymsForBasionyms
221
	 */
222
	public boolean isDoHeterotypicSynonymsForBasionyms() {
223
		return doHeterotypicSynonymsForBasionyms;
224
	}
225

    
226
	
227
	/* (non-Javadoc)
228
	 * @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#isDoOccurrence()
229
	 */
230
	public boolean isDoOccurrence() {
231
		return doOccurrence;
232
	}
233
	/* (non-Javadoc)
234
	 * @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#setDoOccurrence(boolean)
235
	 */
236
	public void setDoOccurrence(boolean doOccurrence) {
237
		this.doOccurrence = doOccurrence;
238
	}
239

    
240
	
241
	private boolean doAuthors = true;
242
	//references
243
	private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
244
	//names
245
	private boolean doTypes = true;
246
	
247
	//taxa
248
	private boolean doTaxa = true;
249
	private boolean doRelTaxa = true;
250

    
251
	public boolean isDoAuthors() {
252
		return doAuthors;
253
	}
254
	public void setDoAuthors(boolean doAuthors) {
255
		this.doAuthors = doAuthors;
256
	}
257

    
258
	public DO_REFERENCES getDoReferences() {
259
		return doReferences;
260
	}
261
	public void setDoReferences(DO_REFERENCES doReferences) {
262
		this.doReferences = doReferences;
263
	}
264

    
265
//	public boolean isDoTypes() {
266
//		return doTypes;
267
//	}
268
//	public void setDoTypes(boolean doTypes) {
269
//		this.doTypes = doTypes;
270
//	}
271

    
272
	public boolean isDoTaxa() {
273
		return doTaxa;
274
	}
275
	public void setDoTaxa(boolean doTaxa) {
276
		this.doTaxa = doTaxa;
277
	}
278

    
279
	public boolean isDoRelTaxa() {
280
		return doRelTaxa;
281
	}
282
	public void setDoRelTaxa(boolean doRelTaxa) {
283
		this.doRelTaxa = doRelTaxa;
284
	}
285

    
286
	
287
}
(8-8/17)