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
|
* @version 1.0
|
28
|
*/
|
29
|
public class GlobisImportConfigurator extends DbImportConfiguratorBase<GlobisImportState> implements IImportConfigurator{
|
30
|
@SuppressWarnings("unused")
|
31
|
private static Logger logger = Logger.getLogger(GlobisImportConfigurator.class);
|
32
|
|
33
|
public static GlobisImportConfigurator NewInstance(Source ermsSource, ICdmDataSource destination){
|
34
|
return new GlobisImportConfigurator(ermsSource, destination);
|
35
|
}
|
36
|
|
37
|
/* Max number of records to be saved with one service call */
|
38
|
private int recordsPerTransaction = 2000; //defaultValue
|
39
|
|
40
|
//TODO needed ??
|
41
|
private Method userTransformationMethod;
|
42
|
|
43
|
private boolean doImages = true;
|
44
|
private boolean doCurrentTaxa = true;
|
45
|
private boolean doSpecTaxa = true;
|
46
|
private boolean doCommonNames = true;
|
47
|
|
48
|
private boolean doReadMediaData = true;
|
49
|
|
50
|
private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
|
51
|
|
52
|
private String imageBaseUrl = "http://globis-images.insects-online.de/images/";
|
53
|
|
54
|
private static IInputTransformer defaultTransformer = new GlobisTransformer();
|
55
|
|
56
|
protected void makeIoClassList(){
|
57
|
ioClassList = new Class[]{
|
58
|
//ErmsGeneralImportValidator.class
|
59
|
GlobisReferenceImport.class
|
60
|
// , ErmsReferenceImport.class
|
61
|
, GlobisCurrentSpeciesImport.class
|
62
|
, GlobisSpecTaxImport.class
|
63
|
, GlobisImageImport.class
|
64
|
};
|
65
|
}
|
66
|
|
67
|
|
68
|
/* (non-Javadoc)
|
69
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
|
70
|
*/
|
71
|
public GlobisImportState getNewState() {
|
72
|
return new GlobisImportState(this);
|
73
|
}
|
74
|
|
75
|
|
76
|
|
77
|
private GlobisImportConfigurator(Source source, ICdmDataSource destination) {
|
78
|
super(source, destination, NomenclaturalCode.ICZN, defaultTransformer);//default for Globis
|
79
|
}
|
80
|
|
81
|
/**
|
82
|
* @return the limitSave
|
83
|
*/
|
84
|
public int getRecordsPerTransaction() {
|
85
|
return recordsPerTransaction;
|
86
|
}
|
87
|
/**
|
88
|
* @param limitSave the limitSave to set
|
89
|
*/
|
90
|
public void setRecordsPerTransaction(int recordsPerTransaction) {
|
91
|
this.recordsPerTransaction = recordsPerTransaction;
|
92
|
}
|
93
|
|
94
|
|
95
|
/**
|
96
|
* @param doImages the doImages to set
|
97
|
*/
|
98
|
public void setDoImages(boolean doImages) {
|
99
|
this.doImages = doImages;
|
100
|
}
|
101
|
/**
|
102
|
* @return the doImages
|
103
|
*/
|
104
|
public boolean isDoImages() {
|
105
|
return doImages;
|
106
|
}
|
107
|
|
108
|
public DO_REFERENCES getDoReferences() {
|
109
|
return doReferences;
|
110
|
}
|
111
|
public void setDoReferences(DO_REFERENCES doReferences) {
|
112
|
this.doReferences = doReferences;
|
113
|
}
|
114
|
|
115
|
|
116
|
public void setDoCurrentTaxa(boolean doCurrentTaxa) {
|
117
|
this.doCurrentTaxa = doCurrentTaxa;
|
118
|
}
|
119
|
|
120
|
|
121
|
public boolean isDoCurrentTaxa() {
|
122
|
return doCurrentTaxa;
|
123
|
}
|
124
|
|
125
|
|
126
|
public void setDoSpecTaxa(boolean doSpecTaxa) {
|
127
|
this.doSpecTaxa = doSpecTaxa;
|
128
|
}
|
129
|
|
130
|
|
131
|
public boolean isDoSpecTaxa() {
|
132
|
return doSpecTaxa;
|
133
|
}
|
134
|
|
135
|
|
136
|
public void setDoCommonNames(boolean doCommonNames) {
|
137
|
this.doCommonNames = doCommonNames;
|
138
|
}
|
139
|
|
140
|
|
141
|
public boolean isDoCommonNames() {
|
142
|
return doCommonNames;
|
143
|
}
|
144
|
|
145
|
|
146
|
public void setImageBaseUrl(String imageBaseUrl) {
|
147
|
this.imageBaseUrl = imageBaseUrl;
|
148
|
}
|
149
|
|
150
|
|
151
|
public String getImageBaseUrl() {
|
152
|
return imageBaseUrl;
|
153
|
}
|
154
|
|
155
|
|
156
|
public void setDoReadMediaData(boolean doReadMediaData) {
|
157
|
this.doReadMediaData = doReadMediaData;
|
158
|
}
|
159
|
|
160
|
|
161
|
public boolean isDoReadMediaData() {
|
162
|
return doReadMediaData;
|
163
|
}
|
164
|
|
165
|
|
166
|
|
167
|
|
168
|
}
|