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
;
25 import org
.hibernate
.search
.annotations
.Indexed
;
26 import org
.springframework
.beans
.factory
.annotation
.Configurable
;
28 import eu
.etaxonomy
.cdm
.strategy
.cache
.common
.IIdentifiableEntityCacheStrategy
;
29 import eu
.etaxonomy
.cdm
.strategy
.cache
.common
.IdentifiableEntityDefaultCacheStrategy
;
32 * A specimen is regarded as derived from an field observation,
33 * so locality and gathering related information is captured as a separate FieldObservation object
34 * related to a specimen via a derivation event
37 * @created 08-Nov-2007 13:06:52
39 @XmlAccessorType(XmlAccessType
.FIELD
)
40 @XmlType(name
= "Specimen", propOrder
= {
43 @XmlRootElement(name
= "Specimen")
45 @Indexed(index
= "eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase")
48 public class Specimen
extends DerivedUnitBase
<IIdentifiableEntityCacheStrategy
<Specimen
>> implements Cloneable
{
49 private static final Logger logger
= Logger
.getLogger(Specimen
.class);
51 @XmlElement(name
= "Preservation")
53 @XmlSchemaType(name
= "IDREF")
54 @ManyToOne(fetch
= FetchType
.LAZY
)
55 private PreservationMethod preservation
;
61 public static Specimen
NewInstance(){
62 return new Specimen();
68 protected Specimen() {
70 this.cacheStrategy
= new IdentifiableEntityDefaultCacheStrategy
<Specimen
>();
73 public PreservationMethod
getPreservation(){
74 return this.preservation
;
77 public void setPreservation(PreservationMethod preservation
){
78 this.preservation
= preservation
;
82 //*********** CLONE **********************************/
85 * Clones <i>this</i> specimen. This is a shortcut that enables to
86 * create a new instance that differs only slightly from <i>this</i> specimen
87 * by modifying only some of the attributes.<BR>
88 * This method overrides the clone method from {@link DerivedUnitBase DerivedUnitBase}.
90 * @see DerivedUnitBase#clone()
91 * @see eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity#clone()
92 * @see java.lang.Object#clone()
95 public Object
clone(){
97 Specimen result
= (Specimen
)super.clone();
98 result
.setPreservation(this.preservation
);
101 } catch (CloneNotSupportedException e
) {
102 logger
.warn("Object does not implement cloneable");