Revision 4d95eb5a
Added by Andreas Müller about 10 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisCommonNameImport.java | ||
---|---|---|
40 | 40 |
/** |
41 | 41 |
* @author a.mueller |
42 | 42 |
* @created 20.02.2010 |
43 |
* @version 1.0 |
|
43 |
* |
|
44 |
* OPEN ISSUES: |
|
45 |
* |
|
46 |
* ... |
|
44 | 47 |
*/ |
45 | 48 |
@Component |
46 | 49 |
public class GlobisCommonNameImport extends GlobisImportBase<Taxon> { |
... | ... | |
49 | 52 |
private int modCount = 10000; |
50 | 53 |
private static final String pluralString = "common names"; |
51 | 54 |
private static final String dbTableName = "species_language"; |
52 |
private static final Class cdmTargetClass = Taxon.class; //not needed |
|
55 |
private static final Class<?> cdmTargetClass = Taxon.class; //not needed
|
|
53 | 56 |
|
54 | 57 |
public GlobisCommonNameImport(){ |
55 | 58 |
super(pluralString, dbTableName, cdmTargetClass); |
... | ... | |
58 | 61 |
//dirty but acceptable for globis environment |
59 | 62 |
private Map<Integer,Reference> refMap = new HashMap<Integer,Reference>(); |
60 | 63 |
|
61 |
|
|
62 |
/* (non-Javadoc) |
|
63 |
* @see eu.etaxonomy.cdm.io.globis.GlobisImportBase#getIdQuery() |
|
64 |
*/ |
|
65 | 64 |
@Override |
66 | 65 |
protected String getIdQuery() { |
67 | 66 |
String strRecordQuery = |
... | ... | |
71 | 70 |
} |
72 | 71 |
|
73 | 72 |
|
74 |
|
|
75 |
|
|
76 |
/* (non-Javadoc) |
|
77 |
* @see eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportBase#getRecordQuery(eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator) |
|
78 |
*/ |
|
79 | 73 |
@Override |
80 | 74 |
protected String getRecordQuery(GlobisImportConfigurator config) { |
81 | 75 |
String strRecordQuery = |
... | ... | |
85 | 79 |
return strRecordQuery; |
86 | 80 |
} |
87 | 81 |
|
88 |
|
|
89 |
|
|
90 |
/* (non-Javadoc) |
|
91 |
* @see eu.etaxonomy.cdm.io.globis.GlobisImportBase#doPartition(eu.etaxonomy.cdm.io.common.ResultSetPartitioner, eu.etaxonomy.cdm.io.globis.GlobisImportState) |
|
92 |
*/ |
|
93 | 82 |
@Override |
94 | 83 |
public boolean doPartition(ResultSetPartitioner partitioner, GlobisImportState state) { |
95 | 84 |
boolean success = true; |
... | ... | |
174 | 163 |
} |
175 | 164 |
|
176 | 165 |
|
177 |
|
|
178 | 166 |
private Map<String,Language> languageMap = new HashMap<String,Language>(); |
179 | 167 |
private Language getLanguage(String isoLang) { |
180 | 168 |
Language result = languageMap.get(isoLang); |
... | ... | |
203 | 191 |
String details = rs.getString("Details"); |
204 | 192 |
Integer year = nullSafeInt(rs, "year"); |
205 | 193 |
result = ReferenceFactory.newGeneric(); |
206 |
result.setTitleCache(details); |
|
194 |
result.setTitleCache(details, true);
|
|
207 | 195 |
result.setTitle(title); |
208 | 196 |
result.setDatePublished(TimePeriod.NewInstance(year)); |
209 | 197 |
|
... | ... | |
233 | 221 |
return result; |
234 | 222 |
} |
235 | 223 |
|
236 |
|
|
237 |
|
|
238 |
|
|
239 | 224 |
private Person makeSingleAuthor(String authors) { |
240 | 225 |
Person result = Person.NewTitledInstance(authors); |
241 | 226 |
return result; |
242 | 227 |
} |
243 | 228 |
|
244 |
|
|
245 |
|
|
246 |
|
|
247 |
/* (non-Javadoc) |
|
248 |
* @see eu.etaxonomy.cdm.io.berlinModel.in.IPartitionedIO#getRelatedObjectsForPartition(java.sql.ResultSet) |
|
249 |
*/ |
|
229 |
@Override |
|
250 | 230 |
public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs) { |
251 | 231 |
String nameSpace; |
252 |
Class cdmClass; |
|
232 |
Class<?> cdmClass;
|
|
253 | 233 |
Set<String> idSet; |
254 | 234 |
Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<Object, Map<String, ? extends CdmBase>>(); |
255 | 235 |
try{ |
... | ... | |
273 | 253 |
return result; |
274 | 254 |
} |
275 | 255 |
|
276 |
/* (non-Javadoc) |
|
277 |
* @see eu.etaxonomy.cdm.io.common.CdmIoBase#doCheck(eu.etaxonomy.cdm.io.common.IImportConfigurator) |
|
278 |
*/ |
|
256 |
|
|
279 | 257 |
@Override |
280 | 258 |
protected boolean doCheck(GlobisImportState state){ |
281 | 259 |
// IOValidator<GlobisImportState> validator = new GlobisCurrentSpeciesImportValidator(); |
282 | 260 |
return true; |
283 | 261 |
} |
284 | 262 |
|
285 |
|
|
286 |
/* (non-Javadoc) |
|
287 |
* @see eu.etaxonomy.cdm.io.common.CdmIoBase#isIgnore(eu.etaxonomy.cdm.io.common.IImportConfigurator) |
|
288 |
*/ |
|
263 |
@Override |
|
289 | 264 |
protected boolean isIgnore(GlobisImportState state){ |
290 | 265 |
return ! state.getConfig().isDoCommonNames(); |
291 | 266 |
} |
Also available in: Unified diff
minor changes and cleanup in globis import