Project

General

Profile

Download (5.05 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.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.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
 * @created 20.03.2008
30
 * @version 1.0
31
 */
32
public class GlobisImportConfigurator extends ImportConfiguratorBase<GlobisImportState, Source> implements IImportConfigurator{
33
	@SuppressWarnings("unused")
34
	private static Logger logger = Logger.getLogger(GlobisImportConfigurator.class);
35

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

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

    
43
	//TODO needed ??
44
	private Method userTransformationMethod;
45
	
46
	private boolean doVernaculars = true;
47
	private boolean doLinks = true;
48
	private boolean doNotes = true;
49
	private boolean doImages = true;
50
	private boolean doOccurrence = true;
51
	
52
	private static IInputTransformer defaultTransformer = new GlobisTransformer();
53
	
54
	protected void makeIoClassList(){
55
		ioClassList = new Class[]{
56
				//ErmsGeneralImportValidator.class
57
				 GlobisReferenceImport.class
58
	//			, ErmsReferenceImport.class
59
//				, GlobisTaxonImport.class
60
		};	
61
	}
62
	
63

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

    
71

    
72

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

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

    
102

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

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

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

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

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

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

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

    
157

    
158

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

    
166

    
167

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

    
175

    
176

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

    
184

    
185

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

    
193

    
194

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

    
202

    
203

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

    
219
	
220

    
221
}
(2-2/5)