2 * Copyright (C) 2018 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.cdm
.api
.service
.dto
;
11 import java
.io
.Serializable
;
12 import java
.util
.HashSet
;
14 import java
.util
.UUID
;
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
.metadata
.DistributionDescription
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
26 public class TaxonDescriptionDTO
implements Serializable
{
28 private static final long serialVersionUID
= -4440059497898077690L;
30 Set
<TaxonDescription
> descriptions
= new HashSet
<>();
32 public TaxonDescriptionDTO(Taxon taxon
, DistributionDescription descHandling
){
33 this.taxonUUID
= taxon
.getUuid();
35 for (TaxonDescription desc
: taxon
.getDescriptions()){
36 if (desc
.isDefault()) {
37 descriptions
.add(desc
);
40 // if (descriptions.isEmpty() || descHandling.equals(DistributionDescription.UseAlreadyExisting)) {
41 for (TaxonDescription desc
: taxon
.getDescriptions()){
42 if (desc
.isComputed()) {
45 for (DescriptionElementBase element
: desc
.getElements()){
46 if (element
instanceof Distribution
){
47 descriptions
.add(desc
);
54 public Set
<TaxonDescription
> getDescriptions() {
57 public void setDescriptions(Set
<TaxonDescription
> descriptions
) {
58 this.descriptions
= descriptions
;
61 public UUID
getTaxonUUID() {
64 public void setTaxonUUID(UUID taxonUUID
) {
65 this.taxonUUID
= taxonUUID
;