Revision 1d9ed98e
Added by Andreas Kohlbecker over 3 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/dto/SpecimenTypeDesignationDTO.java | ||
---|---|---|
11 | 11 |
import java.io.Serializable; |
12 | 12 |
import java.util.ArrayList; |
13 | 13 |
import java.util.List; |
14 |
import java.util.stream.Collectors; |
|
14 | 15 |
|
15 | 16 |
import eu.etaxonomy.cdm.api.service.l10n.TermRepresentation_L10n; |
16 | 17 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
17 | 18 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
19 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
|
18 | 20 |
import eu.etaxonomy.cdm.ref.EntityReference; |
19 | 21 |
import eu.etaxonomy.cdm.ref.TypedEntityReference; |
20 | 22 |
|
... | ... | |
27 | 29 |
private static final long serialVersionUID = -2397286652498492934L; |
28 | 30 |
|
29 | 31 |
private List<EntityReference> names; |
30 |
private DerivateDTO typeSpecimen;
|
|
32 |
private TypedEntityReference<DerivedUnit> typeSpecimen;
|
|
31 | 33 |
private String typeStatus; |
32 | 34 |
private String typeStatus_L10n; |
35 |
private SourceDTO source; |
|
36 |
private List<RegistrationDTO> registrations; |
|
33 | 37 |
|
34 | 38 |
/** |
35 | 39 |
* |
... | ... | |
37 | 41 |
* @param typeSpecimenDTO |
38 | 42 |
* Can be null |
39 | 43 |
*/ |
40 |
public SpecimenTypeDesignationDTO(SpecimenTypeDesignation typeDesignation, DerivateDTO typeSpecimenDTO) {
|
|
44 |
public SpecimenTypeDesignationDTO(SpecimenTypeDesignation typeDesignation) { |
|
41 | 45 |
|
42 | 46 |
super(SpecimenTypeDesignation.class, typeDesignation.getUuid()); |
43 | 47 |
|
... | ... | |
51 | 55 |
for (TaxonName name:typeDesignation.getTypifiedNames()){ |
52 | 56 |
names.add(new EntityReference(name.getUuid(), name.getTitleCache())); |
53 | 57 |
} |
54 |
this.typeSpecimen = typeSpecimenDTO; |
|
58 |
this.setSource(SourceDTO.fromDescriptionElementSource(typeDesignation.getSource())); |
|
59 |
this.typeSpecimen = TypedEntityReference.fromIdentifiableEntity(typeDesignation.getTypeSpecimen()); |
|
60 |
setRegistrations(typeDesignation.getRegistrations().stream().map(reg -> new RegistrationDTO(reg)).collect(Collectors.toList())); |
|
55 | 61 |
|
56 | 62 |
} |
57 | 63 |
|
... | ... | |
63 | 69 |
this.names = names; |
64 | 70 |
} |
65 | 71 |
|
66 |
public DerivateDTO getTypeSpecimen() {
|
|
72 |
public TypedEntityReference<DerivedUnit> getTypeSpecimen() {
|
|
67 | 73 |
return typeSpecimen; |
68 | 74 |
} |
69 | 75 |
|
70 |
public void setTypeSpecimen(DerivateDTO typeSpecimen) {
|
|
76 |
public void setTypeSpecimen(TypedEntityReference<DerivedUnit> typeSpecimen) {
|
|
71 | 77 |
this.typeSpecimen = typeSpecimen; |
72 | 78 |
} |
73 | 79 |
|
... | ... | |
96 | 102 |
return typeStatus_L10n; |
97 | 103 |
} |
98 | 104 |
|
105 |
public SourceDTO getSource() { |
|
106 |
return source; |
|
107 |
} |
|
108 |
|
|
109 |
public void setSource(SourceDTO source) { |
|
110 |
this.source = 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 |
|
|
99 | 121 |
|
100 | 122 |
|
101 | 123 |
} |
Also available in: Unified diff
ref #9238 extending SpecimenTypeDesignationDTO with more fields and associated DTOs, introducing ReferenceDTO, supressing unwanted and dangerous fields of RegistrationDTO