Project

General

Profile

Download (23 KB) Statistics
| Branch: | Revision:
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.SynonymRelationship;
38
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
39
import eu.etaxonomy.cdm.model.taxon.Taxon;
40
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
41
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
42

    
43
/**
44
 *
45
 * @author pplitzner
46
 * @date Mar 1, 2016
47
 *
48
 */
49

    
50
@Component
51
@SuppressWarnings("serial")
52
public class RedListGefaesspflanzenImportClassification extends DbImportBase<RedListGefaesspflanzenImportState, RedListGefaesspflanzenImportConfigurator> {
53

    
54
    private static final Logger logger = Logger.getLogger(RedListGefaesspflanzenImportClassification.class);
55

    
56
    private static final String tableName = "Rote Liste Gefäßpflanzen";
57

    
58
    private static final String pluralString = "classifications";
59

    
60
    public RedListGefaesspflanzenImportClassification() {
61
        super(tableName, pluralString);
62
    }
63

    
64
    @Override
65
    protected String getIdQuery(RedListGefaesspflanzenImportState state) {
66
        return "SELECT SEQNUM "
67
                + "FROM V_TAXATLAS_D20_EXPORT t "
68
                + " ORDER BY SEQNUM";
69
    }
70

    
71
    @Override
72
    protected String getRecordQuery(RedListGefaesspflanzenImportConfigurator config) {
73
        String result = "select distinct e.*, f.FAMILIE "
74
                + "from V_TAXATLAS_D20_EXPORT e, GATTUNG_FAMILIE f "
75
                + "where e.EPI1 = f.GATTUNG and e.SEQNUM IN (@IDSET)";
76
        result = result.replace("@IDSET", IPartitionedIO.ID_LIST_TOKEN);
77
        return result;
78
    }
79

    
80
    @Override
81
    protected void doInvoke(RedListGefaesspflanzenImportState state) {
82
        Classification gesamtListe = makeClassification("Gesamtliste", state.getConfig().getClassificationUuid(), "Gesamtliste", null, RedListUtil.gesamtListeReferenceUuid, state);
83
        Classification checkliste = makeClassification("Checkliste", RedListUtil.checkListClassificationUuid, "Checkliste", null, RedListUtil.checkListReferenceUuid, state);
84
        makeClassification("Ehrendorfer", RedListUtil.uuidClassificationE, "Ehrendorfer", null, RedListUtil.uuidClassificationReferenceE, state);
85
        makeClassification("Wisskirchen (Standardliste)", RedListUtil.uuidClassificationW, "Wisskirchen (Standardliste)", 1998, RedListUtil.uuidClassificationReferenceW, state);
86
        makeClassification("Korneck (Rote Liste)", RedListUtil.uuidClassificationK, "Korneck (Rote Liste)", 1996, RedListUtil.uuidClassificationReferenceK, state);
87
        makeClassification("Atlas (Westdeutschland)", RedListUtil.uuidClassificationAW, "Atlas (Westdeutschland)", 1988, RedListUtil.uuidClassificationReferenceAW, state);
88
        makeClassification("Atlas (Ostdeutschland)", RedListUtil.uuidClassificationAO, "Atlas (Ostdeutschland)", 1996, RedListUtil.uuidClassificationReferenceAO, state);
89
        makeClassification("Rothmaler", RedListUtil.uuidClassificationR, "Rothmaler", 2011, RedListUtil.uuidClassificationReferenceR, state);
90
        makeClassification("Oberdorfer", RedListUtil.uuidClassificationO, "Oberdorfer", 2001, RedListUtil.uuidClassificationReferenceO, state);
91
        makeClassification("Schmeil-Fitschen", RedListUtil.uuidClassificationS, "Schmeil-Fitschen", 2011, RedListUtil.uuidClassificationReferenceS, state);
92
        importFamilies(gesamtListe, checkliste, state);
93
        super.doInvoke(state);
94
    }
95

    
96

    
97
    private void importFamilies(Classification gesamtListe, Classification checkliste, RedListGefaesspflanzenImportState state) {
98
        for(UUID uuid:state.getFamilyMap().values()){
99
            Taxon familyGL = HibernateProxyHelper.deproxy(getTaxonService().load(uuid, Arrays.asList(new String[]{"*"})), Taxon.class);
100
            Taxon familyCL = (Taxon) familyGL.clone();
101
            getTaxonService().saveOrUpdate(familyCL);
102

    
103
            gesamtListe.addChildTaxon(familyGL, null, null);
104
            familyGL.setSec(gesamtListe.getReference());
105
            familyGL.setTitleCache(null);
106

    
107
            checkliste.addChildTaxon(familyCL, null, null);
108
            familyCL.setSec(checkliste.getReference());
109
            familyCL.setTitleCache(null);
110

    
111
            getClassificationService().saveOrUpdate(gesamtListe);
112
            getClassificationService().saveOrUpdate(checkliste);
113
        }
114
    }
115

    
116
    @Override
117
    public boolean doPartition(ResultSetPartitioner partitioner, RedListGefaesspflanzenImportState state) {
118
        ResultSet rs = partitioner.getResultSet();
119
        Classification gesamtListeClassification = getClassificationService().load(state.getConfig().getClassificationUuid());
120
        Classification checklistClassification = getClassificationService().load(RedListUtil.checkListClassificationUuid);
121
        Classification classificationE = getClassificationService().load(RedListUtil.uuidClassificationE);
122
        Classification classificationW = getClassificationService().load(RedListUtil.uuidClassificationW);
123
        Classification classificationK = getClassificationService().load(RedListUtil.uuidClassificationK);
124
        Classification classificationAW = getClassificationService().load(RedListUtil.uuidClassificationAW);
125
        Classification classificationAO = getClassificationService().load(RedListUtil.uuidClassificationAO);
126
        Classification classificationR = getClassificationService().load(RedListUtil.uuidClassificationR);
127
        Classification classificationO = getClassificationService().load(RedListUtil.uuidClassificationO);
128
        Classification classificationS = getClassificationService().load(RedListUtil.uuidClassificationS);
129
        try {
130
            while (rs.next()){
131
                makeSingleTaxonNode(state, rs, gesamtListeClassification, checklistClassification,
132
                        classificationE, classificationW, classificationK, classificationAW
133
                        , classificationAO, classificationR, classificationO, classificationS);
134

    
135
            }
136
        } catch (SQLException e) {
137
            e.printStackTrace();
138
        }
139

    
140
        logger.info("Update classification (1000 nodes)");
141
        getClassificationService().saveOrUpdate(gesamtListeClassification);
142
        getClassificationService().saveOrUpdate(checklistClassification);
143
        getClassificationService().saveOrUpdate(classificationE);
144
        getClassificationService().saveOrUpdate(classificationW);
145
        getClassificationService().saveOrUpdate(classificationK);
146
        getClassificationService().saveOrUpdate(classificationAW);
147
        getClassificationService().saveOrUpdate(classificationAO);
148
        getClassificationService().saveOrUpdate(classificationR);
149
        getClassificationService().saveOrUpdate(classificationO);
150
        getClassificationService().saveOrUpdate(classificationS);
151
        return true;
152
    }
153

    
154
    private void makeSingleTaxonNode(RedListGefaesspflanzenImportState state, ResultSet rs,
155
            Classification gesamtListeClassification, Classification checklistClassification,
156
            Classification classificationE, Classification classificationW, Classification classificationK,
157
            Classification classificationAW, Classification classificationAO, Classification classificationR,
158
            Classification classificationO, Classification classificationS)
159
            throws SQLException {
160
        long id = rs.getLong(RedListUtil.NAMNR);
161
        String parentId = String.valueOf(rs.getLong(RedListUtil.LOWER));
162
        String gueltString = rs.getString(RedListUtil.GUELT);
163
        String taxZusatzString = rs.getString(RedListUtil.TAX_ZUSATZ);
164
        String familieString = rs.getString(RedListUtil.FAMILIE);
165

    
166
        String relationE = rs.getString(RedListUtil.E);
167
        String relationW = rs.getString(RedListUtil.W);
168
        String relationK = rs.getString(RedListUtil.K);
169
        String relationAW = rs.getString(RedListUtil.AW);
170
        String relationAO = rs.getString(RedListUtil.AO);
171
        String relationR = rs.getString(RedListUtil.R);
172
        String relationO = rs.getString(RedListUtil.O);
173
        String relationS = rs.getString(RedListUtil.S);
174

    
175
        //Gesamtliste
176
        TaxonBase<?> taxonBaseGL = state.getRelatedObject(RedListUtil.TAXON_GESAMTLISTE_NAMESPACE, String.valueOf(id), TaxonBase.class);
177
        Taxon parentGL = state.getRelatedObject(RedListUtil.TAXON_GESAMTLISTE_NAMESPACE, parentId, Taxon.class);
178
        if(parentGL!=null && !parentGL.isInstanceOf(Taxon.class)){
179
            RedListUtil.logMessage(id, parentGL+" is no taxon but is a parent of "+taxonBaseGL+" (Gesamtliste)", logger);
180
        }
181
        //add to family if no parent found
182
        if(parentGL==null){
183
            if(!taxonBaseGL.isInstanceOf(Taxon.class)){
184
                RedListUtil.logMessage(id, taxonBaseGL+" has no parent but is not a taxon.", logger);
185
            }
186
            else{
187
                Taxon family = (Taxon) state.getRelatedObject(RedListUtil.FAMILY_NAMESPACE, familieString);
188
                gesamtListeClassification.addParentChild(family, HibernateProxyHelper.deproxy(taxonBaseGL, Taxon.class), null, null);
189
            }
190
        }
191
        //add to higher taxon
192
        else{
193
            createParentChildNodes(gesamtListeClassification, id, gueltString, taxZusatzString, taxonBaseGL, parentGL);
194
        }
195

    
196
        //Checkliste
197
        TaxonBase<?> taxonBaseCL = state.getRelatedObject(RedListUtil.TAXON_CHECKLISTE_NAMESPACE, String.valueOf(id), TaxonBase.class);
198
        Taxon parentCL = state.getRelatedObject(RedListUtil.TAXON_CHECKLISTE_NAMESPACE, parentId, Taxon.class);
199
        if(parentCL!=null && !parentCL.isInstanceOf(Taxon.class)){
200
            RedListUtil.logMessage(id, parentCL+" is no taxon but is a parent of "+taxonBaseCL+" (Checkliste)", logger);
201
        }
202
        if(taxonBaseCL!=null){//null check necessary because not all taxa exist in the checklist
203
            //add to family if no parent found
204
            if(parentCL==null){
205
                if(!taxonBaseCL.isInstanceOf(Taxon.class)){
206
                    RedListUtil.logMessage(id, taxonBaseCL+" has no parent but is not a taxon.", logger);
207
                }
208
                else{
209
                    Taxon family = (Taxon) state.getRelatedObject(RedListUtil.FAMILY_NAMESPACE, familieString);
210
                    checklistClassification.addParentChild(family, HibernateProxyHelper.deproxy(taxonBaseCL, Taxon.class), null, null);
211
                }
212
            }
213
            //add to higher taxon
214
            else{
215
                createParentChildNodes(checklistClassification, id, gueltString, taxZusatzString, taxonBaseCL, parentCL);
216
            }
217
        }
218

    
219
        //check uuids
220
        if(taxonBaseGL!= null && taxonBaseCL!=null
221
                && taxonBaseGL.getUuid().equals(taxonBaseCL.getUuid())){
222
            RedListUtil.logMessage(id, "Same UUID for "+taxonBaseGL+ " (Gesamtliste) and "+taxonBaseCL+" (Checkliste)", logger);
223
        }
224
        if(parentGL!=null && parentCL!=null && parentGL.getUuid().equals(parentCL.getUuid())){
225
            RedListUtil.logMessage(id, "Same UUID for "+parentGL+ " (Gesamtliste) and "+parentCL+" (Checkliste)", logger);
226
        }
227

    
228
        //add taxa for concept relationships to E, W, K, AW, AO, R, O, S
229
        addTaxonToClassification(classificationE, RedListUtil.CLASSIFICATION_NAMESPACE_E, relationE, taxonBaseGL, taxonBaseCL, id, state);
230
        addTaxonToClassification(classificationW, RedListUtil.CLASSIFICATION_NAMESPACE_W, relationW, taxonBaseGL, taxonBaseCL, id, state);
231
        addTaxonToClassification(classificationK, RedListUtil.CLASSIFICATION_NAMESPACE_K, relationK, taxonBaseGL, taxonBaseCL, id, state);
232
        addTaxonToClassification(classificationAW, RedListUtil.CLASSIFICATION_NAMESPACE_AW, relationAW, taxonBaseGL, taxonBaseCL, id, state);
233
        addTaxonToClassification(classificationAO, RedListUtil.CLASSIFICATION_NAMESPACE_AO, relationAO, taxonBaseGL, taxonBaseCL, id, state);
234
        addTaxonToClassification(classificationR, RedListUtil.CLASSIFICATION_NAMESPACE_R, relationR, taxonBaseGL, taxonBaseCL, id, state);
235
        addTaxonToClassification(classificationO, RedListUtil.CLASSIFICATION_NAMESPACE_O, relationO, taxonBaseGL, taxonBaseCL, id, state);
236
        addTaxonToClassification(classificationS, RedListUtil.CLASSIFICATION_NAMESPACE_S, relationS, taxonBaseGL, taxonBaseCL, id, state);
237
    }
238

    
239

    
240

    
241
    private void addTaxonToClassification(Classification classification, String classificationNamespace, String relationString, final TaxonBase<?> gesamtListeTaxon, final TaxonBase<?> checklisteTaxon, long id, RedListGefaesspflanzenImportState state){
242
        Taxon taxon = HibernateProxyHelper.deproxy(state.getRelatedObject(classificationNamespace, String.valueOf(id), TaxonBase.class), Taxon.class);
243
        //add concept relation to gesamtliste and checkliste
244
        if(taxon!=null && CdmUtils.isNotBlank(relationString) && !relationString.equals(".")){
245
            //if the related concept in gesamtliste/checkliste is a synonym then we
246
            //create a relation to the accepted taxon
247
            Taxon acceptedGesamtListeTaxon = getAcceptedTaxon(gesamtListeTaxon);
248
            Taxon acceptedChecklistTaxon = getAcceptedTaxon(checklisteTaxon);
249
            String relationSubstring = relationString.substring(relationString.length()-1, relationString.length());
250
            TaxonRelationshipType taxonRelationshipTypeByKey = new RedListGefaesspflanzenTransformer().getTaxonRelationshipTypeByKey(relationSubstring);
251
            if(taxonRelationshipTypeByKey==null){
252
                RedListUtil.logMessage(id, "Could not interpret relationship "+relationString+" for taxon "+gesamtListeTaxon.generateTitle(), logger);
253
            }
254
            //there is no type "included in" so we have to reverse the direction
255
            if(relationSubstring.equals("<")){
256
                if(acceptedGesamtListeTaxon!=null){
257
                    acceptedGesamtListeTaxon.addTaxonRelation(taxon, taxonRelationshipTypeByKey, null, null);
258
                }
259
                if(acceptedChecklistTaxon!=null) {
260
                    acceptedChecklistTaxon.addTaxonRelation(taxon, taxonRelationshipTypeByKey, null, null);
261
                }
262
            }
263
            else{
264
                if(acceptedGesamtListeTaxon!=null){
265
                    taxon.addTaxonRelation(acceptedGesamtListeTaxon, taxonRelationshipTypeByKey, null, null);
266
                }
267
                if(acceptedChecklistTaxon!=null) {
268
                    taxon.addTaxonRelation(acceptedChecklistTaxon, taxonRelationshipTypeByKey, null, null);
269
                }
270
            }
271

    
272
            taxon.setSec(classification.getReference());
273
            classification.addChildTaxon(taxon, null, null);
274
            //TODO is saving and setting the title cache to null neccessary?
275
            getTaxonService().saveOrUpdate(taxon);
276
            getTaxonService().saveOrUpdate(gesamtListeTaxon);
277
            if(checklisteTaxon!=null){
278
                getTaxonService().saveOrUpdate(checklisteTaxon);
279
            }
280
            taxon.setTitleCache(null);//Reset title cache to see sec ref in title
281
        }
282
    }
283

    
284
    private void createParentChildNodes(Classification classification, long id, String gueltString,
285
            String taxZusatzString, TaxonBase<?> taxonBase, Taxon parent) {
286
        if(taxonBase==null){
287
            RedListUtil.logMessage(id, "child taxon/synonym of "+parent+"  is null. ("+classification.generateTitle()+")" , logger);
288
            return;
289
        }
290
        //taxon
291
        if(taxonBase.isInstanceOf(Taxon.class)){
292
            //misapplied name
293
            String appendedPhrase = taxonBase.getAppendedPhrase();
294
            if(appendedPhrase!=null && appendedPhrase.equals(RedListUtil.AUCT)){
295
                if(parent==null){
296
                    RedListUtil.logMessage(id, "parent taxon of misapplied name "+taxonBase+"  is null. ("+classification.getTitleCache()+")" , logger);
297
                    return;
298
                }
299
                parent.addMisappliedName((Taxon) taxonBase, null, null);
300
            }
301
            else{
302
                classification.addParentChild(parent, (Taxon)taxonBase, null, null);
303
            }
304

    
305
            if(CdmUtils.isNotBlank(taxZusatzString)){
306
                if(taxZusatzString.trim().equals("p. p.")){
307
                    RedListUtil.logMessage(id, "pro parte for accepted taxon "+taxonBase, logger);
308
                }
309
            }
310
        }
311
        //synonym
312
        else if(taxonBase.isInstanceOf(Synonym.class)){
313
            if(parent==null){
314
                RedListUtil.logMessage(id, "parent taxon of synonym "+taxonBase+"  is null. ("+classification.getTitleCache()+")" , logger);
315
                return;
316
            }
317
            //basionym
318
            if(gueltString.equals(RedListUtil.GUELT_BASIONYM)){
319
                parent.addHomotypicSynonym((Synonym) taxonBase, null, null);
320
                parent.getName().addBasionym(taxonBase.getName());
321
            }
322
            //regular synonym
323
            else{
324
                SynonymRelationship synonymRelationship = parent.addSynonym((Synonym) taxonBase, SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF(), null, null);
325

    
326
                //TAX_ZUSATZ
327
                if(CdmUtils.isNotBlank(taxZusatzString)){
328
                    if(taxZusatzString.trim().equals("p. p.")){
329
                        synonymRelationship.setProParte(true);
330
                    }
331
                    else if(taxZusatzString.trim().equals("s. l. p. p.")){
332
                        synonymRelationship.setProParte(true);
333
                        taxonBase.setAppendedPhrase("s. l.");
334
                    }
335
                    else if(taxZusatzString.trim().equals("s. str. p. p.")){
336
                        synonymRelationship.setProParte(true);
337
                        taxonBase.setAppendedPhrase("s. str.");
338
                    }
339
                    else if(taxZusatzString.trim().equals("s. l.")
340
                            || taxZusatzString.trim().equals("s. str.")){
341
                        taxonBase.setAppendedPhrase(taxZusatzString);
342
                    }
343
                    else{
344
                        RedListUtil.logMessage(id, "unknown value "+taxZusatzString+" for column "+RedListUtil.TAX_ZUSATZ, logger);
345
                    }
346
                }
347
            }
348
        }
349
        //set sec reference
350
        taxonBase.setSec(classification.getReference());
351
        taxonBase.setTitleCache(null, false);//refresh title cache
352
    }
353

    
354
    @Override
355
    public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs,
356
            RedListGefaesspflanzenImportState state) {
357
        Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<>();
358

    
359
        Set<String> idSet = new HashSet<String>();
360
        try {
361
            while (rs.next()){
362
                idSet.add(String.valueOf(rs.getLong(RedListUtil.NAMNR)));
363
                idSet.add(String.valueOf(rs.getLong(RedListUtil.LOWER)));
364
            }
365
        } catch (SQLException e) {
366
            e.printStackTrace();
367
        }
368
        //add taxa and their parent taxa
369
        result.put(RedListUtil.TAXON_GESAMTLISTE_NAMESPACE, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.TAXON_GESAMTLISTE_NAMESPACE));
370
        result.put(RedListUtil.TAXON_CHECKLISTE_NAMESPACE, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.TAXON_CHECKLISTE_NAMESPACE));
371
        result.put(RedListUtil.CLASSIFICATION_NAMESPACE_E, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_E));
372
        result.put(RedListUtil.CLASSIFICATION_NAMESPACE_W, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_W));
373
        result.put(RedListUtil.CLASSIFICATION_NAMESPACE_K, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_K));
374
        result.put(RedListUtil.CLASSIFICATION_NAMESPACE_AW, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_AW));
375
        result.put(RedListUtil.CLASSIFICATION_NAMESPACE_AO, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_AO));
376
        result.put(RedListUtil.CLASSIFICATION_NAMESPACE_R, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_R));
377
        result.put(RedListUtil.CLASSIFICATION_NAMESPACE_O, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_O));
378
        result.put(RedListUtil.CLASSIFICATION_NAMESPACE_S, (Map<String, TaxonBase>) getCommonService().getSourcedObjectsByIdInSource(TaxonBase.class, idSet, RedListUtil.CLASSIFICATION_NAMESPACE_S));
379

    
380
        //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));
384
        }
385
        result.put(RedListUtil.FAMILY_NAMESPACE, familyMap);
386
        return result;
387
    }
388

    
389
    private Classification makeClassification(String classificationName, UUID classificationUuid, String referenceName, Integer yearPublished, UUID referenceUuid, RedListGefaesspflanzenImportState state) {
390
        Classification classification = Classification.NewInstance(classificationName, Language.DEFAULT());
391
        classification.setUuid(classificationUuid);
392
        Reference reference = ReferenceFactory.newGeneric();
393
        reference.setTitle(referenceName);
394
        reference.setUuid(referenceUuid);
395
        classification.setReference(reference);
396
        if(yearPublished!=null){
397
            reference.setDatePublished(TimePeriod.NewInstance(yearPublished));
398
        }
399
        return getClassificationService().save(classification);
400
    }
401

    
402
    @Override
403
    protected boolean doCheck(RedListGefaesspflanzenImportState state) {
404
        return false;
405
    }
406

    
407
    @Override
408
    protected boolean isIgnore(RedListGefaesspflanzenImportState state) {
409
        return false;
410
    }
411

    
412
}
(2-2/8)