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
|
package eu.etaxonomy.cdm.model.occurrence;
|
10
|
|
11
|
import javax.persistence.Entity;
|
12
|
import javax.persistence.FetchType;
|
13
|
import javax.persistence.ManyToOne;
|
14
|
import javax.xml.bind.annotation.XmlAccessType;
|
15
|
import javax.xml.bind.annotation.XmlAccessorType;
|
16
|
import javax.xml.bind.annotation.XmlElement;
|
17
|
import javax.xml.bind.annotation.XmlIDREF;
|
18
|
import javax.xml.bind.annotation.XmlRootElement;
|
19
|
import javax.xml.bind.annotation.XmlSchemaType;
|
20
|
import javax.xml.bind.annotation.XmlType;
|
21
|
|
22
|
import org.apache.log4j.Logger;
|
23
|
import org.hibernate.envers.Audited;
|
24
|
import org.hibernate.search.annotations.Analyze;
|
25
|
import org.hibernate.search.annotations.Field;
|
26
|
import org.hibernate.search.annotations.IndexedEmbedded;
|
27
|
import org.hibernate.search.annotations.NumericField;
|
28
|
|
29
|
import eu.etaxonomy.cdm.model.common.DefinedTerm;
|
30
|
import eu.etaxonomy.cdm.model.common.EventBase;
|
31
|
import eu.etaxonomy.cdm.model.common.TermType;
|
32
|
import eu.etaxonomy.cdm.model.molecular.Cloning;
|
33
|
|
34
|
/**
|
35
|
* This class is a specialization of {@link MaterialOrMethodEvent} which allows to
|
36
|
* specifically store temperature and XXX which are common parameters for preparation.
|
37
|
*
|
38
|
* {@link #getDefinedMaterialOrMethod() Defined methods} taken to describe a Preservation Method
|
39
|
* should be taken from a vocabulary of type {@link TermType#PreservationMethod}
|
40
|
*
|
41
|
* http://rs.tdwg.org/ontology/voc/Collection.rdf#SpecimenPreservationMethodTypeTerm
|
42
|
*
|
43
|
* @author a.mueller
|
44
|
* @created 2013-09-11
|
45
|
*
|
46
|
*/
|
47
|
@XmlAccessorType(XmlAccessType.FIELD)
|
48
|
@XmlType(name = "PreservationMethod", propOrder = {
|
49
|
"medium",
|
50
|
"temperature"
|
51
|
})
|
52
|
@XmlRootElement(name = "PreservationMethod")
|
53
|
@Entity
|
54
|
//TODO @Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase")
|
55
|
@Audited
|
56
|
public class PreservationMethod extends MaterialOrMethodEvent implements Cloneable {
|
57
|
private static final long serialVersionUID = 2366116167028862401L;
|
58
|
@SuppressWarnings("unused")
|
59
|
private static final Logger logger = Logger.getLogger(PreservationMethod.class);
|
60
|
|
61
|
@XmlElement(name = "Medium")
|
62
|
@XmlIDREF
|
63
|
@XmlSchemaType(name = "IDREF")
|
64
|
@ManyToOne(fetch = FetchType.LAZY)
|
65
|
@IndexedEmbedded // no depth for terms
|
66
|
private DefinedTerm medium;
|
67
|
|
68
|
@XmlElement(name = "Temperature")
|
69
|
@Field(analyze = Analyze.NO)
|
70
|
@NumericField
|
71
|
private Double temperature;
|
72
|
|
73
|
|
74
|
// ******************** FACTORY METHOD ******************/
|
75
|
|
76
|
public static PreservationMethod NewInstance(){
|
77
|
return new PreservationMethod();
|
78
|
}
|
79
|
|
80
|
public static PreservationMethod NewInstance(DefinedTerm definedMaterialOrMethod, String methodText){
|
81
|
return new PreservationMethod(definedMaterialOrMethod, methodText, null, null);
|
82
|
}
|
83
|
|
84
|
public static PreservationMethod NewInstance(DefinedTerm definedMaterialOrMethod, String methodText, DefinedTerm preservationMedium, Double temperature){
|
85
|
return new PreservationMethod(definedMaterialOrMethod, methodText, preservationMedium, temperature);
|
86
|
}
|
87
|
|
88
|
|
89
|
// ********************* CONSTRUCTOR ********************/
|
90
|
|
91
|
//for hibernate use only
|
92
|
protected PreservationMethod(){};
|
93
|
|
94
|
private PreservationMethod(DefinedTerm definedMaterialOrMethod, String methodText, DefinedTerm medium, Double temperature){
|
95
|
super(definedMaterialOrMethod, methodText);
|
96
|
this.medium = medium;
|
97
|
this.temperature = temperature;
|
98
|
}
|
99
|
|
100
|
// ********************* GETTER / SETTER ********************/
|
101
|
|
102
|
public DefinedTerm getMedium() {
|
103
|
return medium;
|
104
|
}
|
105
|
|
106
|
|
107
|
public void setMedium(DefinedTerm medium) {
|
108
|
this.medium = medium;
|
109
|
}
|
110
|
|
111
|
|
112
|
public Double getTemperature() {
|
113
|
return temperature;
|
114
|
}
|
115
|
|
116
|
|
117
|
public void setTemperature(Double temperature) {
|
118
|
this.temperature = temperature;
|
119
|
}
|
120
|
|
121
|
// ********************* CLONE ********************/
|
122
|
/**
|
123
|
* Clones <i>this</i> {@link Cloning}. This is a shortcut that enables to create
|
124
|
* a new instance that differs only slightly from <i>this</i> cloning by
|
125
|
* modifying only some of the attributes.<BR><BR>
|
126
|
*
|
127
|
* @see EventBase#clone()
|
128
|
* @see java.lang.Object#clone()
|
129
|
*/
|
130
|
@Override
|
131
|
public Object clone() {
|
132
|
PreservationMethod result = (PreservationMethod)super.clone();
|
133
|
|
134
|
//don't change medium, temperature
|
135
|
return result;
|
136
|
}
|
137
|
}
|