Revision b0033901
Added by Patrick Plitzner over 7 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportClassification.java | ||
---|---|---|
89 | 89 |
makeClassification("Rothmaler", RedListUtil.uuidClassificationR, "Rothmaler", 2011, RedListUtil.uuidClassificationReferenceR, state); |
90 | 90 |
makeClassification("Oberdorfer", RedListUtil.uuidClassificationO, "Oberdorfer", 2001, RedListUtil.uuidClassificationReferenceO, state); |
91 | 91 |
makeClassification("Schmeil-Fitschen", RedListUtil.uuidClassificationS, "Schmeil-Fitschen", 2011, RedListUtil.uuidClassificationReferenceS, state); |
92 |
importFamilies(gesamtListe, checkliste, state); |
|
92 |
// importFamilies(gesamtListe, checkliste, state);
|
|
93 | 93 |
super.doInvoke(state); |
94 | 94 |
} |
95 | 95 |
|
96 | 96 |
|
97 | 97 |
private void importFamilies(Classification gesamtListe, Classification checkliste, RedListGefaesspflanzenImportState state) { |
98 |
for(UUID uuid:state.getFamilyMap().values()){ |
|
98 |
for(UUID uuid:state.getFamilyMapGesamtListe().values()){
|
|
99 | 99 |
Taxon familyGL = HibernateProxyHelper.deproxy(getTaxonService().load(uuid, Arrays.asList(new String[]{"*"})), Taxon.class); |
100 | 100 |
Taxon familyCL = (Taxon) familyGL.clone(); |
101 | 101 |
getTaxonService().saveOrUpdate(familyCL); |
102 | 102 |
|
103 |
gesamtListe.addChildTaxon(familyGL, null, null);
|
|
103 |
gesamtListe.addParentChild(null, familyGL, null, null);
|
|
104 | 104 |
familyGL.setSec(gesamtListe.getReference()); |
105 | 105 |
familyGL.setTitleCache(null); |
106 | 106 |
|
107 |
checkliste.addChildTaxon(familyCL, null, null);
|
|
107 |
checkliste.addParentChild(null, familyCL, null, null);
|
|
108 | 108 |
familyCL.setSec(checkliste.getReference()); |
109 | 109 |
familyCL.setTitleCache(null); |
110 | 110 |
|
... | ... | |
184 | 184 |
RedListUtil.logMessage(id, taxonBaseGL+" has no parent but is not a taxon.", logger); |
185 | 185 |
} |
186 | 186 |
else{ |
187 |
Taxon family = (Taxon) state.getRelatedObject(RedListUtil.FAMILY_NAMESPACE, familieString); |
|
187 |
Taxon family = (Taxon) state.getRelatedObject(RedListUtil.FAMILY_NAMESPACE_GESAMTLISTE, familieString);
|
|
188 | 188 |
gesamtListeClassification.addParentChild(family, HibernateProxyHelper.deproxy(taxonBaseGL, Taxon.class), null, null); |
189 |
if(family.getTaxonNodes().isEmpty()){ |
|
190 |
gesamtListeClassification.addChildTaxon(family, null, null); |
|
191 |
} |
|
189 | 192 |
} |
190 | 193 |
} |
191 | 194 |
//add to higher taxon |
... | ... | |
206 | 209 |
RedListUtil.logMessage(id, taxonBaseCL+" has no parent but is not a taxon.", logger); |
207 | 210 |
} |
208 | 211 |
else{ |
209 |
Taxon family = (Taxon) state.getRelatedObject(RedListUtil.FAMILY_NAMESPACE, familieString); |
|
212 |
Taxon family = (Taxon) state.getRelatedObject(RedListUtil.FAMILY_NAMESPACE_CHECKLISTE, familieString);
|
|
210 | 213 |
checklistClassification.addParentChild(family, HibernateProxyHelper.deproxy(taxonBaseCL, Taxon.class), null, null); |
214 |
if(family.getTaxonNodes().isEmpty()){ |
|
215 |
checklistClassification.addChildTaxon(family, null, null); |
|
216 |
} |
|
211 | 217 |
} |
212 | 218 |
} |
213 | 219 |
//add to higher taxon |
... | ... | |
378 | 384 |
result.put(RedListUtil.CLASSIFICATION_NAMESPACE_S, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_S)); |
379 | 385 |
|
380 | 386 |
//add families |
381 |
Map<String, Taxon> familyMap = new HashMap<String, Taxon>(); |
|
382 |
for (Entry<String, UUID> entry: state.getFamilyMap().entrySet()) { |
|
383 |
familyMap.put(entry.getKey(), HibernateProxyHelper.deproxy(getTaxonService().load(entry.getValue()), Taxon.class)); |
|
387 |
//gesamtliste |
|
388 |
Map<String, Taxon> familyMapGL = new HashMap<String, Taxon>(); |
|
389 |
for (Entry<String, UUID> entry: state.getFamilyMapGesamtListe().entrySet()) { |
|
390 |
familyMapGL.put(entry.getKey(), HibernateProxyHelper.deproxy(getTaxonService().load(entry.getValue()), Taxon.class)); |
|
391 |
} |
|
392 |
result.put(RedListUtil.FAMILY_NAMESPACE_GESAMTLISTE, familyMapGL); |
|
393 |
//checkliste |
|
394 |
Map<String, Taxon> familyMapCL = new HashMap<String, Taxon>(); |
|
395 |
for (Entry<String, UUID> entry: state.getFamilyMapCheckliste().entrySet()) { |
|
396 |
familyMapCL.put(entry.getKey(), HibernateProxyHelper.deproxy(getTaxonService().load(entry.getValue()), Taxon.class)); |
|
384 | 397 |
} |
385 |
result.put(RedListUtil.FAMILY_NAMESPACE, familyMap);
|
|
398 |
result.put(RedListUtil.FAMILY_NAMESPACE_CHECKLISTE, familyMapCL);
|
|
386 | 399 |
return result; |
387 | 400 |
} |
388 | 401 |
|
Also available in: Unified diff
#5448 Improve import of families