first implementation for DnaQuality #4434
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / molecular / DnaQuality.java
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.Entity;
14 import javax.persistence.FetchType;
15 import javax.persistence.ManyToOne;
16 import javax.persistence.Transient;
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
26 import org.apache.log4j.Logger;
27 import org.hibernate.envers.Audited;
28 import org.joda.time.DateTime;
29
30 import eu.etaxonomy.cdm.model.common.DefinedTerm;
31 import eu.etaxonomy.cdm.model.common.VersionableEntity;
32 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
33 import eu.etaxonomy.cdm.model.occurrence.MaterialOrMethodEvent;
34 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
35
36 /**
37 * A DNA Quality describes the quality of a {@link SpecimenOrObservationType#DnaSample}
38 *
39 * @author a.mueller
40 * @created 18-Oct-2014
41 */
42 @XmlAccessorType(XmlAccessType.FIELD)
43 @XmlType(name = "DnaQuality", propOrder = {
44 "ratioOfAbsorbance230_260",
45 "ratioOfAbsorbance260_280",
46 "concentration",
47 "qualityTerm"
48 // ,"purificationMethod"
49 // ,"dateQualityCheck"
50 // ,"dateNanoDrop"
51
52 })
53 @XmlRootElement(name = "DnaQuality")
54 @Entity
55 //@Indexed(index = "eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase")
56 @Audited
57 public class DnaQuality extends VersionableEntity implements Cloneable {
58 private static final long serialVersionUID = -8829069331010573654L;
59 @SuppressWarnings("unused")
60 private static final Logger logger = Logger.getLogger(DnaQuality.class);
61
62 // ****************** FACTORY METHOD *****************/
63
64 /**
65 * Factory method
66 * @return
67 */
68 public static DnaQuality NewInstance(){
69 return new DnaQuality();
70 }
71
72 // ************** ATTRIBUTES ****************************/
73
74 private Double ratioOfAbsorbance230_260;
75
76 private Double ratioOfAbsorbance260_280;
77
78 private Double concentration;
79
80 @XmlElement(name = "Type")
81 @XmlIDREF
82 @XmlSchemaType(name = "IDREF")
83 @ManyToOne(fetch = FetchType.LAZY)
84 private DefinedTerm qualityTerm;
85
86 //TODO
87 @XmlTransient
88 @Transient
89 private MaterialOrMethodEvent purificationMethod;
90
91 //TODO
92 @XmlTransient
93 @Transient
94 private DateTime dateQualityCheck;
95
96 //TODO
97 @XmlTransient
98 @Transient
99 private DateTime dateNanoDrop;
100
101
102 // ******************* CONSTRUCTOR *************************/
103
104 /**
105 * Constructor
106 */
107 private DnaQuality() {}
108
109 //************ GETTER / SETTER **********************************/
110
111 public Double getRatioOfAbsorbance230_260() {
112 return ratioOfAbsorbance230_260;
113 }
114
115 public void setRatioOfAbsorbance230_260(Double ratioOfAbsorbance230_260) {
116 this.ratioOfAbsorbance230_260 = ratioOfAbsorbance230_260;
117 }
118
119 public Double getRatioOfAbsorbance260_280() {
120 return ratioOfAbsorbance260_280;
121 }
122
123 public void setRatioOfAbsorbance260_280(Double ratioOfAbsorbance260_280) {
124 this.ratioOfAbsorbance260_280 = ratioOfAbsorbance260_280;
125 }
126
127
128 public Double getConcentration() {
129 return concentration;
130 }
131
132 public void setConcentration(Double concentration) {
133 this.concentration = concentration;
134 }
135
136 public DefinedTerm getQualityTerm() {
137 return qualityTerm;
138 }
139
140 public void setQualityTerm(DefinedTerm qualityTerm) {
141 this.qualityTerm = qualityTerm;
142 }
143
144
145
146 //*********** CLONE **********************************/
147
148 /**
149 * Clones <i>this</i> dna quality. This is a shortcut that enables to
150 * create a new instance that differs only slightly from <i>this</i> dna quality
151 * by modifying only some of the attributes.<BR>
152 * @throws CloneNotSupportedException
153 *
154 * @see Specimen#clone()
155 * @see DerivedUnit#clone()
156 * @see eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity#clone()
157 * @see java.lang.Object#clone()
158 */
159 @Override
160 public DnaQuality clone() {
161 try {
162 DnaQuality result = (DnaQuality)super.clone();
163
164 //purification method ??
165
166 //no changes to: rationXXX, concentration, dates, qualityTerm,
167 return result;
168
169 } catch (CloneNotSupportedException e) {
170 throw new RuntimeException(e); //may not occur as Clonable is implemented
171 }
172 }
173 }