Project

General

Profile

Download (5.38 KB) Statistics
| Branch: | Revision:
1
/**
2
* Copyright (C) 2007 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

    
10
package eu.etaxonomy.cdm.io.eflora.centralAfrica.ferns;
11

    
12
import java.lang.reflect.Method;
13

    
14
import org.apache.log4j.Logger;
15

    
16
import eu.etaxonomy.cdm.database.ICdmDataSource;
17
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
18
import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
19
import eu.etaxonomy.cdm.io.common.ImportStateBase;
20
import eu.etaxonomy.cdm.io.common.Source;
21
import eu.etaxonomy.cdm.io.common.IImportConfigurator.DO_REFERENCES;
22
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
23
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
24
import eu.etaxonomy.cdm.model.reference.Reference;
25
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
26

    
27

    
28
/**
29
 * @author a.mueller
30
 * @created 20.03.2008
31
 * @version 1.0
32
 */
33
public class CentralAfricaFernsImportConfigurator extends ImportConfiguratorBase<CentralAfricaFernsImportState, Source> implements IImportConfigurator{
34
	@SuppressWarnings("unused")
35
	private static Logger logger = Logger.getLogger(CentralAfricaFernsImportConfigurator.class);
36

    
37
	public static CentralAfricaFernsImportConfigurator NewInstance(Source ermsSource, ICdmDataSource destination){
38
			return new CentralAfricaFernsImportConfigurator(ermsSource, destination);
39
	}
40

    
41
	/* Max number of records to be saved with one service call */
42
	private int recordsPerTransaction = 1000;  //defaultValue
43

    
44
	//TODO needed ??
45
	private Method userTransformationMethod;
46
	
47
	private boolean doVernaculars = true;
48
	private boolean doLinks = true;
49
	private boolean doNotes = true;
50
	private boolean doImages = true;
51
	private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
52
	private boolean doTaxa = true;
53
	private boolean doRelTaxa = true;
54

    
55
	
56
	private static IInputTransformer defaultTransformer = new CentralAfricaFernsTransformer();
57
	
58
	protected void makeIoClassList(){
59
		ioClassList = new Class[]{
60
				//ErmsGeneralImportValidator.class
61
//				 CentralAfricaFernsReferenceImport.class ,
62
				 CentralAfricaFernsTaxonImport.class,
63
				 CentralAfricaFernsTaxonRelationImport.class
64
		};	
65
	}
66
	
67

    
68
	/* (non-Javadoc)
69
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
70
	 */
71
	public ImportStateBase getNewState() {
72
		return new CentralAfricaFernsImportState(this);
73
	}
74

    
75

    
76

    
77
	private CentralAfricaFernsImportConfigurator(Source source, ICdmDataSource destination) {
78
	   super(defaultTransformer);
79
	   setNomenclaturalCode(NomenclaturalCode.ICZN); //default for ERMS
80
	   setSource(source);
81
	   setDestination(destination);
82
	}
83
	
84
	/* (non-Javadoc)
85
	 * @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#getSourceReference()
86
	 */
87
	public Reference getSourceReference() {
88
		if (sourceReference == null){
89
			sourceReference =  ReferenceFactory.newDatabase();
90
			if (getSource() != null){
91
				sourceReference.setTitleCache(getSource().getDatabase(), true);
92
			}
93
		}
94
		return sourceReference;
95
	}
96

    
97

    
98
	/* (non-Javadoc)
99
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
100
	 */
101
	public String getSourceNameString() {
102
		if (this.getSource() == null){
103
			return null;
104
		}else{
105
			return this.getSource().getDatabase();
106
		}
107
	}
108

    
109
	/**
110
	 * @return the userTransformationMethod
111
	 */
112
	public Method getUserTransformationMethod() {
113
		return userTransformationMethod;
114
	}
115

    
116
	/**
117
	 * @param userTransformationMethod the userTransformationMethod to set
118
	 */
119
	public void setUserTransformationMethod(Method userTransformationMethod) {
120
		this.userTransformationMethod = userTransformationMethod;
121
	}
122

    
123
	
124
	/**
125
	 * @return the limitSave
126
	 */
127
	public int getRecordsPerTransaction() {
128
		return recordsPerTransaction;
129
	}
130
	/**
131
	 * @param limitSave the limitSave to set
132
	 */
133
	public void setRecordsPerTransaction(int recordsPerTransaction) {
134
		this.recordsPerTransaction = recordsPerTransaction;
135
	}
136

    
137
	/**
138
	 * @param doVernaculars the doVernaculars to set
139
	 */
140
	public void setDoVernaculars(boolean doVernaculars) {
141
		this.doVernaculars = doVernaculars;
142
	}
143
	/**
144
	 * @return the doVernaculars
145
	 */
146
	public boolean isDoVernaculars() {
147
		return doVernaculars;
148
	}
149

    
150

    
151

    
152
	/**
153
	 * @param doLinks the doLinks to set
154
	 */
155
	public void setDoLinks(boolean doLinks) {
156
		this.doLinks = doLinks;
157
	}
158
	/**
159
	 * @return the doLinks
160
	 */
161
	public boolean isDoLinks() {
162
		return doLinks;
163
	}
164

    
165

    
166

    
167
	/**
168
	 * @param doNotes the doNotes to set
169
	 */
170
	public void setDoNotes(boolean doNotes) {
171
		this.doNotes = doNotes;
172
	}
173
	/**
174
	 * @return the doNotes
175
	 */
176
	public boolean isDoNotes() {
177
		return doNotes;
178
	}
179

    
180
	/**
181
	 * @param doImages the doImages to set
182
	 */
183
	public void setDoImages(boolean doImages) {
184
		this.doImages = doImages;
185
	}
186
	/**
187
	 * @return the doImages
188
	 */
189
	public boolean isDoImages() {
190
		return doImages;
191
	}
192
	
193

    
194
	public DO_REFERENCES getDoReferences() {
195
		return doReferences;
196
	}
197
	public void setDoReferences(DO_REFERENCES doReferences) {
198
		this.doReferences = doReferences;
199
	}
200

    
201
	public boolean isDoTaxa() {
202
		return doTaxa;
203
	}
204
	public void setDoTaxa(boolean doTaxa) {
205
		this.doTaxa = doTaxa;
206
	}
207

    
208
	public boolean isDoRelTaxa() {
209
		return doRelTaxa;
210
	}
211
	public void setDoRelTaxa(boolean doRelTaxa) {
212
		this.doRelTaxa = doRelTaxa;
213
	}
214
	
215

    
216
}
(2-2/7)