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.HashSet;
|
13
|
import java.util.Set;
|
14
|
import java.util.UUID;
|
15
|
|
16
|
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
|
17
|
import eu.etaxonomy.cdm.model.description.Distribution;
|
18
|
import eu.etaxonomy.cdm.model.description.TaxonDescription;
|
19
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
20
|
|
21
|
/**
|
22
|
* @author k.luther
|
23
|
* @since 30.11.2018
|
24
|
*
|
25
|
*/
|
26
|
public class TaxonDescriptionDTO implements Serializable{
|
27
|
|
28
|
private static final long serialVersionUID = -4440059497898077690L;
|
29
|
UUID taxonUUID;
|
30
|
Set<TaxonDescription> descriptions = new HashSet();
|
31
|
|
32
|
public TaxonDescriptionDTO(Taxon taxon){
|
33
|
this.taxonUUID = taxon.getUuid();
|
34
|
for (TaxonDescription desc: taxon.getDescriptions()){
|
35
|
for (DescriptionElementBase element: desc.getElements()){
|
36
|
if (element instanceof Distribution){
|
37
|
descriptions.add(desc);
|
38
|
break;
|
39
|
}
|
40
|
}
|
41
|
}
|
42
|
}
|
43
|
|
44
|
|
45
|
|
46
|
|
47
|
/**
|
48
|
* @return the descriptions
|
49
|
*/
|
50
|
public Set<TaxonDescription> getDescriptions() {
|
51
|
return descriptions;
|
52
|
}
|
53
|
|
54
|
/**
|
55
|
* @param descriptions the descriptions to set
|
56
|
*/
|
57
|
public void setDescriptions(Set<TaxonDescription> descriptions) {
|
58
|
this.descriptions = descriptions;
|
59
|
}
|
60
|
|
61
|
/**
|
62
|
* @return the taxonUUID
|
63
|
*/
|
64
|
public UUID getTaxonUUID() {
|
65
|
return taxonUUID;
|
66
|
}
|
67
|
|
68
|
/**
|
69
|
* @param taxonUUID the taxonUUID to set
|
70
|
*/
|
71
|
public void setTaxonUUID(UUID taxonUUID) {
|
72
|
this.taxonUUID = taxonUUID;
|
73
|
}
|
74
|
|
75
|
|
76
|
|
77
|
|
78
|
|
79
|
|
80
|
}
|