Project

General

Profile

Download (5.13 KB) Statistics
| Branch: | Tag: | 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.globis;
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.mapping.IInputTransformer;
22
import eu.etaxonomy.cdm.io.erms.validation.ErmsGeneralImportValidator;
23
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
24
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
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 GlobisImportConfigurator extends ImportConfiguratorBase<GlobisImportState, Source> implements IImportConfigurator{
34
	@SuppressWarnings("unused")
35
	private static Logger logger = Logger.getLogger(GlobisImportConfigurator.class);
36

    
37
	public static GlobisImportConfigurator NewInstance(Source ermsSource, ICdmDataSource destination){
38
			return new GlobisImportConfigurator(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 boolean doOccurrence = true;
52
	
53
	private static IInputTransformer defaultTransformer = new GlobisTransformer();
54
	
55
	protected void makeIoClassList(){
56
		ioClassList = new Class[]{
57
				//ErmsGeneralImportValidator.class
58
				 GlobisReferenceImport.class
59
	//			, ErmsReferenceImport.class
60
//				, GlobisTaxonImport.class
61
		};	
62
	}
63
	
64

    
65
	/* (non-Javadoc)
66
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
67
	 */
68
	public ImportStateBase getNewState() {
69
		return new GlobisImportState(this);
70
	}
71

    
72

    
73

    
74
	private GlobisImportConfigurator(Source source, ICdmDataSource destination) {
75
	   super(defaultTransformer);
76
	   setNomenclaturalCode(NomenclaturalCode.ICZN); //default for ERMS
77
	   setSource(source);
78
	   setDestination(destination);
79
	}
80
	
81
	
82
	public Source getSource() {
83
		return (Source)super.getSource();
84
	}
85
	public void setSource(Source berlinModelSource) {
86
		super.setSource(berlinModelSource);
87
	}
88

    
89
	/* (non-Javadoc)
90
	 * @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#getSourceReference()
91
	 */
92
	public ReferenceBase getSourceReference() {
93
		ReferenceFactory refFactory = ReferenceFactory.newInstance();
94
		if (sourceReference == null){
95
			sourceReference =  refFactory.newDatabase();
96
			if (getSource() != null){
97
				sourceReference.setTitleCache(getSource().getDatabase(), true);
98
			}
99
		}
100
		return sourceReference;
101
	}
102

    
103

    
104
	/* (non-Javadoc)
105
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
106
	 */
107
	public String getSourceNameString() {
108
		if (this.getSource() == null){
109
			return null;
110
		}else{
111
			return this.getSource().getDatabase();
112
		}
113
	}
114

    
115
	/**
116
	 * @return the userTransformationMethod
117
	 */
118
	public Method getUserTransformationMethod() {
119
		return userTransformationMethod;
120
	}
121

    
122
	/**
123
	 * @param userTransformationMethod the userTransformationMethod to set
124
	 */
125
	public void setUserTransformationMethod(Method userTransformationMethod) {
126
		this.userTransformationMethod = userTransformationMethod;
127
	}
128

    
129
	
130
	/**
131
	 * @return the limitSave
132
	 */
133
	public int getRecordsPerTransaction() {
134
		return recordsPerTransaction;
135
	}
136

    
137
	/**
138
	 * @param limitSave the limitSave to set
139
	 */
140
	public void setRecordsPerTransaction(int recordsPerTransaction) {
141
		this.recordsPerTransaction = recordsPerTransaction;
142
	}
143

    
144
	/**
145
	 * @param doVernaculars the doVernaculars to set
146
	 */
147
	public void setDoVernaculars(boolean doVernaculars) {
148
		this.doVernaculars = doVernaculars;
149
	}
150

    
151
	/**
152
	 * @return the doVernaculars
153
	 */
154
	public boolean isDoVernaculars() {
155
		return doVernaculars;
156
	}
157

    
158

    
159

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

    
167

    
168

    
169
	/**
170
	 * @return the doLinks
171
	 */
172
	public boolean isDoLinks() {
173
		return doLinks;
174
	}
175

    
176

    
177

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

    
185

    
186

    
187
	/**
188
	 * @return the doNotes
189
	 */
190
	public boolean isDoNotes() {
191
		return doNotes;
192
	}
193

    
194

    
195

    
196
	/**
197
	 * @param doImages the doImages to set
198
	 */
199
	public void setDoImages(boolean doImages) {
200
		this.doImages = doImages;
201
	}
202

    
203

    
204

    
205
	/**
206
	 * @return the doImages
207
	 */
208
	public boolean isDoImages() {
209
		return doImages;
210
	}
211
	
212
	
213
	public boolean isDoOccurrence() {
214
		return doOccurrence;
215
	}
216
	public void setDoOccurrence(boolean doOccurrence) {
217
		this.doOccurrence = doOccurrence;
218
	}
219

    
220
	
221

    
222
}
(2-2/5)