Revision 669bb68e
Added by Andreas Müller over 2 years ago
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dto/TaxonNodeDto.java | ||
---|---|---|
104 | 104 |
|
105 | 105 |
public TaxonNodeDto(Class<? extends ITaxonTreeNode> type, ITaxonTreeNode taxonTreeNode) { |
106 | 106 |
super(type, taxonTreeNode.getUuid(), taxonTreeNode.getId(), null); |
107 |
|
|
107 | 108 |
Taxon taxon = null; |
108 | 109 |
TaxonNode taxonNode = null; |
109 | 110 |
Classification classification = null; |
111 |
|
|
112 |
//taxonNode, taxon, classification |
|
110 | 113 |
if (taxonTreeNode instanceof TaxonNode){ |
111 | 114 |
taxonNode = (TaxonNode)taxonTreeNode; |
115 |
classification = taxonNode.getClassification(); |
|
112 | 116 |
taxon = taxonNode.getTaxon(); |
113 | 117 |
}else if (taxonTreeNode instanceof Classification){ |
114 | 118 |
classification = (Classification) taxonTreeNode; |
119 |
taxonNode = classification.getRootNode(); |
|
120 |
//taxon should always be null for rootnode therefore no assignment here |
|
115 | 121 |
} |
116 | 122 |
|
123 |
//taxon or titleCache |
|
117 | 124 |
if (taxon != null){ |
118 | 125 |
setTitleCache(taxon.getName() != null ? taxon.getName().getTitleCache() : taxon.getTitleCache()); |
119 | 126 |
secUuid = taxon.getSec() != null ? taxon.getSec().getUuid() : null; |
... | ... | |
124 | 131 |
rankOrderIndex =taxon.getNullSafeRank() != null ? taxon.getNullSafeRank().getOrderIndex() : null; |
125 | 132 |
taxonIsPublish = taxon.isPublish(); |
126 | 133 |
}else{ |
127 |
if (taxonNode != null && taxonNode.getClassification() != null){ |
|
128 |
setTitleCache(taxonNode.getClassification().getTitleCache()); |
|
129 |
} else if (classification != null){ |
|
134 |
if (classification != null){ |
|
130 | 135 |
setTitleCache(classification.getTitleCache()); |
131 | 136 |
} |
132 | 137 |
rankOrderIndex = null; |
133 | 138 |
} |
134 |
if (taxonNode != null || classification != null){
|
|
135 |
if (classification != null){ |
|
136 |
taxonNode = classification.getRootNode();
|
|
137 |
}
|
|
139 |
taxonStatus = TaxonStatus.Accepted;
|
|
140 |
|
|
141 |
//taxonNode
|
|
142 |
if (taxonNode != null){
|
|
138 | 143 |
taxonomicChildrenCount = taxonNode.getCountChildren(); |
139 | 144 |
status = taxonNode.getStatus(); |
140 | 145 |
|
... | ... | |
150 | 155 |
} |
151 | 156 |
|
152 | 157 |
sortIndex = taxonNode.getSortIndex(); |
153 |
if(taxonNode.getClassification() != null) { |
|
154 |
classificationUUID = taxonNode.getClassification().getUuid(); |
|
155 |
} else if (classification != null){ |
|
156 |
classificationUUID = classification.getUuid(); |
|
157 |
} |
|
158 |
} |
|
158 | 159 |
|
160 |
//classification |
|
161 |
if (classification != null){ |
|
162 |
classificationUUID = classification.getUuid(); |
|
159 | 163 |
} |
160 |
taxonStatus = TaxonStatus.Accepted; |
|
161 | 164 |
} |
162 | 165 |
|
163 | 166 |
public TaxonNodeDto(Synonym synonym, boolean isHomotypic) { |
Also available in: Unified diff
simplify and javadoc for TaxonNodeDto constructor