2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.cdm
.model
.occurrence
;
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
;
22 import org
.apache
.logging
.log4j
.LogManager
;
23 import org
.apache
.logging
.log4j
.Logger
;
24 import org
.hibernate
.envers
.Audited
;
25 import org
.hibernate
.search
.annotations
.Analyze
;
26 import org
.hibernate
.search
.annotations
.Field
;
27 import org
.hibernate
.search
.annotations
.IndexedEmbedded
;
28 import org
.hibernate
.search
.annotations
.NumericField
;
30 import eu
.etaxonomy
.cdm
.model
.common
.EventBase
;
31 import eu
.etaxonomy
.cdm
.model
.molecular
.Cloning
;
32 import eu
.etaxonomy
.cdm
.model
.term
.DefinedTerm
;
33 import eu
.etaxonomy
.cdm
.model
.term
.TermType
;
36 * This class is a specialization of {@link MaterialOrMethodEvent} which allows to
37 * specifically store temperature and XXX which are common parameters for preparation.
39 * {@link #getDefinedMaterialOrMethod() Defined methods} taken to describe a Preservation Method
40 * should be taken from a vocabulary of type {@link TermType#PreservationMethod}
42 * http://rs.tdwg.org/ontology/voc/Collection.rdf#SpecimenPreservationMethodTypeTerm
47 @XmlAccessorType(XmlAccessType
.FIELD
)
48 @XmlType(name
= "PreservationMethod", propOrder
= {
52 @XmlRootElement(name
= "PreservationMethod")
54 //TODO @Indexed(index = "eu.etaxonomy.cdm.model.term.DefinedTermBase")
56 public class PreservationMethod
extends MaterialOrMethodEvent
{
58 private static final long serialVersionUID
= 2366116167028862401L;
59 @SuppressWarnings("unused")
60 private static final Logger logger
= LogManager
.getLogger();
62 @XmlElement(name
= "Medium")
64 @XmlSchemaType(name
= "IDREF")
65 @ManyToOne(fetch
= FetchType
.LAZY
)
66 @IndexedEmbedded // no depth for terms
67 private DefinedTerm medium
;
69 @XmlElement(name
= "Temperature")
70 @Field(analyze
= Analyze
.NO
)
72 private Double temperature
;
74 // ******************** FACTORY METHOD ******************/
76 public static PreservationMethod
NewInstance(){
77 return new PreservationMethod();
80 public static PreservationMethod
NewInstance(DefinedTerm definedMaterialOrMethod
, String methodText
){
81 return new PreservationMethod(definedMaterialOrMethod
, methodText
, null, null);
84 public static PreservationMethod
NewInstance(DefinedTerm definedMaterialOrMethod
, String methodText
, DefinedTerm preservationMedium
, Double temperature
){
85 return new PreservationMethod(definedMaterialOrMethod
, methodText
, preservationMedium
, temperature
);
88 // ********************* CONSTRUCTOR ********************/
90 //for hibernate use only, *packet* private required by bytebuddy
91 PreservationMethod(){}
93 private PreservationMethod(DefinedTerm definedMaterialOrMethod
, String methodText
, DefinedTerm medium
, Double temperature
){
94 super(definedMaterialOrMethod
, methodText
);
96 this.temperature
= temperature
;
99 // ********************* GETTER / SETTER ********************/
101 public DefinedTerm
getMedium() {
104 public void setMedium(DefinedTerm medium
) {
105 this.medium
= medium
;
108 public Double
getTemperature() {
111 public void setTemperature(Double temperature
) {
112 this.temperature
= temperature
;
115 // ************************** CLONE ********************/
118 * Clones <i>this</i> {@link Cloning}. This is a shortcut that enables to create
119 * a new instance that differs only slightly from <i>this</i> cloning by
120 * modifying only some of the attributes.<BR><BR>
122 * @see EventBase#clone()
123 * @see java.lang.Object#clone()
126 public PreservationMethod
clone() {
127 PreservationMethod result
= (PreservationMethod
)super.clone();
129 //don't change medium, temperature