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.redlist.gefaesspflanzen;
|
11
|
|
12
|
import java.sql.ResultSet;
|
13
|
import java.sql.SQLException;
|
14
|
import java.util.Arrays;
|
15
|
import java.util.HashMap;
|
16
|
import java.util.HashSet;
|
17
|
import java.util.Map;
|
18
|
import java.util.Map.Entry;
|
19
|
import java.util.Set;
|
20
|
import java.util.UUID;
|
21
|
|
22
|
import org.apache.log4j.Logger;
|
23
|
import org.springframework.stereotype.Component;
|
24
|
|
25
|
import eu.etaxonomy.cdm.common.CdmUtils;
|
26
|
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
|
27
|
import eu.etaxonomy.cdm.io.common.DbImportBase;
|
28
|
import eu.etaxonomy.cdm.io.common.IPartitionedIO;
|
29
|
import eu.etaxonomy.cdm.io.common.ResultSetPartitioner;
|
30
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
31
|
import eu.etaxonomy.cdm.model.common.Language;
|
32
|
import eu.etaxonomy.cdm.model.common.TimePeriod;
|
33
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
34
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
35
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
36
|
import eu.etaxonomy.cdm.model.taxon.Synonym;
|
37
|
import eu.etaxonomy.cdm.model.taxon.SynonymType;
|
38
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
39
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
40
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
|
41
|
|
42
|
/**
|
43
|
*
|
44
|
* @author pplitzner
|
45
|
* @since Mar 1, 2016
|
46
|
*
|
47
|
*/
|
48
|
|
49
|
@Component
|
50
|
@SuppressWarnings("serial")
|
51
|
public class RedListGefaesspflanzenImportClassification extends DbImportBase<RedListGefaesspflanzenImportState, RedListGefaesspflanzenImportConfigurator> {
|
52
|
|
53
|
private static final Logger logger = Logger.getLogger(RedListGefaesspflanzenImportClassification.class);
|
54
|
|
55
|
private static final String tableName = "Rote Liste Gefäßpflanzen";
|
56
|
|
57
|
private static final String pluralString = "classifications";
|
58
|
|
59
|
public RedListGefaesspflanzenImportClassification() {
|
60
|
super(tableName, pluralString);
|
61
|
}
|
62
|
|
63
|
@Override
|
64
|
protected String getIdQuery(RedListGefaesspflanzenImportState state) {
|
65
|
return "SELECT SEQNUM "
|
66
|
+ "FROM V_TAXATLAS_D20_EXPORT t "
|
67
|
+ " ORDER BY SEQNUM";
|
68
|
}
|
69
|
|
70
|
@Override
|
71
|
protected String getRecordQuery(RedListGefaesspflanzenImportConfigurator config) {
|
72
|
String result = "select distinct e.*, f.FAMILIE "
|
73
|
+ "from V_TAXATLAS_D20_EXPORT e, GATTUNG_FAMILIE f "
|
74
|
+ "where e.EPI1 = f.GATTUNG and e.SEQNUM IN (@IDSET)";
|
75
|
result = result.replace("@IDSET", IPartitionedIO.ID_LIST_TOKEN);
|
76
|
return result;
|
77
|
}
|
78
|
|
79
|
@Override
|
80
|
protected void doInvoke(RedListGefaesspflanzenImportState state) {
|
81
|
Classification gesamtListe = makeClassification("Gesamtliste", state.getConfig().getClassificationUuid(), "Gesamtliste", null, RedListUtil.gesamtListeReferenceUuid, state);
|
82
|
Classification checkliste = makeClassification("Checkliste", RedListUtil.checkListClassificationUuid, "Checkliste", null, RedListUtil.checkListReferenceUuid, state);
|
83
|
makeClassification("Ehrendorfer", RedListUtil.uuidClassificationE, "Ehrendorfer", null, RedListUtil.uuidClassificationReferenceE, state);
|
84
|
makeClassification("Wisskirchen (Standardliste)", RedListUtil.uuidClassificationW, "Wisskirchen (Standardliste)", 1998, RedListUtil.uuidClassificationReferenceW, state);
|
85
|
makeClassification("Korneck (Rote Liste)", RedListUtil.uuidClassificationK, "Korneck (Rote Liste)", 1996, RedListUtil.uuidClassificationReferenceK, state);
|
86
|
makeClassification("Atlas (Westdeutschland)", RedListUtil.uuidClassificationAW, "Atlas (Westdeutschland)", 1988, RedListUtil.uuidClassificationReferenceAW, state);
|
87
|
makeClassification("Atlas (Ostdeutschland)", RedListUtil.uuidClassificationAO, "Atlas (Ostdeutschland)", 1996, RedListUtil.uuidClassificationReferenceAO, state);
|
88
|
makeClassification("Rothmaler", RedListUtil.uuidClassificationR, "Rothmaler", 2011, RedListUtil.uuidClassificationReferenceR, state);
|
89
|
makeClassification("Oberdorfer", RedListUtil.uuidClassificationO, "Oberdorfer", 2001, RedListUtil.uuidClassificationReferenceO, state);
|
90
|
makeClassification("Schmeil-Fitschen", RedListUtil.uuidClassificationS, "Schmeil-Fitschen", 2011, RedListUtil.uuidClassificationReferenceS, state);
|
91
|
importFamilies(gesamtListe, checkliste, state);
|
92
|
super.doInvoke(state);
|
93
|
}
|
94
|
|
95
|
|
96
|
private void importFamilies(Classification gesamtListe, Classification checkliste, RedListGefaesspflanzenImportState state) {
|
97
|
for(UUID uuid:state.getFamilyMap().values()){
|
98
|
Taxon family = HibernateProxyHelper.deproxy(getTaxonService().load(uuid, Arrays.asList(new String[]{"*"})), Taxon.class);
|
99
|
|
100
|
gesamtListe.addParentChild(null, family, null, null);
|
101
|
checkliste.addParentChild(null, family, null, null);
|
102
|
family.setSec(gesamtListe.getReference());
|
103
|
family.setTitleCache(null);
|
104
|
|
105
|
getClassificationService().saveOrUpdate(gesamtListe);
|
106
|
getClassificationService().saveOrUpdate(checkliste);
|
107
|
}
|
108
|
}
|
109
|
|
110
|
@Override
|
111
|
public boolean doPartition(ResultSetPartitioner partitioner, RedListGefaesspflanzenImportState state) {
|
112
|
ResultSet rs = partitioner.getResultSet();
|
113
|
Classification gesamtListeClassification = getClassificationService().load(state.getConfig().getClassificationUuid());
|
114
|
Classification checklistClassification = getClassificationService().load(RedListUtil.checkListClassificationUuid);
|
115
|
Classification classificationE = getClassificationService().load(RedListUtil.uuidClassificationE);
|
116
|
Classification classificationW = getClassificationService().load(RedListUtil.uuidClassificationW);
|
117
|
Classification classificationK = getClassificationService().load(RedListUtil.uuidClassificationK);
|
118
|
Classification classificationAW = getClassificationService().load(RedListUtil.uuidClassificationAW);
|
119
|
Classification classificationAO = getClassificationService().load(RedListUtil.uuidClassificationAO);
|
120
|
Classification classificationR = getClassificationService().load(RedListUtil.uuidClassificationR);
|
121
|
Classification classificationO = getClassificationService().load(RedListUtil.uuidClassificationO);
|
122
|
Classification classificationS = getClassificationService().load(RedListUtil.uuidClassificationS);
|
123
|
try {
|
124
|
while (rs.next()){
|
125
|
makeSingleTaxonNode(state, rs, gesamtListeClassification, checklistClassification,
|
126
|
classificationE, classificationW, classificationK, classificationAW
|
127
|
, classificationAO, classificationR, classificationO, classificationS);
|
128
|
|
129
|
}
|
130
|
} catch (SQLException e) {
|
131
|
e.printStackTrace();
|
132
|
}
|
133
|
|
134
|
logger.info("Update classification (1000 nodes)");
|
135
|
getClassificationService().saveOrUpdate(gesamtListeClassification);
|
136
|
getClassificationService().saveOrUpdate(checklistClassification);
|
137
|
getClassificationService().saveOrUpdate(classificationE);
|
138
|
getClassificationService().saveOrUpdate(classificationW);
|
139
|
getClassificationService().saveOrUpdate(classificationK);
|
140
|
getClassificationService().saveOrUpdate(classificationAW);
|
141
|
getClassificationService().saveOrUpdate(classificationAO);
|
142
|
getClassificationService().saveOrUpdate(classificationR);
|
143
|
getClassificationService().saveOrUpdate(classificationO);
|
144
|
getClassificationService().saveOrUpdate(classificationS);
|
145
|
return true;
|
146
|
}
|
147
|
|
148
|
private void makeSingleTaxonNode(RedListGefaesspflanzenImportState state, ResultSet rs,
|
149
|
Classification gesamtListeClassification, Classification checklistClassification,
|
150
|
Classification classificationE, Classification classificationW, Classification classificationK,
|
151
|
Classification classificationAW, Classification classificationAO, Classification classificationR,
|
152
|
Classification classificationO, Classification classificationS)
|
153
|
throws SQLException {
|
154
|
long id = rs.getLong(RedListUtil.NAMNR);
|
155
|
String parentId = String.valueOf(rs.getLong(RedListUtil.LOWER));
|
156
|
String gueltString = rs.getString(RedListUtil.GUELT);
|
157
|
String taxZusatzString = rs.getString(RedListUtil.TAX_ZUSATZ);
|
158
|
String familieString = rs.getString(RedListUtil.FAMILIE);
|
159
|
String clTaxonString = rs.getString(RedListUtil.CL_TAXON);
|
160
|
|
161
|
String relationE = rs.getString(RedListUtil.E);
|
162
|
String relationW = rs.getString(RedListUtil.W);
|
163
|
String relationK = rs.getString(RedListUtil.K);
|
164
|
String relationAW = rs.getString(RedListUtil.AW);
|
165
|
String relationAO = rs.getString(RedListUtil.AO);
|
166
|
String relationR = rs.getString(RedListUtil.R);
|
167
|
String relationO = rs.getString(RedListUtil.O);
|
168
|
String relationS = rs.getString(RedListUtil.S);
|
169
|
|
170
|
//Gesamtliste
|
171
|
TaxonBase<?> taxonBase = state.getRelatedObject(RedListUtil.TAXON_GESAMTLISTE_NAMESPACE, String.valueOf(id), TaxonBase.class);
|
172
|
taxonBase.setSec(gesamtListeClassification.getReference());
|
173
|
Taxon parent = state.getRelatedObject(RedListUtil.TAXON_GESAMTLISTE_NAMESPACE, parentId, Taxon.class);
|
174
|
if(parent!=null && !parent.isInstanceOf(Taxon.class)){
|
175
|
RedListUtil.logMessage(id, parent+" is no taxon but is a parent of "+taxonBase+" (Gesamtliste)", logger);
|
176
|
}
|
177
|
//add to family if no parent found
|
178
|
if(parent==null){
|
179
|
if(!taxonBase.isInstanceOf(Taxon.class)){
|
180
|
RedListUtil.logMessage(id, taxonBase+" has no parent but is not a taxon.", logger);
|
181
|
}
|
182
|
else{
|
183
|
Taxon family = (Taxon) state.getRelatedObject(RedListUtil.FAMILY_NAMESPACE_GESAMTLISTE, familieString);
|
184
|
gesamtListeClassification.addParentChild(family, HibernateProxyHelper.deproxy(taxonBase, Taxon.class), null, null);
|
185
|
//Buttler/Checklist taxon
|
186
|
if(CdmUtils.isNotBlank(clTaxonString) && clTaxonString.equals(RedListUtil.CL_TAXON_B)){
|
187
|
checklistClassification.addParentChild(family, HibernateProxyHelper.deproxy(taxonBase, Taxon.class), null, null);
|
188
|
taxonBase.setSec(checklistClassification.getReference());
|
189
|
}
|
190
|
if(family.getTaxonNodes().isEmpty()){
|
191
|
gesamtListeClassification.addChildTaxon(family, null, null);
|
192
|
//do not add empty families to checklist classification
|
193
|
if(!getClassificationService().listChildNodesOfTaxon(family.getUuid(), RedListUtil.checkListClassificationUuid, null, null, null).isEmpty()){
|
194
|
checklistClassification.addChildTaxon(family, null, null);
|
195
|
}
|
196
|
}
|
197
|
}
|
198
|
}
|
199
|
//add to higher taxon
|
200
|
else{
|
201
|
createParentChildNodes(gesamtListeClassification, id, gueltString, taxZusatzString, taxonBase, parent);
|
202
|
//Buttler/Checklist taxon
|
203
|
if(CdmUtils.isNotBlank(clTaxonString) && clTaxonString.equals(RedListUtil.CL_TAXON_B)){
|
204
|
if(!checklistClassification.isTaxonInTree(parent)){
|
205
|
RedListUtil.logInfoMessage(id, parent+" is parent taxon but is not in checklist. Skipping child "+taxonBase, logger);
|
206
|
}
|
207
|
else{
|
208
|
if(taxonBase.isInstanceOf(Taxon.class)){
|
209
|
createParentChildNodes(checklistClassification, id, gueltString, taxZusatzString, taxonBase, parent);
|
210
|
}
|
211
|
else if(taxonBase.isInstanceOf(Synonym.class)){
|
212
|
//if it is a synonym it is already added to the accepted taxon
|
213
|
//so we just change the sec reference
|
214
|
taxonBase.setSec(checklistClassification.getReference());
|
215
|
taxonBase.setTitleCache(null);
|
216
|
}
|
217
|
}
|
218
|
|
219
|
}
|
220
|
}
|
221
|
taxonBase.setTitleCache(null, false);//refresh title cache
|
222
|
|
223
|
//add taxa for concept relationships to E, W, K, AW, AO, R, O, S
|
224
|
addTaxonToClassification(classificationE, RedListUtil.CLASSIFICATION_NAMESPACE_E, relationE, taxonBase, id, state);
|
225
|
addTaxonToClassification(classificationW, RedListUtil.CLASSIFICATION_NAMESPACE_W, relationW, taxonBase, id, state);
|
226
|
addTaxonToClassification(classificationK, RedListUtil.CLASSIFICATION_NAMESPACE_K, relationK, taxonBase, id, state);
|
227
|
addTaxonToClassification(classificationAW, RedListUtil.CLASSIFICATION_NAMESPACE_AW, relationAW, taxonBase, id, state);
|
228
|
addTaxonToClassification(classificationAO, RedListUtil.CLASSIFICATION_NAMESPACE_AO, relationAO, taxonBase, id, state);
|
229
|
addTaxonToClassification(classificationR, RedListUtil.CLASSIFICATION_NAMESPACE_R, relationR, taxonBase, id, state);
|
230
|
addTaxonToClassification(classificationO, RedListUtil.CLASSIFICATION_NAMESPACE_O, relationO, taxonBase, id, state);
|
231
|
addTaxonToClassification(classificationS, RedListUtil.CLASSIFICATION_NAMESPACE_S, relationS, taxonBase, id, state);
|
232
|
}
|
233
|
|
234
|
|
235
|
|
236
|
private void addTaxonToClassification(Classification classification, String classificationNamespace, String relationString, final TaxonBase<?> gesamtListeTaxon, long id, RedListGefaesspflanzenImportState state){
|
237
|
Taxon taxon = HibernateProxyHelper.deproxy(state.getRelatedObject(classificationNamespace, String.valueOf(id), TaxonBase.class), Taxon.class);
|
238
|
//add concept relation to gesamtliste/checkliste
|
239
|
if(taxon!=null && CdmUtils.isNotBlank(relationString) && !relationString.equals(".")){
|
240
|
//if the related concept in gesamtliste/checkliste is a synonym then we
|
241
|
//create a relation to the accepted taxon
|
242
|
Taxon acceptedGesamtListeTaxon = getAcceptedTaxon(gesamtListeTaxon);
|
243
|
String relationSubstring = relationString.substring(relationString.length()-1, relationString.length());
|
244
|
TaxonRelationshipType taxonRelationshipTypeByKey = new RedListGefaesspflanzenTransformer().getTaxonRelationshipTypeByKey(relationSubstring);
|
245
|
if(taxonRelationshipTypeByKey==null){
|
246
|
RedListUtil.logMessage(id, "Could not interpret relationship "+relationString+" for taxon "+gesamtListeTaxon.generateTitle(), logger);
|
247
|
}
|
248
|
//there is no type "included in" so we have to reverse the direction
|
249
|
if(relationSubstring.equals("<")){
|
250
|
if(acceptedGesamtListeTaxon!=null){
|
251
|
acceptedGesamtListeTaxon.addTaxonRelation(taxon, taxonRelationshipTypeByKey, null, null);
|
252
|
}
|
253
|
}
|
254
|
else{
|
255
|
if(acceptedGesamtListeTaxon!=null){
|
256
|
taxon.addTaxonRelation(acceptedGesamtListeTaxon, taxonRelationshipTypeByKey, null, null);
|
257
|
}
|
258
|
}
|
259
|
|
260
|
taxon.setSec(classification.getReference());
|
261
|
classification.addChildTaxon(taxon, null, null);
|
262
|
taxon.setTitleCache(null);//Reset title cache to see sec ref in title
|
263
|
}
|
264
|
}
|
265
|
|
266
|
private void createParentChildNodes(Classification classification, long id, String gueltString,
|
267
|
String taxZusatzString, TaxonBase<?> taxonBase, Taxon parent) {
|
268
|
if(taxonBase==null){
|
269
|
RedListUtil.logMessage(id, "child taxon/synonym of "+parent+" is null. ("+classification.generateTitle()+")" , logger);
|
270
|
return;
|
271
|
}
|
272
|
//taxon
|
273
|
if(taxonBase.isInstanceOf(Taxon.class)){
|
274
|
//misapplied name
|
275
|
String appendedPhrase = taxonBase.getAppendedPhrase();
|
276
|
if(appendedPhrase!=null && appendedPhrase.equals(RedListUtil.AUCT)){
|
277
|
if(parent==null){
|
278
|
RedListUtil.logMessage(id, "parent taxon of misapplied name "+taxonBase+" is null. ("+classification.getTitleCache()+")" , logger);
|
279
|
return;
|
280
|
}
|
281
|
parent.addMisappliedName((Taxon) taxonBase, null, null);
|
282
|
//return because misapplied names do not have sec references
|
283
|
return;
|
284
|
}
|
285
|
else{
|
286
|
classification.addParentChild(parent, (Taxon)taxonBase, null, null);
|
287
|
}
|
288
|
|
289
|
if(CdmUtils.isNotBlank(taxZusatzString)){
|
290
|
if(taxZusatzString.trim().equals("p. p.")){
|
291
|
RedListUtil.logMessage(id, "pro parte for accepted taxon "+taxonBase, logger);
|
292
|
}
|
293
|
}
|
294
|
}
|
295
|
//synonym
|
296
|
else if(taxonBase.isInstanceOf(Synonym.class)){
|
297
|
if(parent==null){
|
298
|
RedListUtil.logMessage(id, "parent taxon of synonym "+taxonBase+" is null. ("+classification.getTitleCache()+")" , logger);
|
299
|
return;
|
300
|
}
|
301
|
//basionym
|
302
|
if(gueltString.equals(RedListUtil.GUELT_BASIONYM)){
|
303
|
parent.addHomotypicSynonym((Synonym) taxonBase);
|
304
|
parent.getName().addBasionym(taxonBase.getName());
|
305
|
}
|
306
|
//regular synonym
|
307
|
else{
|
308
|
Synonym synonym = (Synonym) taxonBase;
|
309
|
parent.addSynonym((Synonym) taxonBase, SynonymType.HETEROTYPIC_SYNONYM_OF());
|
310
|
|
311
|
//TAX_ZUSATZ
|
312
|
if(CdmUtils.isNotBlank(taxZusatzString)){
|
313
|
if(taxZusatzString.trim().equals("p. p.")){
|
314
|
synonym.setProParte(true);
|
315
|
}
|
316
|
else if(taxZusatzString.trim().equals("s. l. p. p.")){
|
317
|
synonym.setProParte(true);
|
318
|
taxonBase.setAppendedPhrase("s. l.");
|
319
|
}
|
320
|
else if(taxZusatzString.trim().equals("s. str. p. p.")){
|
321
|
synonym.setProParte(true);
|
322
|
taxonBase.setAppendedPhrase("s. str.");
|
323
|
}
|
324
|
else if(taxZusatzString.trim().equals("s. l.")
|
325
|
|| taxZusatzString.trim().equals("s. str.")){
|
326
|
taxonBase.setAppendedPhrase(taxZusatzString);
|
327
|
}
|
328
|
else{
|
329
|
RedListUtil.logMessage(id, "unknown value "+taxZusatzString+" for column "+RedListUtil.TAX_ZUSATZ, logger);
|
330
|
}
|
331
|
}
|
332
|
}
|
333
|
}
|
334
|
//set sec reference
|
335
|
taxonBase.setSec(classification.getReference());
|
336
|
}
|
337
|
|
338
|
@Override
|
339
|
public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs,
|
340
|
RedListGefaesspflanzenImportState state) {
|
341
|
Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<>();
|
342
|
|
343
|
Set<String> idSet = new HashSet<String>();
|
344
|
try {
|
345
|
while (rs.next()){
|
346
|
idSet.add(String.valueOf(rs.getLong(RedListUtil.NAMNR)));
|
347
|
idSet.add(String.valueOf(rs.getLong(RedListUtil.LOWER)));
|
348
|
}
|
349
|
} catch (SQLException e) {
|
350
|
e.printStackTrace();
|
351
|
}
|
352
|
//add taxa and their parent taxa
|
353
|
result.put(RedListUtil.TAXON_GESAMTLISTE_NAMESPACE, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.TAXON_GESAMTLISTE_NAMESPACE));
|
354
|
result.put(RedListUtil.CLASSIFICATION_NAMESPACE_E, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_E));
|
355
|
result.put(RedListUtil.CLASSIFICATION_NAMESPACE_W, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_W));
|
356
|
result.put(RedListUtil.CLASSIFICATION_NAMESPACE_K, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_K));
|
357
|
result.put(RedListUtil.CLASSIFICATION_NAMESPACE_AW, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_AW));
|
358
|
result.put(RedListUtil.CLASSIFICATION_NAMESPACE_AO, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_AO));
|
359
|
result.put(RedListUtil.CLASSIFICATION_NAMESPACE_R, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_R));
|
360
|
result.put(RedListUtil.CLASSIFICATION_NAMESPACE_O, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_O));
|
361
|
result.put(RedListUtil.CLASSIFICATION_NAMESPACE_S, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_S));
|
362
|
|
363
|
//add families
|
364
|
//gesamtliste
|
365
|
Map<String, Taxon> familyMapGL = new HashMap<String, Taxon>();
|
366
|
for (Entry<String, UUID> entry: state.getFamilyMap().entrySet()) {
|
367
|
familyMapGL.put(entry.getKey(), HibernateProxyHelper.deproxy(getTaxonService().load(entry.getValue()), Taxon.class));
|
368
|
}
|
369
|
result.put(RedListUtil.FAMILY_NAMESPACE_GESAMTLISTE, familyMapGL);
|
370
|
return result;
|
371
|
}
|
372
|
|
373
|
private Classification makeClassification(String classificationName, UUID classificationUuid, String referenceName, Integer yearPublished, UUID referenceUuid, RedListGefaesspflanzenImportState state) {
|
374
|
Classification classification = Classification.NewInstance(classificationName, Language.DEFAULT());
|
375
|
classification.setUuid(classificationUuid);
|
376
|
Reference reference = ReferenceFactory.newGeneric();
|
377
|
reference.setTitle(referenceName);
|
378
|
reference.setUuid(referenceUuid);
|
379
|
classification.setReference(reference);
|
380
|
if(yearPublished!=null){
|
381
|
reference.setDatePublished(TimePeriod.NewInstance(yearPublished));
|
382
|
}
|
383
|
return getClassificationService().save(classification);
|
384
|
}
|
385
|
|
386
|
@Override
|
387
|
protected boolean doCheck(RedListGefaesspflanzenImportState state) {
|
388
|
return false;
|
389
|
}
|
390
|
|
391
|
@Override
|
392
|
protected boolean isIgnore(RedListGefaesspflanzenImportState state) {
|
393
|
return false;
|
394
|
}
|
395
|
|
396
|
}
|