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.vaadin.model.name;
|
10
|
|
11
|
import java.util.HashMap;
|
12
|
import java.util.HashSet;
|
13
|
import java.util.List;
|
14
|
import java.util.Map;
|
15
|
import java.util.Set;
|
16
|
|
17
|
import org.joda.time.DateTime;
|
18
|
|
19
|
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
|
20
|
import eu.etaxonomy.cdm.model.common.Annotation;
|
21
|
import eu.etaxonomy.cdm.model.common.Credit;
|
22
|
import eu.etaxonomy.cdm.model.common.Extension;
|
23
|
import eu.etaxonomy.cdm.model.common.Identifier;
|
24
|
import eu.etaxonomy.cdm.model.common.RelationshipBase.Direction;
|
25
|
import eu.etaxonomy.cdm.model.common.User;
|
26
|
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
|
27
|
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
|
28
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
29
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
|
30
|
import eu.etaxonomy.cdm.model.name.Rank;
|
31
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
32
|
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
|
33
|
import eu.etaxonomy.cdm.vaadin.model.CdmEntityDecoraterDTO;
|
34
|
|
35
|
/**
|
36
|
* @author a.kohlbecker
|
37
|
* @since Apr 23, 2018
|
38
|
*
|
39
|
*/
|
40
|
public class TaxonNameDTO extends CdmEntityDecoraterDTO<TaxonName> {
|
41
|
|
42
|
class TN extends TaxonName {
|
43
|
|
44
|
}
|
45
|
|
46
|
private static final long serialVersionUID = -8018109905949198530L;
|
47
|
|
48
|
private TaxonName name;
|
49
|
|
50
|
/**
|
51
|
* @param entity
|
52
|
*/
|
53
|
public TaxonNameDTO(TaxonName entity) {
|
54
|
super(entity);
|
55
|
name = entity;
|
56
|
}
|
57
|
|
58
|
public String getAcronym() {
|
59
|
return name.getAcronym();
|
60
|
}
|
61
|
|
62
|
public Set<Annotation> getAnnotations() {
|
63
|
return name.getAnnotations();
|
64
|
}
|
65
|
|
66
|
public String getAppendedPhrase() {
|
67
|
return name.getAppendedPhrase();
|
68
|
}
|
69
|
|
70
|
public String getAuthorshipCache() {
|
71
|
|
72
|
return name.getAuthorshipCache();
|
73
|
}
|
74
|
|
75
|
public TeamOrPersonBase<?> getBasionymAuthorship() {
|
76
|
return name.getBasionymAuthorship();
|
77
|
}
|
78
|
|
79
|
public Set<TaxonName> getBasionyms() {
|
80
|
return name.getRelatedNames(Direction.relatedTo, NameRelationshipType.BASIONYM());
|
81
|
}
|
82
|
|
83
|
public void setBasionyms(Set<TaxonName> basionyms) {
|
84
|
setRelatedTaxa(Direction.relatedTo, NameRelationshipType.BASIONYM(), basionyms);
|
85
|
}
|
86
|
|
87
|
/**
|
88
|
* @param basionyms
|
89
|
* @param relType
|
90
|
* @param direction
|
91
|
*/
|
92
|
protected void setRelatedTaxa(Direction direction, NameRelationshipType relType, Set<TaxonName> basionyms) {
|
93
|
Map<Integer, TaxonName> currentBasionymUuids = new HashMap<>();
|
94
|
Set<Integer> basionymsSeen = new HashSet<>();
|
95
|
|
96
|
for(TaxonName tn : name.getRelatedNames(direction, relType)){
|
97
|
currentBasionymUuids.put(tn.getId(), tn);
|
98
|
}
|
99
|
for(TaxonName tn : basionyms){
|
100
|
if(!currentBasionymUuids.containsKey(tn.getId())){
|
101
|
name.addBasionym(tn);
|
102
|
} else {
|
103
|
basionymsSeen.add(tn.getId());
|
104
|
}
|
105
|
}
|
106
|
for(TaxonName tn : basionyms){
|
107
|
if(!basionymsSeen.contains(tn.getId())){
|
108
|
name.removeRelationWithTaxonName(tn, direction, relType);
|
109
|
}
|
110
|
}
|
111
|
}
|
112
|
|
113
|
public TeamOrPersonBase<?> getCombinationAuthorship() {
|
114
|
return name.getCombinationAuthorship();
|
115
|
}
|
116
|
|
117
|
public List<Credit> getCredits() {
|
118
|
return name.getCredits();
|
119
|
}
|
120
|
|
121
|
public String getCultivarName() {
|
122
|
return name.getCultivarName();
|
123
|
}
|
124
|
|
125
|
public TeamOrPersonBase<?> getExBasionymAuthorship() {
|
126
|
return name.getExBasionymAuthorship();
|
127
|
}
|
128
|
|
129
|
public TeamOrPersonBase<?> getExCombinationAuthorship() {
|
130
|
return name.getExCombinationAuthorship();
|
131
|
}
|
132
|
|
133
|
public Set<Extension> getExtensions() {
|
134
|
return name.getExtensions();
|
135
|
}
|
136
|
|
137
|
public String getFullTitleCache() {
|
138
|
return name.getFullTitleCache();
|
139
|
}
|
140
|
|
141
|
public String getGenusOrUninomial() {
|
142
|
return name.getGenusOrUninomial();
|
143
|
}
|
144
|
|
145
|
public HomotypicalGroup getHomotypicalGroup() {
|
146
|
return name.getHomotypicalGroup();
|
147
|
}
|
148
|
|
149
|
public List<Identifier> getIdentifiers() {
|
150
|
return name.getIdentifiers();
|
151
|
}
|
152
|
|
153
|
public String getInfraGenericEpithet() {
|
154
|
return name.getInfraGenericEpithet();
|
155
|
}
|
156
|
|
157
|
public String getInfraSpecificEpithet() {
|
158
|
return name.getInfraSpecificEpithet();
|
159
|
}
|
160
|
|
161
|
public String getSpecificEpithet() {
|
162
|
return name.getSpecificEpithet();
|
163
|
}
|
164
|
|
165
|
public String getNameCache() {
|
166
|
return name.getNameCache();
|
167
|
}
|
168
|
|
169
|
public String getNomenclaturalMicroReference() {
|
170
|
return name.getNomenclaturalMicroReference();
|
171
|
}
|
172
|
|
173
|
public INomenclaturalReference getNomenclaturalReference() {
|
174
|
return name.getNomenclaturalReference();
|
175
|
}
|
176
|
|
177
|
public Rank getRank() {
|
178
|
return name.getRank();
|
179
|
}
|
180
|
|
181
|
public Set<NomenclaturalStatus> getStatus() {
|
182
|
return name.getStatus();
|
183
|
}
|
184
|
|
185
|
public boolean isProtectedAuthorshipCache() {
|
186
|
return name.isProtectedAuthorshipCache();
|
187
|
}
|
188
|
|
189
|
public boolean isProtectedFullTitleCache() {
|
190
|
return name.isProtectedFullTitleCache();
|
191
|
}
|
192
|
|
193
|
public boolean isProtectedNameCache() {
|
194
|
return name.isProtectedNameCache();
|
195
|
}
|
196
|
|
197
|
public boolean isProtectedTitleCache() {
|
198
|
return name.isProtectedTitleCache();
|
199
|
}
|
200
|
|
201
|
public void setAcronym(String acronym) {
|
202
|
name.setAcronym(acronym);
|
203
|
}
|
204
|
|
205
|
public void setAppendedPhrase(String appendedPhrase) {
|
206
|
name.setAppendedPhrase(appendedPhrase);
|
207
|
}
|
208
|
|
209
|
public void setBasionymAuthorship(TeamOrPersonBase<?> basionymAuthorship) {
|
210
|
name.setBasionymAuthorship(basionymAuthorship);
|
211
|
}
|
212
|
|
213
|
public void setBinomHybrid(boolean binomHybrid) {
|
214
|
name.setBinomHybrid(binomHybrid);
|
215
|
}
|
216
|
|
217
|
public void setBreed(String breed) {
|
218
|
name.setBreed(breed);
|
219
|
}
|
220
|
|
221
|
public void setCombinationAuthorship(TeamOrPersonBase<?> combinationAuthorship) {
|
222
|
name.setCombinationAuthorship(combinationAuthorship);
|
223
|
}
|
224
|
|
225
|
public void setCultivarName(String cultivarName) {
|
226
|
name.setCultivarName(cultivarName);
|
227
|
}
|
228
|
|
229
|
public void setExBasionymAuthorship(TeamOrPersonBase<?> exBasionymAuthorship) {
|
230
|
name.setExBasionymAuthorship(exBasionymAuthorship);
|
231
|
}
|
232
|
|
233
|
public void setExCombinationAuthorship(TeamOrPersonBase<?> exCombinationAuthorship) {
|
234
|
name.setExCombinationAuthorship(exCombinationAuthorship);
|
235
|
}
|
236
|
|
237
|
public void setFullTitleCache(String fullTitleCache) {
|
238
|
name.setFullTitleCache(fullTitleCache);
|
239
|
}
|
240
|
|
241
|
public void setGenusOrUninomial(String genusOrUninomial) {
|
242
|
name.setGenusOrUninomial(genusOrUninomial);
|
243
|
}
|
244
|
|
245
|
public void setHybridFormula(boolean hybridFormula) {
|
246
|
name.setHybridFormula(hybridFormula);
|
247
|
}
|
248
|
|
249
|
public void setInfraGenericEpithet(String infraGenericEpithet) {
|
250
|
name.setInfraGenericEpithet(infraGenericEpithet);
|
251
|
}
|
252
|
|
253
|
public void setInfraSpecificEpithet(String infraSpecificEpithet) {
|
254
|
name.setInfraSpecificEpithet(infraSpecificEpithet);
|
255
|
}
|
256
|
|
257
|
public void setMonomHybrid(boolean monomHybrid) {
|
258
|
name.setMonomHybrid(monomHybrid);
|
259
|
}
|
260
|
|
261
|
public void setNameApprobation(String nameApprobation) {
|
262
|
name.setNameApprobation(nameApprobation);
|
263
|
}
|
264
|
|
265
|
public void setNameCache(String nameCache) {
|
266
|
name.setNameCache(nameCache);
|
267
|
}
|
268
|
|
269
|
public void setNameType(NomenclaturalCode nameType) {
|
270
|
name.setNameType(nameType);
|
271
|
}
|
272
|
|
273
|
public void setNomenclaturalMicroReference(String nomenclaturalMicroReference) {
|
274
|
name.setNomenclaturalMicroReference(nomenclaturalMicroReference);
|
275
|
}
|
276
|
|
277
|
public void setNomenclaturalReference(INomenclaturalReference nomenclaturalReference) {
|
278
|
name.setNomenclaturalReference(nomenclaturalReference);
|
279
|
}
|
280
|
|
281
|
public void setProtectedAuthorshipCache(boolean protectedAuthorshipCache) {
|
282
|
name.setProtectedAuthorshipCache(protectedAuthorshipCache);
|
283
|
}
|
284
|
|
285
|
public void setProtectedFullTitleCache(boolean protectedFullTitleCache) {
|
286
|
name.setProtectedFullTitleCache(protectedFullTitleCache);
|
287
|
}
|
288
|
|
289
|
public void setProtectedNameCache(boolean protectedNameCache) {
|
290
|
name.setProtectedNameCache(protectedNameCache);
|
291
|
}
|
292
|
|
293
|
public void setProtectedTitleCache(boolean protectedTitleCache) {
|
294
|
name.setProtectedTitleCache(protectedTitleCache);
|
295
|
}
|
296
|
|
297
|
public void setRank(Rank rank) {
|
298
|
name.setRank(rank);
|
299
|
}
|
300
|
|
301
|
public void setSpecificEpithet(String specificEpithet) {
|
302
|
name.setSpecificEpithet(specificEpithet);
|
303
|
}
|
304
|
|
305
|
public void setTitleCache(String titleCache) {
|
306
|
name.setTitleCache(titleCache);
|
307
|
}
|
308
|
|
309
|
public void setTrinomHybrid(boolean trinomHybrid) {
|
310
|
name.setTrinomHybrid(trinomHybrid);
|
311
|
}
|
312
|
|
313
|
public void setUpdated(DateTime updated) {
|
314
|
name.setUpdated(updated);
|
315
|
}
|
316
|
|
317
|
public void setUpdatedBy(User updatedBy) {
|
318
|
name.setUpdatedBy(updatedBy);
|
319
|
}
|
320
|
|
321
|
}
|