Revision e0935f63
Added by Andreas Müller over 4 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisCommonNameImport.java | ||
---|---|---|
47 | 47 |
*/ |
48 | 48 |
@Component |
49 | 49 |
public class GlobisCommonNameImport extends GlobisImportBase<Taxon> { |
50 |
private static final Logger logger = Logger.getLogger(GlobisCommonNameImport.class); |
|
50 |
|
|
51 |
private static final long serialVersionUID = 2462539699442149049L; |
|
52 |
private static final Logger logger = Logger.getLogger(GlobisCommonNameImport.class); |
|
51 | 53 |
|
52 | 54 |
private int modCount = 10000; |
53 | 55 |
private static final String pluralString = "common names"; |
... | ... | |
80 | 82 |
} |
81 | 83 |
|
82 | 84 |
@Override |
83 |
public boolean doPartition(ResultSetPartitioner partitioner, GlobisImportState state) { |
|
85 |
public boolean doPartition(@SuppressWarnings("rawtypes") ResultSetPartitioner partitioner, GlobisImportState state) {
|
|
84 | 86 |
boolean success = true; |
85 | 87 |
|
86 |
Set<TaxonBase> objectsToSave = new HashSet<TaxonBase>(); |
|
88 |
@SuppressWarnings("rawtypes") |
|
89 |
Set<TaxonBase> objectsToSave = new HashSet<>(); |
|
87 | 90 |
|
88 |
Map<String, Taxon> taxonMap = partitioner.getObjectMap(TAXON_NAMESPACE); |
|
91 |
@SuppressWarnings("unchecked") |
|
92 |
Map<String, Taxon> taxonMap = partitioner.getObjectMap(TAXON_NAMESPACE); |
|
89 | 93 |
|
90 | 94 |
ResultSet rs = partitioner.getResultSet(); |
91 | 95 |
|
... | ... | |
159 | 163 |
} |
160 | 164 |
} |
161 | 165 |
|
162 |
|
|
163 |
private Map<String,Language> languageMap = new HashMap<String,Language>(); |
|
166 |
private Map<String,Language> languageMap = new HashMap<>(); |
|
164 | 167 |
private Language getLanguage(String isoLang) { |
165 | 168 |
Language result = languageMap.get(isoLang); |
166 | 169 |
if (result == null){ |
... | ... | |
229 | 232 |
@Override |
230 | 233 |
public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs, GlobisImportState state) { |
231 | 234 |
String nameSpace; |
232 |
Class<?> cdmClass; |
|
233 | 235 |
Set<String> idSet; |
234 |
Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<Object, Map<String, ? extends CdmBase>>();
|
|
236 |
Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<>(); |
|
235 | 237 |
try{ |
236 |
Set<String> taxonIdSet = new HashSet<String>();
|
|
238 |
Set<String> taxonIdSet = new HashSet<>(); |
|
237 | 239 |
|
238 | 240 |
while (rs.next()){ |
239 | 241 |
handleForeignKey(rs, taxonIdSet, "IDCurrentSpec"); |
... | ... | |
241 | 243 |
|
242 | 244 |
//taxon map |
243 | 245 |
nameSpace = TAXON_NAMESPACE; |
244 |
cdmClass = Taxon.class; |
|
245 | 246 |
idSet = taxonIdSet; |
246 |
Map<String, Taxon> objectMap = (Map<String, Taxon>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);
|
|
247 |
Map<String, Taxon> objectMap = getCommonService().getSourcedObjectsByIdInSourceC(Taxon.class, idSet, nameSpace);
|
|
247 | 248 |
result.put(nameSpace, objectMap); |
248 | 249 |
|
249 | 250 |
|
... | ... | |
253 | 254 |
return result; |
254 | 255 |
} |
255 | 256 |
|
256 |
|
|
257 | 257 |
@Override |
258 |
protected boolean doCheck(GlobisImportState state){
|
|
258 |
protected boolean doCheck(GlobisImportState state){
|
|
259 | 259 |
// IOValidator<GlobisImportState> validator = new GlobisCurrentSpeciesImportValidator(); |
260 | 260 |
return true; |
261 | 261 |
} |
... | ... | |
264 | 264 |
protected boolean isIgnore(GlobisImportState state){ |
265 | 265 |
return ! state.getConfig().isDoCommonNames(); |
266 | 266 |
} |
267 |
|
|
268 |
|
|
269 |
|
|
270 |
|
|
271 |
|
|
272 | 267 |
} |
Also available in: Unified diff
adapt some classes to new CommonService.getSourcedObjectSByIdInSourceC and cleanup