Project

General

Profile

Revision e6c333f3

IDe6c333f3e7721a7628933427b9e7dff3b2527386
Parent 5e2ae553
Child 7c452fe9

Added by Katja Luther about 4 years ago

small changes in CsvNameExport

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/csv/caryophyllales/out/CsvNameExport.java
31 31
import eu.etaxonomy.cdm.model.description.Distribution;
32 32
import eu.etaxonomy.cdm.model.description.Feature;
33 33
import eu.etaxonomy.cdm.model.description.TextData;
34
import eu.etaxonomy.cdm.model.location.NamedArea;
34 35
import eu.etaxonomy.cdm.model.name.BotanicalName;
35 36
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
36 37
import eu.etaxonomy.cdm.model.name.HomotypicalGroupComparator;
......
97 98
            }
98 99

  
99 100
            List<HashMap<String, String>> result;
101
            if (config.getRank() == null){
102
                config.setRank(Rank.GENUS());
103
            }
100 104
            if (config.isNamesOnly()){
101 105
                txStatus = startTransaction();
102 106
                result = getNameService().getNameRecords();
......
201 205
            for (TaxonNode child: familyNode.getChildNodes()){
202 206
                child = HibernateProxyHelper.deproxy(child, TaxonNode.class);
203 207
                name = HibernateProxyHelper.deproxy(child.getTaxon().getName(), TaxonNameBase.class);
204
                if (child.getTaxon().getName().getRank().isLower(Rank.GENUS()) || child.getTaxon().getName().isGenus()) {
208
                if (child.getTaxon().getName().getRank().isLower(state.getConfig().getRank()) ) {
205 209
                    childrenUuids.add(child.getUuid());
206 210
                    if (child.hasChildNodes()){
207 211
                        parentsNodesUUID.add(child.getUuid());
......
377 381

  
378 382
        Rank nodeRank = node.getTaxon().getName().getRank();
379 383
        if (nodeRank.isKindOf(rank)){
380
            return node;
384
            return null;
381 385

  
382 386
        }else if (nodeRank.isHigher(rank)){
383 387
            return null;
......
395 399
                return;
396 400
        }
397 401
        for (DescriptionBase<?> descriptionBase: taxon.getDescriptions()){
402
            if (!descriptionBase.isImageGallery()){
403
                Set<DescriptionElementBase> elements = descriptionBase.getElements();
404
                for (DescriptionElementBase element: elements){
405
                    if (element.getFeature().equals(feature)){
406
                        if (element instanceof TextData){
407
                            textElement = HibernateProxyHelper.deproxy(element, TextData.class);
408
                            descriptionsString.append(textElement.getText(Language.ENGLISH()));
398 409

  
399
            Set<DescriptionElementBase> elements = descriptionBase.getElements();
400
            for (DescriptionElementBase element: elements){
401
                if (element.getFeature().equals(feature)){
402
                    if (element instanceof TextData){
403
                        textElement = HibernateProxyHelper.deproxy(element, TextData.class);
404
                        descriptionsString.append(textElement.getText(Language.ENGLISH()));
410
                        }else if (element instanceof Distribution ){
405 411

  
406
                    }else if (element instanceof Distribution ){
412
                            Distribution distribution = HibernateProxyHelper.deproxy(element, Distribution.class);
413
                            distributions.add(distribution);
407 414

  
408
                        Distribution distribution = HibernateProxyHelper.deproxy(element, Distribution.class);
409
                        distributions.add(distribution);
410 415

  
416
                        }
411 417

  
412 418
                    }
413

  
414 419
                }
415 420
            }
416 421

  
......
427 432
            nameRecord.put(columnName, conDis.toString());
428 433

  
429 434
        } else{
435
            NamedArea area ;
430 436
            for (Distribution distribution:distributions){
431 437

  
432 438
                if (descriptionsString.length()> 0 ){
433 439
                    descriptionsString.append(", ");
434 440
                }
435
                descriptionsString.append(distribution.getArea().getIdInVocabulary());
441
                area = HibernateProxyHelper.deproxy(distribution.getArea(), NamedArea.class);
442
                if (area.getIdInVocabulary() != null){
443
                    descriptionsString.append(area.getIdInVocabulary());
444
                }else if (area.getSymbol() != null){
445
                    descriptionsString.append(area.getSymbol());
446
                }else{
447
                    descriptionsString.append(area.getLabel());
448
                }
436 449

  
437 450
            }
438 451
            nameRecord.put(columnName, descriptionsString.toString());
......
508 521
            nameRecord.put("genusName", null);
509 522
            nameRecord.put("descriptionsGen", null);
510 523
        }
524

  
511 525
        taxon = (Taxon) getTaxonService().load(childNode.getTaxon().getUuid());
512 526
        taxon = HibernateProxyHelper.deproxy(taxon, Taxon.class);
513 527
        //  if (taxon.isPublish()){
......
545 559
            TypeDesignationBase typeDes = HibernateProxyHelper.deproxy(it.next(), TypeDesignationBase.class);
546 560

  
547 561
            if (typeDes instanceof NameTypeDesignation){
548
                NameTypeDesignation nameTypeDes = HibernateProxyHelper.deproxy(it.next(), NameTypeDesignation.class);
562
                NameTypeDesignation nameTypeDes = HibernateProxyHelper.deproxy(typeDes, NameTypeDesignation.class);
549 563

  
550 564
                BotanicalName typeName =  HibernateProxyHelper.deproxy(nameTypeDes.getTypeName(), BotanicalName.class);
551 565
                if (typeName != null){

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)