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.
10 package eu
.etaxonomy
.cdm
.model
.occurrence
;
12 import javax
.persistence
.Entity
;
13 import javax
.persistence
.FetchType
;
14 import javax
.persistence
.ManyToOne
;
15 import javax
.xml
.bind
.annotation
.XmlAccessType
;
16 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
17 import javax
.xml
.bind
.annotation
.XmlElement
;
18 import javax
.xml
.bind
.annotation
.XmlIDREF
;
19 import javax
.xml
.bind
.annotation
.XmlRootElement
;
20 import javax
.xml
.bind
.annotation
.XmlSchemaType
;
21 import javax
.xml
.bind
.annotation
.XmlType
;
23 import org
.apache
.log4j
.Logger
;
24 import org
.hibernate
.envers
.Audited
;
27 * A specimen is regarded as derived from an field observation,
28 * so locality and gathering related information is captured as a separate FieldObservation object
29 * related to a specimen via a derivation event
32 * @created 08-Nov-2007 13:06:52
34 @XmlAccessorType(XmlAccessType
.FIELD
)
35 @XmlType(name
= "Specimen", propOrder
= {
38 @XmlRootElement(name
= "Specimen")
41 public class Specimen
extends DerivedUnitBase
implements Cloneable
{
42 private static final Logger logger
= Logger
.getLogger(Specimen
.class);
44 @XmlElement(name
= "Preservation")
46 @XmlSchemaType(name
= "IDREF")
47 @ManyToOne(fetch
= FetchType
.LAZY
)
48 private PreservationMethod preservation
;
54 public static Specimen
NewInstance(){
55 return new Specimen();
61 protected Specimen() {
65 public PreservationMethod
getPreservation(){
66 return this.preservation
;
69 public void setPreservation(PreservationMethod preservation
){
70 this.preservation
= preservation
;
74 //*********** CLONE **********************************/
77 * Clones <i>this</i> specimen. This is a shortcut that enables to
78 * create a new instance that differs only slightly from <i>this</i> specimen
79 * by modifying only some of the attributes.<BR>
80 * This method overrides the clone method from {@link DerivedUnitBase DerivedUnitBase}.
82 * @see DerivedUnitBase#clone()
83 * @see eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity#clone()
84 * @see java.lang.Object#clone()
87 public Object
clone(){
89 Specimen result
= (Specimen
)super.clone();
90 result
.setPreservation(this.preservation
);
93 } catch (CloneNotSupportedException e
) {
94 logger
.warn("Object does not implement cloneable");