Project

General

Profile

Download (3.32 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
        this.nameCache = taxon.getName().getNameCache() != null ? taxon.getName().getNameCache(): taxon.getName().getTitleCache();
40
        if (nameCache == null){
41
            nameCache = taxon.getTitleCache();
42
        }
43
        if (taxon.getName() != null){
44
            TaxonName name = HibernateProxyHelper.deproxy(taxon.getName(), TaxonName.class);
45
            this.rankOrderIndex = name != null ? name.getRank().getOrderIndex(): null;
46
            this.rankLabel = name != null ? name.getRank().getLabel(): null;
47
        }
48

    
49
        this.descriptionsWrapper = new TaxonDescriptionDTO(taxon);
50

    
51

    
52
    }
53

    
54
   /* ------ Getter / Setter -----------*/
55

    
56
    /**
57
     * @return the taxonUuid
58
     */
59
    public UUID getTaxonUuid() {
60
        return taxonUUID;
61
    }
62

    
63

    
64

    
65
    /**
66
     * @return the nameCache
67
     */
68
    public String getNameCache() {
69
        return nameCache;
70
    }
71

    
72
    /**
73
     * @param nameCache the nameCache to set
74
     */
75
    public void setNameCache(String nameCache) {
76
        this.nameCache = nameCache;
77
    }
78

    
79
    /**
80
     * @return the rankString
81
     */
82
    public String getRankString() {
83
        return rankLabel;
84
    }
85

    
86
    /**
87
     * @return the rank
88
     */
89
    public Integer getRankOrderIndex() {
90
        return rankOrderIndex;
91
    }
92

    
93
    /**
94
     * @param rank the rank to set
95
     */
96
    public void setRank(Rank rank) {
97
        if (rank != null){
98
            this.rankOrderIndex = rank.getOrderIndex();
99
            this.rankLabel = rank.getLabel();
100
        }
101
    }
102

    
103

    
104
    /**
105
     * @return the descriptionsWrapper
106
     */
107
    public TaxonDescriptionDTO getDescriptionsWrapper() {
108
        return descriptionsWrapper;
109
    }
110

    
111
    /**
112
     * @param descriptionsWrapper the descriptionsWrapper to set
113
     */
114
    public void setDescriptionsWrapper(TaxonDescriptionDTO descriptionsWrapper) {
115
        this.descriptionsWrapper = descriptionsWrapper;
116
    }
117

    
118
//    /**
119
//     * @return the distributionMap
120
//     */
121
//    public Map<NamedArea, Set<DescriptionElementBase>> getDistributionMap() {
122
//        return distributionMap;
123
//    }
124
//
125
//    /**
126
//     * @param distributionMap the distributionMap to set
127
//     */
128
//    public void setDistributionMap(Map<NamedArea, Set<DescriptionElementBase>> distributionMap) {
129
//        this.distributionMap = distributionMap;
130
//    }
131

    
132
}
(27-27/30)