Project

General

Profile

« Previous | Next » 

Revision 6706afc3

Added by Katja Luther about 3 years ago

ref #9103: add handling of classifications in TaxonnodeDto

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dto/TaxonNodeDto.java
17 17
import java.util.stream.Collectors;
18 18

  
19 19
import eu.etaxonomy.cdm.model.common.Language;
20
import eu.etaxonomy.cdm.model.taxon.Classification;
20 21
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
21 22
import eu.etaxonomy.cdm.model.taxon.Synonym;
22 23
import eu.etaxonomy.cdm.model.taxon.Taxon;
......
89 90
        super(type, taxonTreeNode.getUuid(), taxonTreeNode.getId(), null);
90 91
        Taxon taxon = null;
91 92
        TaxonNode taxonNode = null;
92

  
93
        Classification classification = null;
93 94
        if (taxonTreeNode instanceof TaxonNode){
94 95
            taxonNode = (TaxonNode)taxonTreeNode;
95 96
            taxon = taxonNode.getTaxon();
97
        }else if (taxonTreeNode instanceof Classification){
98
            classification = (Classification) taxonTreeNode;
96 99
        }
97 100

  
101

  
98 102
        if (taxon != null){
99 103
            setTitleCache(taxon.getName() != null ? taxon.getName().getTitleCache() : taxon.getTitleCache());
100 104
            secUuid = taxon.getSec() != null ? taxon.getSec().getUuid() : null;
......
106 110
        }else{
107 111
            if (taxonNode != null && taxonNode.getClassification() != null){
108 112
                setTitleCache(taxonNode.getClassification().getTitleCache());
113
            } else if (classification != null){
114
                setTitleCache(classification.getTitleCache());
109 115
            }
110 116
            rankOrderIndex = null;
111 117
        }
112
        if (taxonNode != null){
118
        if (taxonNode != null || classification != null){
119
            taxonNode = classification.getRootNode();
113 120
            taxonomicChildrenCount = taxonNode.getCountChildren();
114 121
            status = taxonNode.getStatus();
115 122

  
......
127 134
            sortIndex = taxonNode.getSortIndex();
128 135
            if(taxonNode.getClassification() != null) {
129 136
                classificationUUID = taxonNode.getClassification().getUuid();
130
            } else {
131
                classificationUUID = null;
137
            } else if (classification != null){
138
                classificationUUID = classification.getUuid();
132 139
            }
133 140

  
134 141
        }

Also available in: Unified diff