1
|
/**
|
2
|
* Copyright (C) 2019 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.ArrayList;
|
13
|
import java.util.List;
|
14
|
import java.util.stream.Collectors;
|
15
|
|
16
|
import eu.etaxonomy.cdm.api.service.l10n.TermRepresentation_L10n;
|
17
|
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
|
18
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
19
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
20
|
import eu.etaxonomy.cdm.ref.EntityReference;
|
21
|
import eu.etaxonomy.cdm.ref.TypedEntityReference;
|
22
|
|
23
|
/**
|
24
|
* @author k.luther
|
25
|
* @since 12.04.2019
|
26
|
*
|
27
|
*/
|
28
|
public class SpecimenTypeDesignationDTO extends TypedEntityReference<SpecimenTypeDesignation> implements Serializable{
|
29
|
private static final long serialVersionUID = -2397286652498492934L;
|
30
|
|
31
|
private List<EntityReference> names;
|
32
|
private TypedEntityReference<DerivedUnit> typeSpecimen;
|
33
|
private String typeStatus;
|
34
|
private String typeStatus_L10n;
|
35
|
private SourceDTO designationSource;
|
36
|
private List<RegistrationDTO> registrations;
|
37
|
|
38
|
/**
|
39
|
*
|
40
|
* @param typeDesignation
|
41
|
* @param typeSpecimenDTO
|
42
|
* Can be null
|
43
|
*/
|
44
|
public SpecimenTypeDesignationDTO(SpecimenTypeDesignation typeDesignation) {
|
45
|
|
46
|
super(SpecimenTypeDesignation.class, typeDesignation.getUuid());
|
47
|
|
48
|
if (typeDesignation.getTypeStatus() != null){
|
49
|
this.typeStatus = typeDesignation.getTypeStatus().generateTitle();
|
50
|
TermRepresentation_L10n term_L10n = new TermRepresentation_L10n(typeDesignation.getTypeStatus(), false);
|
51
|
typeStatus_L10n = term_L10n.getText();
|
52
|
|
53
|
}
|
54
|
this.names = new ArrayList<>();
|
55
|
for (TaxonName name:typeDesignation.getTypifiedNames()){
|
56
|
names.add(new EntityReference(name.getUuid(), name.getTitleCache()));
|
57
|
}
|
58
|
this.setDesignationSource(SourceDTO.fromDescriptionElementSource(typeDesignation.getDesignationSource()));
|
59
|
this.typeSpecimen = TypedEntityReference.fromEntity(typeDesignation.getTypeSpecimen());
|
60
|
setRegistrations(typeDesignation.getRegistrations().stream().map(reg -> new RegistrationDTO(reg)).collect(Collectors.toList()));
|
61
|
|
62
|
}
|
63
|
|
64
|
public List<EntityReference> getNames() {
|
65
|
return names;
|
66
|
}
|
67
|
|
68
|
public void setNames(List<EntityReference> names) {
|
69
|
this.names = names;
|
70
|
}
|
71
|
|
72
|
public TypedEntityReference<DerivedUnit> getTypeSpecimen() {
|
73
|
return typeSpecimen;
|
74
|
}
|
75
|
|
76
|
public void setTypeSpecimen(TypedEntityReference<DerivedUnit> typeSpecimen) {
|
77
|
this.typeSpecimen = typeSpecimen;
|
78
|
}
|
79
|
|
80
|
/**
|
81
|
* @deprecated replaced by getTypeStatus_L10n()
|
82
|
*/
|
83
|
@Deprecated
|
84
|
public String getTypeStatus() {
|
85
|
return typeStatus;
|
86
|
}
|
87
|
|
88
|
/**
|
89
|
* @deprecated replaced by getTypeStatus_L10n()
|
90
|
*/
|
91
|
@Deprecated
|
92
|
public void setTypeStatus(String typeStatus) {
|
93
|
this.typeStatus = typeStatus;
|
94
|
}
|
95
|
|
96
|
|
97
|
public void setTypeStatus_L10n(String typeStatus_L10n) {
|
98
|
this.typeStatus_L10n = typeStatus_L10n;
|
99
|
}
|
100
|
|
101
|
public String getTypeStatus_L10n() {
|
102
|
return typeStatus_L10n;
|
103
|
}
|
104
|
|
105
|
public SourceDTO getDesignationSource() {
|
106
|
return designationSource;
|
107
|
}
|
108
|
|
109
|
public void setDesignationSource(SourceDTO source) {
|
110
|
this.designationSource = source;
|
111
|
}
|
112
|
|
113
|
public List<RegistrationDTO> getRegistrations() {
|
114
|
return registrations;
|
115
|
}
|
116
|
|
117
|
public void setRegistrations(List<RegistrationDTO> registrations) {
|
118
|
this.registrations = registrations;
|
119
|
}
|
120
|
|
121
|
|
122
|
|
123
|
}
|