1
|
/**
|
2
|
* Copyright (C) 2018 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.util.HashSet;
|
12
|
import java.util.Set;
|
13
|
|
14
|
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
|
15
|
import eu.etaxonomy.cdm.model.molecular.AmplificationResult;
|
16
|
import eu.etaxonomy.cdm.model.molecular.DnaQuality;
|
17
|
import eu.etaxonomy.cdm.model.molecular.DnaSample;
|
18
|
import eu.etaxonomy.cdm.model.molecular.Sequence;
|
19
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
20
|
|
21
|
/**
|
22
|
* @author k.luther
|
23
|
* @since 02.08.2018
|
24
|
*
|
25
|
*/
|
26
|
public class DNASampleDTO extends DerivedUnitDTO{
|
27
|
|
28
|
private static final long serialVersionUID = -1050277075084265067L;
|
29
|
|
30
|
private Set<SequenceDTO> sequences = new HashSet<SequenceDTO>();
|
31
|
|
32
|
private Set<AmplificationResult> amplificationResults = new HashSet<AmplificationResult>();
|
33
|
|
34
|
private DnaQuality dnaQuality;
|
35
|
|
36
|
|
37
|
public static DNASampleDTO fromEntity(DnaSample entity){
|
38
|
if(entity == null) {
|
39
|
return null;
|
40
|
}
|
41
|
return new DNASampleDTO(HibernateProxyHelper.deproxy(entity, DnaSample.class));
|
42
|
}
|
43
|
|
44
|
public DNASampleDTO(DerivedUnit derivedUnit) {
|
45
|
super(derivedUnit);
|
46
|
DnaSample dnaSample = HibernateProxyHelper.deproxy(derivedUnit, DnaSample.class);
|
47
|
Set<SequenceDTO> seqDtos = new HashSet<>();
|
48
|
for (Sequence seq: dnaSample.getSequences()){
|
49
|
seqDtos.add(new SequenceDTO(seq));
|
50
|
}
|
51
|
this.setSequences(seqDtos);
|
52
|
this.amplificationResults = dnaSample.getAmplificationResults();
|
53
|
this.dnaQuality = HibernateProxyHelper.deproxy(dnaSample.getDnaQuality(), DnaQuality.class);
|
54
|
}
|
55
|
|
56
|
|
57
|
public void setSequences(Set<SequenceDTO> sequences) {
|
58
|
this.sequences = sequences;
|
59
|
}
|
60
|
|
61
|
|
62
|
public Set<AmplificationResult> getAmplificationResults() {
|
63
|
return amplificationResults;
|
64
|
}
|
65
|
|
66
|
|
67
|
public void setAmplificationResults(Set<AmplificationResult> amplificationResults) {
|
68
|
this.amplificationResults = amplificationResults;
|
69
|
}
|
70
|
|
71
|
|
72
|
public DnaQuality getDnaQuality() {
|
73
|
return dnaQuality;
|
74
|
}
|
75
|
|
76
|
|
77
|
public void setDnaQuality(DnaQuality dnaQuality) {
|
78
|
this.dnaQuality = dnaQuality;
|
79
|
}
|
80
|
|
81
|
|
82
|
public Set<SequenceDTO> getSequences() {
|
83
|
return sequences;
|
84
|
}
|
85
|
|
86
|
|
87
|
}
|