Project

General

Profile

Download (4.69 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 = 2000;  //defaultValue
42

    
43
	//TODO needed ??
44
	private Method userTransformationMethod;
45
	
46
	private boolean doImages = true;
47
	private boolean doCurrentTaxa = true;
48
	private boolean doSpecTaxa = true;
49
	private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
50

    
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
				, GlobisCurrentSpeciesImport.class
60
				, GlobisSpecTaxImport.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 Reference 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
	 * @param limitSave the limitSave to set
138
	 */
139
	public void setRecordsPerTransaction(int recordsPerTransaction) {
140
		this.recordsPerTransaction = recordsPerTransaction;
141
	}
142

    
143

    
144
	/**
145
	 * @param doImages the doImages to set
146
	 */
147
	public void setDoImages(boolean doImages) {
148
		this.doImages = doImages;
149
	}
150
	/**
151
	 * @return the doImages
152
	 */
153
	public boolean isDoImages() {
154
		return doImages;
155
	}
156
	
157
	public DO_REFERENCES getDoReferences() {
158
		return doReferences;
159
	}
160
	public void setDoReferences(DO_REFERENCES doReferences) {
161
		this.doReferences = doReferences;
162
	}
163

    
164

    
165
	public void setDoCurrentTaxa(boolean doCurrentTaxa) {
166
		this.doCurrentTaxa = doCurrentTaxa;
167
	}
168

    
169

    
170
	public boolean isDoCurrentTaxa() {
171
		return doCurrentTaxa;
172
	}
173

    
174

    
175
	public void setDoSpecTaxa(boolean doSpecTaxa) {
176
		this.doSpecTaxa = doSpecTaxa;
177
	}
178

    
179

    
180
	public boolean isDoSpecTaxa() {
181
		return doSpecTaxa;
182
	}
183

    
184

    
185
	
186

    
187
}
(4-4/9)