Project

General

Profile

Download (3.86 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2016 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
package eu.etaxonomy.cdm.persistence.dto;
10

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

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

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

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

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

    
36

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

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

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

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

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

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

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

    
72
    private final TaxonStatus status;
73

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

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

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

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

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

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

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

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

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

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

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

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

    
177

    
178
}
(4-4/7)