Project

General

Profile

Download (6.18 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.pesi.erms;
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.DbImportConfiguratorBase;
18
import eu.etaxonomy.cdm.io.common.ImportStateBase;
19
import eu.etaxonomy.cdm.io.common.Source;
20
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
21
import eu.etaxonomy.cdm.io.pesi.erms.validation.ErmsGeneralImportValidator;
22
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
23
import eu.etaxonomy.cdm.model.reference.Reference;
24
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
25

    
26

    
27
/**
28
 * @author a.mueller
29
 * @since 20.03.2008
30
 */
31
public class ErmsImportConfigurator
32
        extends DbImportConfiguratorBase<ErmsImportState>{
33
    private static final long serialVersionUID = 5434106058744720246L;
34

    
35
    @SuppressWarnings("unused")
36
	private static Logger logger = Logger.getLogger(ErmsImportConfigurator.class);
37

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

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

    
45
	//TODO needed ??
46
	private Method userTransformationMethod;
47

    
48
	private boolean doVernaculars = true;
49
	private boolean doLinks = true;
50
	private boolean doNotes = true;
51
	private boolean doImages = true;
52
	private boolean doOccurrence = true;
53
	private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
54
	private boolean doTaxa = true;
55
	private boolean doRelTaxa = true;
56

    
57

    
58
	private static IInputTransformer defaultTransformer = new ErmsTransformer();
59

    
60
	@Override
61
    protected void makeIoClassList(){
62
		ioClassList = new Class[]{
63
				ErmsGeneralImportValidator.class
64
				, ErmsImportRankMap.class
65
				, ErmsReferenceImport.class
66
				, ErmsTaxonImport.class
67
				, ErmsTaxonRelationImport.class
68
				, ErmsVernacularImport.class
69
				, ErmsNotesImport.class
70
				, ErmsVernacularSourcesImport.class
71
				, ErmsNotesSourcesImport.class
72

    
73
				, ErmsAreaImport.class
74
				, ErmsDrImport.class
75
				, ErmsSourceUsesImport.class
76
				, ErmsLinkImport.class  //kann weiter hoch
77
				, ErmsImageImport.class
78
		};
79
	}
80

    
81

    
82
	/* (non-Javadoc)
83
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
84
	 */
85
	@Override
86
    public ImportStateBase getNewState() {
87
		return new ErmsImportState(this);
88
	}
89

    
90

    
91

    
92
	/**
93
	 * @param berlinModelSource
94
	 * @param sourceReference
95
	 * @param destination
96
	 */
97
	private ErmsImportConfigurator(Source ermsSource, ICdmDataSource destination) {
98
	   super(ermsSource, destination, NomenclaturalCode.ICZN, defaultTransformer);//default for ERMS
99
	}
100

    
101

    
102
	@Override
103
    public Source getSource() {
104
		return super.getSource();
105
	}
106
	@Override
107
    public void setSource(Source berlinModelSource) {
108
		super.setSource(berlinModelSource);
109
	}
110

    
111
	/* (non-Javadoc)
112
	 * @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#getSourceReference()
113
	 */
114
	@Override
115
    public Reference getSourceReference() {
116
		if (sourceReference == null){
117
			sourceReference =  ReferenceFactory.newDatabase();
118
			if (getSource() != null){
119
				sourceReference.setTitleCache(getSource().getDatabase(), true);
120
			}
121
			if (this.getSourceRefUuid() != null){
122
				sourceReference.setUuid(this.getSourceRefUuid());
123
			}
124
		}
125
		return sourceReference;
126
	}
127

    
128

    
129
	/* (non-Javadoc)
130
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
131
	 */
132
	@Override
133
    public String getSourceNameString() {
134
		if (this.getSource() == null){
135
			return null;
136
		}else{
137
			return this.getSource().getDatabase();
138
		}
139
	}
140

    
141
	/**
142
	 * @return the userTransformationMethod
143
	 */
144
	@Override
145
    public Method getUserTransformationMethod() {
146
		return userTransformationMethod;
147
	}
148

    
149
	/**
150
	 * @param userTransformationMethod the userTransformationMethod to set
151
	 */
152
	@Override
153
    public void setUserTransformationMethod(Method userTransformationMethod) {
154
		this.userTransformationMethod = userTransformationMethod;
155
	}
156

    
157

    
158
	/**
159
	 * @return the limitSave
160
	 */
161
	@Override
162
    public int getRecordsPerTransaction() {
163
		return recordsPerTransaction;
164
	}
165

    
166
	/**
167
	 * @param limitSave the limitSave to set
168
	 */
169
	@Override
170
    public void setRecordsPerTransaction(int recordsPerTransaction) {
171
		this.recordsPerTransaction = recordsPerTransaction;
172
	}
173

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

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

    
188

    
189

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

    
197

    
198

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

    
206

    
207

    
208
	/**
209
	 * @param doNotes the doNotes to set
210
	 */
211
	public void setDoNotes(boolean doNotes) {
212
		this.doNotes = doNotes;
213
	}
214

    
215

    
216

    
217
	/**
218
	 * @return the doNotes
219
	 */
220
	public boolean isDoNotes() {
221
		return doNotes;
222
	}
223

    
224

    
225

    
226
	/**
227
	 * @param doImages the doImages to set
228
	 */
229
	public void setDoImages(boolean doImages) {
230
		this.doImages = doImages;
231
	}
232

    
233

    
234

    
235
	/**
236
	 * @return the doImages
237
	 */
238
	public boolean isDoImages() {
239
		return doImages;
240
	}
241

    
242

    
243
	public boolean isDoOccurrence() {
244
		return doOccurrence;
245
	}
246
	public void setDoOccurrence(boolean doOccurrence) {
247
		this.doOccurrence = doOccurrence;
248
	}
249

    
250

    
251
	public DO_REFERENCES getDoReferences() {
252
		return doReferences;
253
	}
254
	public void setDoReferences(DO_REFERENCES doReferences) {
255
		this.doReferences = doReferences;
256
	}
257

    
258
	public boolean isDoTaxa() {
259
		return doTaxa;
260
	}
261
	public void setDoTaxa(boolean doTaxa) {
262
		this.doTaxa = doTaxa;
263
	}
264

    
265
	public boolean isDoRelTaxa() {
266
		return doRelTaxa;
267
	}
268
	public void setDoRelTaxa(boolean doRelTaxa) {
269
		this.doRelTaxa = doRelTaxa;
270
	}
271

    
272

    
273

    
274
}
(5-5/17)