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() != 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
|
if (name != null && name.getRank() != null){
|
46
|
this.rankOrderIndex = name != null ? name.getRank().getOrderIndex(): null;
|
47
|
this.rankLabel = name != null ? name.getRank().getLabel(): null;
|
48
|
}else{
|
49
|
this.rankOrderIndex = null;
|
50
|
this.rankLabel = null;
|
51
|
}
|
52
|
|
53
|
//}
|
54
|
|
55
|
this.descriptionsWrapper = new TaxonDescriptionDTO(taxon);
|
56
|
|
57
|
|
58
|
}
|
59
|
|
60
|
/* ------ Getter / Setter -----------*/
|
61
|
|
62
|
/**
|
63
|
* @return the taxonUuid
|
64
|
*/
|
65
|
public UUID getTaxonUuid() {
|
66
|
return taxonUUID;
|
67
|
}
|
68
|
|
69
|
|
70
|
|
71
|
/**
|
72
|
* @return the nameCache
|
73
|
*/
|
74
|
public String getNameCache() {
|
75
|
return nameCache;
|
76
|
}
|
77
|
|
78
|
/**
|
79
|
* @param nameCache the nameCache to set
|
80
|
*/
|
81
|
public void setNameCache(String nameCache) {
|
82
|
this.nameCache = nameCache;
|
83
|
}
|
84
|
|
85
|
/**
|
86
|
* @return the rankString
|
87
|
*/
|
88
|
public String getRankString() {
|
89
|
return rankLabel;
|
90
|
}
|
91
|
|
92
|
/**
|
93
|
* @return the rank
|
94
|
*/
|
95
|
public Integer getRankOrderIndex() {
|
96
|
return rankOrderIndex;
|
97
|
}
|
98
|
|
99
|
/**
|
100
|
* @param rank the rank to set
|
101
|
*/
|
102
|
public void setRank(Rank rank) {
|
103
|
if (rank != null){
|
104
|
this.rankOrderIndex = rank.getOrderIndex();
|
105
|
this.rankLabel = rank.getLabel();
|
106
|
}
|
107
|
}
|
108
|
|
109
|
|
110
|
/**
|
111
|
* @return the descriptionsWrapper
|
112
|
*/
|
113
|
public TaxonDescriptionDTO getDescriptionsWrapper() {
|
114
|
return descriptionsWrapper;
|
115
|
}
|
116
|
|
117
|
/**
|
118
|
* @param descriptionsWrapper the descriptionsWrapper to set
|
119
|
*/
|
120
|
public void setDescriptionsWrapper(TaxonDescriptionDTO descriptionsWrapper) {
|
121
|
this.descriptionsWrapper = descriptionsWrapper;
|
122
|
}
|
123
|
|
124
|
// /**
|
125
|
// * @return the distributionMap
|
126
|
// */
|
127
|
// public Map<NamedArea, Set<DescriptionElementBase>> getDistributionMap() {
|
128
|
// return distributionMap;
|
129
|
// }
|
130
|
//
|
131
|
// /**
|
132
|
// * @param distributionMap the distributionMap to set
|
133
|
// */
|
134
|
// public void setDistributionMap(Map<NamedArea, Set<DescriptionElementBase>> distributionMap) {
|
135
|
// this.distributionMap = distributionMap;
|
136
|
// }
|
137
|
|
138
|
}
|