Project

General

Profile

Download (4.33 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.DbImportConfiguratorBase;
18
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
19
import eu.etaxonomy.cdm.io.common.Source;
20
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
21
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
22

    
23

    
24
/**
25
 * @author a.mueller
26
 * @created 20.03.2008
27
 */
28
public class GlobisImportConfigurator extends DbImportConfiguratorBase<GlobisImportState> implements IImportConfigurator{
29
	@SuppressWarnings("unused")
30
	private static Logger logger = Logger.getLogger(GlobisImportConfigurator.class);
31

    
32
	public static GlobisImportConfigurator NewInstance(Source ermsSource, ICdmDataSource destination){
33
			return new GlobisImportConfigurator(ermsSource, destination);
34
	}
35

    
36
	/* Max number of records to be saved with one service call */
37
	private int recordsPerTransaction = 2000;  //defaultValue
38

    
39
	//TODO needed ??
40
	private Method userTransformationMethod;
41
	
42
	
43
	private boolean doAuthors = true;
44
	private boolean doImages = true;
45
	private boolean doCurrentTaxa = true;
46
	private boolean doSpecTaxa = true;
47
	private boolean doCommonNames = true;
48
	
49
	private boolean doReadMediaData = true;
50
	
51
	private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
52

    
53
	private String imageBaseUrl = "http://globis-images.insects-online.de/images/";
54
	
55
	private static IInputTransformer defaultTransformer = new GlobisTransformer();
56
	public boolean isDoNewUser() {
57
		return doNewUser;
58
	}
59

    
60

    
61
	public void setDoNewUser(boolean doNewUser) {
62
		this.doNewUser = doNewUser;
63
	}
64

    
65
	private boolean doNewUser = true;
66
	
67
	protected void makeIoClassList(){
68
		ioClassList = new Class[]{
69
				 GlobisAuthorImport.class,
70
				 GlobisReferenceImport.class
71
	//			, ErmsReferenceImport.class
72
				, GlobisCurrentSpeciesImport.class
73
				, GlobisSpecTaxImport.class
74
				, GlobisCommonNameImport.class
75
				, GlobisImageImport.class
76
		};	
77
	}
78
	
79

    
80
	/* (non-Javadoc)
81
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
82
	 */
83
	public GlobisImportState getNewState() {
84
		return new GlobisImportState(this);
85
	}
86

    
87

    
88

    
89
	private GlobisImportConfigurator(Source source, ICdmDataSource destination) {
90
	   super(source, destination, NomenclaturalCode.ICZN, defaultTransformer);//default for Globis
91
	}
92
	
93
	/**
94
	 * @return the limitSave
95
	 */
96
	public int getRecordsPerTransaction() {
97
		return recordsPerTransaction;
98
	}
99
	/**
100
	 * @param limitSave the limitSave to set
101
	 */
102
	public void setRecordsPerTransaction(int recordsPerTransaction) {
103
		this.recordsPerTransaction = recordsPerTransaction;
104
	}
105

    
106

    
107
	/**
108
	 * @param doImages the doImages to set
109
	 */
110
	public void setDoImages(boolean doImages) {
111
		this.doImages = doImages;
112
	}
113
	/**
114
	 * @return the doImages
115
	 */
116
	public boolean isDoImages() {
117
		return doImages;
118
	}
119
	
120
	public DO_REFERENCES getDoReferences() {
121
		return doReferences;
122
	}
123
	public void setDoReferences(DO_REFERENCES doReferences) {
124
		this.doReferences = doReferences;
125
	}
126

    
127

    
128
	public void setDoCurrentTaxa(boolean doCurrentTaxa) {
129
		this.doCurrentTaxa = doCurrentTaxa;
130
	}
131

    
132

    
133
	public boolean isDoCurrentTaxa() {
134
		return doCurrentTaxa;
135
	}
136

    
137

    
138
	public void setDoSpecTaxa(boolean doSpecTaxa) {
139
		this.doSpecTaxa = doSpecTaxa;
140
	}
141

    
142

    
143
	public boolean isDoSpecTaxa() {
144
		return doSpecTaxa;
145
	}
146

    
147

    
148
	public void setDoCommonNames(boolean doCommonNames) {
149
		this.doCommonNames = doCommonNames;
150
	}
151

    
152

    
153
	public boolean isDoCommonNames() {
154
		return doCommonNames;
155
	}
156

    
157

    
158
	public void setImageBaseUrl(String imageBaseUrl) {
159
		this.imageBaseUrl = imageBaseUrl;
160
	}
161

    
162

    
163
	public String getImageBaseUrl() {
164
		return imageBaseUrl;
165
	}
166

    
167

    
168
	public void setDoReadMediaData(boolean doReadMediaData) {
169
		this.doReadMediaData = doReadMediaData;
170
	}
171

    
172

    
173
	public boolean isDoReadMediaData() {
174
		return doReadMediaData;
175
	}
176

    
177

    
178
	public boolean isDoAuthors() {
179
		return doAuthors;
180
	}
181

    
182

    
183
	public void setDoAuthors(boolean doAuthors) {
184
		this.doAuthors = doAuthors;
185
	}
186

    
187
}
(6-6/10)