2 * Copyright (C) 2023 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
.dto
.portal
;
11 import java
.beans
.Transient
;
12 import java
.util
.ArrayList
;
13 import java
.util
.List
;
14 import java
.util
.UUID
;
16 import eu
.etaxonomy
.cdm
.api
.dto
.portal
.TaxonPageDto
.NameRelationDTO
;
17 import eu
.etaxonomy
.cdm
.api
.dto
.portal
.TaxonPageDto
.NomenclaturalStatusDTO
;
18 import eu
.etaxonomy
.cdm
.common
.URI
;
19 import eu
.etaxonomy
.cdm
.strategy
.cache
.TaggedText
;
25 public class TaxonBaseDto
extends IdentifiableDto
{
27 public class TaxonNameDto
extends IdentifiableDto
{
30 private String nameType
;
32 private ContainerDto
<NomenclaturalStatusDTO
> status
;
34 private ContainerDto
<NameRelationDTO
> relatedNames
;
36 private List
<URI
> protologues
;
38 private ContainerDto
<FeatureDto
> nameFacts
;
40 //TODO maybe later this can be combined with taggedLabel (merge taxon and name taggedText)
41 private List
<TaggedText
> taggedName
;
43 private boolean hasRegistration
;
45 private boolean isInvalid
;
47 //*********** GETTER / SETTER *******************/
49 public List
<TaggedText
> getTaggedName() {
52 public void setTaggedName(List
<TaggedText
> taggedName
) {
53 this.taggedName
= taggedName
;
56 public ContainerDto
<FeatureDto
> getNameFacts() {
59 public void setNameFacts(ContainerDto
<FeatureDto
> nameFacts
) {
60 this.nameFacts
= nameFacts
;
63 public List
<URI
> getProtologues() {
66 public void addProtologue(URI uri
) {
67 if (protologues
== null) {
68 protologues
= new ArrayList
<>();
73 public ContainerDto
<NameRelationDTO
> getRelatedNames() {
76 public void addRelatedName(NameRelationDTO relatedName
) {
77 if (this.relatedNames
== null) {
78 this.relatedNames
= new ContainerDto
<>();
80 this.relatedNames
.addItem(relatedName
);
82 //TODO either set or add
83 public void setRelatedNames(ContainerDto
<NameRelationDTO
> relatedNames
) {
84 this.relatedNames
= relatedNames
;
88 public ContainerDto
<NomenclaturalStatusDTO
> getStatus(){
91 public void addStatus(NomenclaturalStatusDTO nomenclaturalStatus
) {
92 if (this.status
== null) {
93 this.status
= new ContainerDto
<>();
95 this.status
.addItem(nomenclaturalStatus
);
97 //TODO either set or add
98 public void setStatus(ContainerDto
<NomenclaturalStatusDTO
> nomenclaturalStatuss
) {
99 this.status
= nomenclaturalStatuss
;
102 public String
getType() {
105 public void setType(String nameType
) {
106 this.nameType
= nameType
;
109 public boolean isInvalid() {
112 public void setInvalid(boolean isInvalid
) {
113 this.isInvalid
= isInvalid
;
116 public boolean isHasRegistration() {
117 return hasRegistration
;
119 public void setHasRegistration(boolean hasRegistration
) {
120 this.hasRegistration
= hasRegistration
;
124 private TaxonNameDto name
;
126 //TODO should we distinguish data parts (e.g. on general page we do not need last updates from synonymy)
130 //TODO should we keep formatting client side or should we do formatting on server side? Formatting means: filter, italics, order??
131 // private List<TypedLabel> typedTaxonLabel;
132 // private List<TypedLabel> typedNameLabel;
134 private List
<TaggedText
> taggedLabel
;
136 public String
getNameLabel() {
137 return getName().getLabel();
139 public void setNameLabel(String nameLabel
) {
140 getName().setLabel(nameLabel
);
143 public UUID
getNameUuid() {
144 return getName().getUuid();
146 public void setNameUuid(UUID nameUuid
) {
147 getName().setUuid(nameUuid
);
150 public String
getNameType() {
151 return getName().getType();
153 public void setNameType(String nameType
) {
154 getName().setType(nameType
);
157 public List
<TaggedText
> getTaggedLabel() {
160 public void setTaggedLabel(List
<TaggedText
> taggedLabel
) {
161 this.taggedLabel
= taggedLabel
;
164 public List
<TaggedText
> getTaggedName() {
165 return getName().getTaggedName();
167 public void setTaggedName(List
<TaggedText
> taggedName
) {
168 getName().setTaggedName(taggedName
);
171 public ContainerDto
<NameRelationDTO
> getRelatedNames() {
172 return getName().getRelatedNames();
174 public void addRelatedName(NameRelationDTO relatedName
) {
175 getName().addRelatedName(relatedName
);
177 //TODO either set or add
178 public void setRelatedNames(ContainerDto
<NameRelationDTO
> relatedNames
) {
179 getName().setRelatedNames(relatedNames
);
182 public ContainerDto
<NomenclaturalStatusDTO
> getNomenclaturalStatus() {
183 return getName().getStatus();
185 public void addNomenclaturalStatus(NomenclaturalStatusDTO status
) {
186 getName().addStatus(status
);
188 //TODO either set or add
189 public void setNomenclaturalStatus(ContainerDto
<NomenclaturalStatusDTO
> status
) {
190 getName().setStatus(status
);
193 public ContainerDto
<FeatureDto
> getNameFacts() {
194 return getName().getNameFacts();
196 public void setNameFacts(ContainerDto
<FeatureDto
> nameFacts
) {
197 getName().setNameFacts(nameFacts
);
200 public boolean isInvalid() {
201 return getName().isInvalid();
204 public boolean isHasRegistration() {
205 return getName().isHasRegistration();
210 public List
<URI
> getProtologues() {
211 return getName().getProtologues();
213 public void addProtologue(URI uri
) {
214 getName().addProtologue(uri
);
217 //TODO we shouldn't have @transient on a DTO, try to solve this in a better way
219 @javax.persistence
.Transient
220 public TaxonNameDto
getName() {
222 name
= new TaxonNameDto();
226 public void setName(TaxonNameDto name
) {
231 public ContainerDto
<IdentifierDto
> getIdentifiers() {
232 //TODO we also need to support taxon identifiers
233 return getName().getIdentifiers();
237 //appendedPhras, useNameCache, doubtful, name, publish
238 // => should all be part of the typedLabel
240 //secsource ?? how to handle? part of bibliography
243 //rank, nameparts => all in typedLabel
245 //types ?? => Teil der homotypischen Gruppe, außer der Fall von Walter (für name types?)