1
|
/**
|
2
|
* Copyright (C) 2007 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
|
|
10
|
package eu.etaxonomy.cdm.model.molecular;
|
11
|
|
12
|
|
13
|
import javax.persistence.Basic;
|
14
|
import javax.persistence.Entity;
|
15
|
import javax.persistence.FetchType;
|
16
|
import javax.persistence.ManyToOne;
|
17
|
import javax.xml.bind.annotation.XmlAccessType;
|
18
|
import javax.xml.bind.annotation.XmlAccessorType;
|
19
|
import javax.xml.bind.annotation.XmlElement;
|
20
|
import javax.xml.bind.annotation.XmlIDREF;
|
21
|
import javax.xml.bind.annotation.XmlRootElement;
|
22
|
import javax.xml.bind.annotation.XmlSchemaType;
|
23
|
import javax.xml.bind.annotation.XmlTransient;
|
24
|
import javax.xml.bind.annotation.XmlType;
|
25
|
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
26
|
|
27
|
import org.apache.log4j.Logger;
|
28
|
import org.hibernate.annotations.Type;
|
29
|
import org.hibernate.envers.Audited;
|
30
|
import org.hibernate.search.annotations.Analyze;
|
31
|
import org.hibernate.search.annotations.Field;
|
32
|
import org.hibernate.search.annotations.FieldBridge;
|
33
|
import org.joda.time.DateTime;
|
34
|
|
35
|
import eu.etaxonomy.cdm.hibernate.search.DateTimeBridge;
|
36
|
import eu.etaxonomy.cdm.jaxb.DateTimeAdapter;
|
37
|
import eu.etaxonomy.cdm.model.common.OrderedTerm;
|
38
|
import eu.etaxonomy.cdm.model.common.VersionableEntity;
|
39
|
import eu.etaxonomy.cdm.model.description.MeasurementUnit;
|
40
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
41
|
import eu.etaxonomy.cdm.model.occurrence.MaterialOrMethodEvent;
|
42
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
|
43
|
|
44
|
/**
|
45
|
* A DNA Quality describes the quality of a {@link SpecimenOrObservationType#DnaSample}
|
46
|
*
|
47
|
* @author a.mueller
|
48
|
* @created 18-Oct-2014
|
49
|
*/
|
50
|
@XmlAccessorType(XmlAccessType.FIELD)
|
51
|
@XmlType(name = "DnaQuality", propOrder = {
|
52
|
"purificationMethod",
|
53
|
"ratioOfAbsorbance260_230",
|
54
|
"ratioOfAbsorbance260_280",
|
55
|
"concentration",
|
56
|
"concentrationUnit",
|
57
|
"qualityTerm",
|
58
|
"qualityCheckDate"
|
59
|
})
|
60
|
@XmlRootElement(name = "DnaQuality")
|
61
|
@Entity
|
62
|
//@Indexed(index = "eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase")
|
63
|
@Audited
|
64
|
public class DnaQuality extends VersionableEntity implements Cloneable {
|
65
|
private static final long serialVersionUID = -8829069331010573654L;
|
66
|
@SuppressWarnings("unused")
|
67
|
private static final Logger logger = Logger.getLogger(DnaQuality.class);
|
68
|
|
69
|
// ****************** FACTORY METHOD *****************/
|
70
|
|
71
|
/**
|
72
|
* Factory method
|
73
|
* @return
|
74
|
*/
|
75
|
public static DnaQuality NewInstance(){
|
76
|
return new DnaQuality();
|
77
|
}
|
78
|
|
79
|
// ************** ATTRIBUTES ****************************/
|
80
|
|
81
|
//TODO
|
82
|
// @XmlElement(name = "PurificationMethod")
|
83
|
// @XmlIDREF
|
84
|
// @XmlSchemaType(name = "IDREF")
|
85
|
@XmlTransient
|
86
|
@ManyToOne(fetch = FetchType.LAZY)
|
87
|
//FIXME preliminary as it is not yet decided if we will use a string or a MoME #4552
|
88
|
private MaterialOrMethodEvent typedPurificationMethod;
|
89
|
|
90
|
private String purificationMethod;
|
91
|
|
92
|
|
93
|
private Double ratioOfAbsorbance260_230;
|
94
|
|
95
|
private Double ratioOfAbsorbance260_280;
|
96
|
|
97
|
private Double concentration;
|
98
|
|
99
|
@XmlElement(name = "concentrationUnit")
|
100
|
@XmlIDREF
|
101
|
@XmlSchemaType(name = "IDREF")
|
102
|
@ManyToOne(fetch = FetchType.LAZY)
|
103
|
private MeasurementUnit concentrationUnit;
|
104
|
|
105
|
|
106
|
@XmlElement(name = "Type")
|
107
|
@XmlIDREF
|
108
|
@XmlSchemaType(name = "IDREF")
|
109
|
@ManyToOne(fetch = FetchType.LAZY)
|
110
|
private OrderedTerm qualityTerm;
|
111
|
|
112
|
@XmlElement (name = "QualityCheckDate", type= String.class)
|
113
|
@XmlJavaTypeAdapter(DateTimeAdapter.class)
|
114
|
@Type(type="dateTimeUserType")
|
115
|
@Basic(fetch = FetchType.LAZY)
|
116
|
@Field(analyze = Analyze.NO)
|
117
|
@FieldBridge(impl = DateTimeBridge.class)
|
118
|
@Audited
|
119
|
private DateTime qualityCheckDate;
|
120
|
|
121
|
|
122
|
// ******************* CONSTRUCTOR *************************/
|
123
|
|
124
|
/**
|
125
|
* Constructor
|
126
|
*/
|
127
|
protected DnaQuality() {}
|
128
|
|
129
|
//************ GETTER / SETTER **********************************/
|
130
|
|
131
|
|
132
|
public String getPurificationMethod() {
|
133
|
return purificationMethod;
|
134
|
}
|
135
|
|
136
|
public void setPurificationMethod(String purificationMethod) {
|
137
|
this.purificationMethod = purificationMethod;
|
138
|
}
|
139
|
|
140
|
public Double getRatioOfAbsorbance260_230() {
|
141
|
return ratioOfAbsorbance260_230;
|
142
|
}
|
143
|
|
144
|
public void setRatioOfAbsorbance260_230(Double ratioOfAbsorbance260_230) {
|
145
|
this.ratioOfAbsorbance260_230 = ratioOfAbsorbance260_230;
|
146
|
}
|
147
|
|
148
|
public Double getRatioOfAbsorbance260_280() {
|
149
|
return ratioOfAbsorbance260_280;
|
150
|
}
|
151
|
|
152
|
public void setRatioOfAbsorbance260_280(Double ratioOfAbsorbance260_280) {
|
153
|
this.ratioOfAbsorbance260_280 = ratioOfAbsorbance260_280;
|
154
|
}
|
155
|
|
156
|
|
157
|
public Double getConcentration() {
|
158
|
return concentration;
|
159
|
}
|
160
|
|
161
|
public void setConcentration(Double concentration) {
|
162
|
this.concentration = concentration;
|
163
|
}
|
164
|
|
165
|
public MeasurementUnit getConcentrationUnit() {
|
166
|
return concentrationUnit;
|
167
|
}
|
168
|
|
169
|
public void setConcentrationUnit(MeasurementUnit concentrationUnit) {
|
170
|
this.concentrationUnit = concentrationUnit;
|
171
|
}
|
172
|
|
173
|
public DateTime getQualityCheckDate() {
|
174
|
return qualityCheckDate;
|
175
|
}
|
176
|
|
177
|
public void setQualityCheckDate(DateTime qualityCheckDate) {
|
178
|
this.qualityCheckDate = qualityCheckDate;
|
179
|
}
|
180
|
|
181
|
public OrderedTerm getQualityTerm() {
|
182
|
return qualityTerm;
|
183
|
}
|
184
|
|
185
|
public void setQualityTerm(OrderedTerm qualityTerm) {
|
186
|
this.qualityTerm = qualityTerm;
|
187
|
}
|
188
|
|
189
|
|
190
|
|
191
|
//*********** CLONE **********************************/
|
192
|
|
193
|
/**
|
194
|
* Clones <i>this</i> dna quality. This is a shortcut that enables to
|
195
|
* create a new instance that differs only slightly from <i>this</i> dna quality
|
196
|
* by modifying only some of the attributes.<BR>
|
197
|
* @throws CloneNotSupportedException
|
198
|
*
|
199
|
* @see Specimen#clone()
|
200
|
* @see DerivedUnit#clone()
|
201
|
* @see eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity#clone()
|
202
|
* @see java.lang.Object#clone()
|
203
|
*/
|
204
|
@Override
|
205
|
public DnaQuality clone() {
|
206
|
try {
|
207
|
DnaQuality result = (DnaQuality)super.clone();
|
208
|
|
209
|
//purification method ??
|
210
|
|
211
|
//no changes to: rationXXX, concentration, qualityCheckDate, qualityTerm,
|
212
|
return result;
|
213
|
|
214
|
} catch (CloneNotSupportedException e) {
|
215
|
throw new RuntimeException(e); //may not occur as Clonable is implemented
|
216
|
}
|
217
|
}
|
218
|
|
219
|
}
|