Project

General

Profile

Download (23.8 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.getFamilyMapGesamtListe().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.addParentChild(null, familyGL, null, null);
104
            familyGL.setSec(gesamtListe.getReference());
105
            familyGL.setTitleCache(null);
106

    
107
            checkliste.addParentChild(null, 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_GESAMTLISTE, familieString);
188
                gesamtListeClassification.addParentChild(family, HibernateProxyHelper.deproxy(taxonBaseGL, Taxon.class), null, null);
189
                if(family.getTaxonNodes().isEmpty()){
190
                    gesamtListeClassification.addChildTaxon(family, null, null);
191
                }
192
            }
193
        }
194
        //add to higher taxon
195
        else{
196
            createParentChildNodes(gesamtListeClassification, id, gueltString, taxZusatzString, taxonBaseGL, parentGL);
197
        }
198

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

    
225
        //check uuids
226
        if(taxonBaseGL!= null && taxonBaseCL!=null
227
                && taxonBaseGL.getUuid().equals(taxonBaseCL.getUuid())){
228
            RedListUtil.logMessage(id, "Same UUID for "+taxonBaseGL+ " (Gesamtliste) and "+taxonBaseCL+" (Checkliste)", logger);
229
        }
230
        if(parentGL!=null && parentCL!=null && parentGL.getUuid().equals(parentCL.getUuid())){
231
            RedListUtil.logMessage(id, "Same UUID for "+parentGL+ " (Gesamtliste) and "+parentCL+" (Checkliste)", logger);
232
        }
233

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

    
245

    
246

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

    
278
            taxon.setSec(classification.getReference());
279
            classification.addChildTaxon(taxon, null, null);
280
            //TODO is saving and setting the title cache to null neccessary?
281
            getTaxonService().saveOrUpdate(taxon);
282
            getTaxonService().saveOrUpdate(gesamtListeTaxon);
283
            if(checklisteTaxon!=null){
284
                getTaxonService().saveOrUpdate(checklisteTaxon);
285
            }
286
            taxon.setTitleCache(null);//Reset title cache to see sec ref in title
287
        }
288
    }
289

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

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

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

    
360
    @Override
361
    public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs,
362
            RedListGefaesspflanzenImportState state) {
363
        Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<>();
364

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

    
386
        //add families
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));
397
        }
398
        result.put(RedListUtil.FAMILY_NAMESPACE_CHECKLISTE, familyMapCL);
399
        return result;
400
    }
401

    
402
    private Classification makeClassification(String classificationName, UUID classificationUuid, String referenceName, Integer yearPublished, UUID referenceUuid, RedListGefaesspflanzenImportState state) {
403
        Classification classification = Classification.NewInstance(classificationName, Language.DEFAULT());
404
        classification.setUuid(classificationUuid);
405
        Reference reference = ReferenceFactory.newGeneric();
406
        reference.setTitle(referenceName);
407
        reference.setUuid(referenceUuid);
408
        classification.setReference(reference);
409
        if(yearPublished!=null){
410
            reference.setDatePublished(TimePeriod.NewInstance(yearPublished));
411
        }
412
        return getClassificationService().save(classification);
413
    }
414

    
415
    @Override
416
    protected boolean doCheck(RedListGefaesspflanzenImportState state) {
417
        return false;
418
    }
419

    
420
    @Override
421
    protected boolean isIgnore(RedListGefaesspflanzenImportState state) {
422
        return false;
423
    }
424

    
425
}
(2-2/9)