Project

General

Profile

Download (3.86 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2016 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.cdm.persistence.dto;
11

    
12
import java.util.List;
13
import java.util.UUID;
14

    
15
import eu.etaxonomy.cdm.model.taxon.Synonym;
16
import eu.etaxonomy.cdm.model.taxon.Taxon;
17
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
18
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
19

    
20
/**
21
 * @author a.kohlbecker
22
 * @date Jun 13, 2016
23
 *
24
 */
25
public class TaxonNodeDto {
26

    
27
    /**
28
     * The TaxonNode uuid
29
     */
30
    private final UUID uuid;
31

    
32
    /**
33
     * count of the direct taxonomic children
34
     */
35
    private final int taxonomicChildrenCount;
36

    
37

    
38
    /**
39
     * The UUID of the associated secundum reference
40
     */
41
    private final UUID secUuid;
42

    
43
    /**
44
     * The uuid of the associated Taxon entity
45
     */
46
    private final UUID taxonUuid;
47

    
48
    /**
49
     * the titleCache of the associated TaxonName entity
50
     */
51
    private final String titleCache;
52

    
53
    /**
54
     * the taggedTitle of the associated TaxonName entity
55
     */
56
    private final List<TaggedText> taggedTitle;
57

    
58
    /**
59
     * The unplaced flag of the Taxon entity
60
     */
61
    private final boolean unplaced;
62

    
63
    /**
64
     * The excluded flag of the Taxon entity
65
     */
66
    private final boolean excluded;
67

    
68
    /**
69
     * The Rank.label value of the rank to which the associated TaxonName entity is assigned to.
70
     */
71
    private final String rankLabel;
72

    
73
    private final TaxonStatus status;
74

    
75
    /**
76
     * @param taxonNode
77
     */
78
    public TaxonNodeDto(TaxonNode taxonNode) {
79
        uuid = taxonNode.getUuid();
80
        taxonomicChildrenCount = taxonNode.getCountChildren();
81
        Taxon taxon = taxonNode.getTaxon();
82
        secUuid = taxon.getSec().getUuid();
83
        taxonUuid = taxon.getUuid();
84
        titleCache = taxon.getName().getTitleCache();
85
        taggedTitle = taxon.getName().getTaggedName();
86
        unplaced = taxon.isUnplaced();
87
        excluded = taxon.isExcluded();
88
        rankLabel = taxon.getName().getRank().getLabel();
89
        status = TaxonStatus.Accepted;
90
    }
91

    
92
    /**
93
     * @param taxonNode
94
     */
95
    public TaxonNodeDto(Synonym synonym, boolean isHomotypic) {
96
        uuid = null;
97
        taxonomicChildrenCount = 0;
98
        secUuid = synonym.getSec().getUuid();
99
        taxonUuid = synonym.getUuid();
100
        titleCache = synonym.getName().getTitleCache();
101
        taggedTitle = synonym.getName().getTaggedName();
102
        unplaced = false;
103
        excluded = false;
104
        rankLabel = synonym.getName().getRank().getLabel();
105
        status = isHomotypic ? TaxonStatus.SynonymObjective : TaxonStatus.Synonym;
106
    }
107

    
108
    /**
109
     * @return the uuid
110
     */
111
    public UUID getUuid() {
112
        return uuid;
113
    }
114

    
115
    /**
116
     * @return the taxonomicChildrenCount
117
     */
118
    public int getTaxonomicChildrenCount() {
119
        return taxonomicChildrenCount;
120
    }
121

    
122
    /**
123
     * @return the secUuid
124
     */
125
    public UUID getSecUuid() {
126
        return secUuid;
127
    }
128

    
129
    /**
130
     * @return the taxonUuid
131
     */
132
    public UUID getTaxonUuid() {
133
        return taxonUuid;
134
    }
135

    
136
    /**
137
     * @return the titleCache
138
     */
139
    public String getTitleCache() {
140
        return titleCache;
141
    }
142

    
143
    /**
144
     * @return the taggedTitle
145
     */
146
    public List<TaggedText> getTaggedTitle() {
147
        return taggedTitle;
148
    }
149

    
150
    /**
151
     * @return the unplaced
152
     */
153
    public boolean isUnplaced() {
154
        return unplaced;
155
    }
156

    
157
    /**
158
     * @return the excluded
159
     */
160
    public boolean isExcluded() {
161
        return excluded;
162
    }
163

    
164
    /**
165
     * @return the rankLabel
166
     */
167
    public String getRankLabel() {
168
        return rankLabel;
169
    }
170

    
171
    /**
172
     * @return the status
173
     */
174
    public TaxonStatus getStatus() {
175
        return status;
176
    }
177

    
178

    
179
}
(4-4/7)