2 * Copyright (C) 2020 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
.vaadin
.model
.name
;
11 import java
.io
.Serializable
;
13 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCodeEdition
;
14 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
15 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatusType
;
16 import eu
.etaxonomy
.cdm
.model
.reference
.NamedSource
;
17 import eu
.etaxonomy
.cdm
.model
.reference
.OriginalSourceType
;
18 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
21 * @author a.kohlbecker
24 public class NomenclaturalStatusDTO
implements Serializable
{
26 private static final long serialVersionUID
= -7019899466081978199L;
28 private Integer id
= 0;
30 NomenclaturalStatusType type
;
34 NomenclaturalCodeEdition codeEdition
;
36 String citationMicroReference
;
38 String ruleConsidered
;
40 public static NomenclaturalStatusDTO
from(NomenclaturalStatus nomStatus
) {
41 return new NomenclaturalStatusDTO(nomStatus
.getId(), nomStatus
.getType(), nomStatus
.getCitation(),
42 nomStatus
.getCitationMicroReference(), nomStatus
.getRuleConsidered(), nomStatus
.getCodeEdition());
46 public static NomenclaturalStatusDTO
newInstance() {
47 return new NomenclaturalStatusDTO();
52 * Update an existing or create a new {@link NomenclaturalStatus} for this
56 * the {@link NomenclaturalStatus} to update or <code>null</code>
57 * in which case a new entity instance will be created.
58 * @return the new or updated entity
60 public NomenclaturalStatus
update(NomenclaturalStatus nomStatus
) {
61 if (nomStatus
== null) {
62 nomStatus
= NomenclaturalStatus
.NewInstance(type
);
64 nomStatus
.setType(type
);
66 nomStatus
.setRuleConsidered(ruleConsidered
);
67 if (citation
!= null || citationMicroReference
!= null) {
68 if (nomStatus
.getSource() == null) {
70 // DescriptionElementSource.NewInstance(OriginalSourceType.PrimaryTaxonomicSource)
71 nomStatus
.setSource(NamedSource
.NewInstance(OriginalSourceType
.PrimaryTaxonomicSource
));
73 nomStatus
.getSource().setCitation(citation
);
74 nomStatus
.getSource().setCitationMicroReference(citationMicroReference
);
76 nomStatus
.setCodeEdition(codeEdition
);
81 public NomenclaturalStatusDTO(Integer id
, NomenclaturalStatusType type
, Reference citation
,
82 String citationMicroReference
, String ruleConsidered
, NomenclaturalCodeEdition codeEdition
) {
85 this.citation
= citation
;
86 this.citationMicroReference
= citationMicroReference
;
87 this.ruleConsidered
= ruleConsidered
;
88 this.codeEdition
= codeEdition
;
94 public NomenclaturalStatusDTO() {
95 // TODO Auto-generated constructor stub
98 public NomenclaturalStatusType
getType() {
102 public void setType(NomenclaturalStatusType type
) {
106 public Reference
getCitation() {
110 public void setCitation(Reference citation
) {
111 this.citation
= citation
;
114 public String
getCitationMicroReference() {
115 return citationMicroReference
;
118 public NomenclaturalCodeEdition
getCodeEdition() {
122 public void setCodeEdition(NomenclaturalCodeEdition codeEdition
) {
123 this.codeEdition
= codeEdition
;
126 public void setCitationMicroReference(String citationMicroReference
) {
127 this.citationMicroReference
= citationMicroReference
;
130 public String
getRuleConsidered() {
131 return ruleConsidered
;
134 public void setRuleConsidered(String ruleConsidered
) {
135 this.ruleConsidered
= ruleConsidered
;
139 * The {@link NomenclaturalStatus#getId()} of the original status entity for
140 * which this DTO has been created.
142 * When the DTO has no corresponding entity in the db the id has the value
145 public Integer
getId() {