Project

General

Profile

Download (3.48 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2018 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.api.service.dto;
10

    
11
import java.io.Serializable;
12
import java.util.UUID;
13

    
14
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
15
import eu.etaxonomy.cdm.model.name.Rank;
16
import eu.etaxonomy.cdm.model.name.TaxonName;
17
import eu.etaxonomy.cdm.model.taxon.Taxon;
18

    
19
/**
20
 * @author k.luther
21
 * @since 27.11.2018
22
 *
23
 */
24
public class TaxonDistributionDTO implements Serializable{
25

    
26
    private static final long serialVersionUID = -6565463192135410612L;
27
    UUID taxonUUID;
28
    String nameCache;
29
    Integer rankOrderIndex = null;
30
    String rankLabel = null;
31
    TaxonDescriptionDTO descriptionsWrapper;
32
//    Map<NamedArea,Set<DescriptionElementBase>> distributionMap = new HashMap();
33

    
34

    
35

    
36
    public TaxonDistributionDTO(Taxon taxon){
37
        this.taxonUUID = taxon.getUuid();
38
        taxon = HibernateProxyHelper.deproxy(taxon);
39
        if (taxon.getName() != null){
40
            this.nameCache = taxon.getName().getNameCache();
41
        }
42
        if (nameCache == null){
43
            nameCache = taxon.getTitleCache();
44
        }
45
        //if (taxon.getName() != null){
46
            TaxonName name = HibernateProxyHelper.deproxy(taxon.getName(), TaxonName.class);
47
            if (name != null && name.getRank() != null){
48
                this.rankOrderIndex = name != null ? name.getRank().getOrderIndex(): null;
49
                this.rankLabel = name != null ? name.getRank().getLabel(): null;
50
            }else{
51
                this.rankOrderIndex = null;
52
                this.rankLabel = null;
53
            }
54

    
55
        //}
56

    
57
        this.descriptionsWrapper = new TaxonDescriptionDTO(taxon);
58

    
59

    
60
    }
61

    
62
   /* ------ Getter / Setter -----------*/
63

    
64
    /**
65
     * @return the taxonUuid
66
     */
67
    public UUID getTaxonUuid() {
68
        return taxonUUID;
69
    }
70

    
71

    
72

    
73
    /**
74
     * @return the nameCache
75
     */
76
    public String getNameCache() {
77
        return nameCache;
78
    }
79

    
80
    /**
81
     * @param nameCache the nameCache to set
82
     */
83
    public void setNameCache(String nameCache) {
84
        this.nameCache = nameCache;
85
    }
86

    
87
    /**
88
     * @return the rankString
89
     */
90
    public String getRankString() {
91
        return rankLabel;
92
    }
93

    
94
    /**
95
     * @return the rank
96
     */
97
    public Integer getRankOrderIndex() {
98
        return rankOrderIndex;
99
    }
100

    
101
    /**
102
     * @param rank the rank to set
103
     */
104
    public void setRank(Rank rank) {
105
        if (rank != null){
106
            this.rankOrderIndex = rank.getOrderIndex();
107
            this.rankLabel = rank.getLabel();
108
        }
109
    }
110

    
111

    
112
    /**
113
     * @return the descriptionsWrapper
114
     */
115
    public TaxonDescriptionDTO getDescriptionsWrapper() {
116
        return descriptionsWrapper;
117
    }
118

    
119
    /**
120
     * @param descriptionsWrapper the descriptionsWrapper to set
121
     */
122
    public void setDescriptionsWrapper(TaxonDescriptionDTO descriptionsWrapper) {
123
        this.descriptionsWrapper = descriptionsWrapper;
124
    }
125

    
126
//    /**
127
//     * @return the distributionMap
128
//     */
129
//    public Map<NamedArea, Set<DescriptionElementBase>> getDistributionMap() {
130
//        return distributionMap;
131
//    }
132
//
133
//    /**
134
//     * @param distributionMap the distributionMap to set
135
//     */
136
//    public void setDistributionMap(Map<NamedArea, Set<DescriptionElementBase>> distributionMap) {
137
//        this.distributionMap = distributionMap;
138
//    }
139

    
140
}
(27-27/30)