Revision b313991f
Added by Andreas Müller over 4 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/edaphobase/EdaphobaseClassificationImport.java | ||
---|---|---|
76 | 76 |
|
77 | 77 |
|
78 | 78 |
@Override |
79 |
public boolean doPartition(ResultSetPartitioner partitioner, EdaphobaseImportState state) { |
|
79 |
public boolean doPartition(@SuppressWarnings("rawtypes") ResultSetPartitioner partitioner, EdaphobaseImportState state) {
|
|
80 | 80 |
ResultSet rs = partitioner.getResultSet(); |
81 |
@SuppressWarnings("unchecked") |
|
81 | 82 |
Map<String, Classification> map = partitioner.getObjectMap(CLASSIFICATION_NAMESPACE); |
82 | 83 |
Classification classification = map.get(state.getConfig().getClassificationUuid().toString()); |
83 | 84 |
|
85 |
@SuppressWarnings("rawtypes") |
|
84 | 86 |
Set<TaxonBase> taxaToSave = new HashSet<>(); |
85 | 87 |
try { |
86 | 88 |
while (rs.next()){ |
... | ... | |
94 | 96 |
return true; |
95 | 97 |
} |
96 | 98 |
|
97 |
/** |
|
98 |
* @param state |
|
99 |
* @param rs |
|
100 |
* @param taxaToSave |
|
101 |
* @param classification |
|
102 |
* @throws SQLException |
|
103 |
*/ |
|
104 |
private void handleSingleRecord(EdaphobaseImportState state, ResultSet rs, Classification classification, Set<TaxonBase> taxaToSave) throws SQLException { |
|
99 |
private void handleSingleRecord(EdaphobaseImportState state, ResultSet rs, Classification classification, |
|
100 |
@SuppressWarnings("rawtypes") Set<TaxonBase> taxaToSave) throws SQLException { |
|
105 | 101 |
Reference sourceReference = state.getTransactionalSourceReference(); |
106 | 102 |
|
107 | 103 |
int id = rs.getInt("taxon_id"); |
... | ... | |
176 | 172 |
@Override |
177 | 173 |
public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs, |
178 | 174 |
EdaphobaseImportState state) { |
175 |
|
|
179 | 176 |
String nameSpace; |
180 |
Class<?> cdmClass; |
|
181 | 177 |
Set<String> idSet; |
182 | 178 |
Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<>(); |
183 | 179 |
|
184 | 180 |
try{ |
185 |
Set<String> taxonIdSet = new HashSet<String>();
|
|
181 |
Set<String> taxonIdSet = new HashSet<>(); |
|
186 | 182 |
while (rs.next()){ |
187 | 183 |
handleForeignKey(rs, taxonIdSet, "taxon_id"); |
188 | 184 |
handleForeignKey(rs, taxonIdSet, "parent_taxon_fk"); |
... | ... | |
190 | 186 |
|
191 | 187 |
//name map |
192 | 188 |
nameSpace = TAXON_NAMESPACE; |
193 |
cdmClass = TaxonBase.class; |
|
194 | 189 |
idSet = taxonIdSet; |
195 |
Map<String, TaxonBase> taxonMap = (Map<String, TaxonBase>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace); |
|
190 |
@SuppressWarnings("rawtypes") |
|
191 |
Map<String, TaxonBase> taxonMap = getCommonService().getSourcedObjectsByIdInSourceC(TaxonBase.class, idSet, nameSpace); |
|
196 | 192 |
result.put(nameSpace, taxonMap); |
197 | 193 |
|
198 | 194 |
//Classification |
Also available in: Unified diff
adapt some classes to new CommonService.getSourcedObjectSByIdInSource and cleanup