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 long serialVersionUID
= -504050482700773061L;
50 private static final Logger logger
= Logger
.getLogger(Specimen
.class);
52 @XmlElement(name
= "Preservation")
54 @XmlSchemaType(name
= "IDREF")
55 @ManyToOne(fetch
= FetchType
.LAZY
)
56 private PreservationMethod preservation
;
62 public static Specimen
NewInstance(){
63 return new Specimen();
69 protected Specimen() {
71 this.cacheStrategy
= new IdentifiableEntityDefaultCacheStrategy
<Specimen
>();
74 public PreservationMethod
getPreservation(){
75 return this.preservation
;
78 public void setPreservation(PreservationMethod preservation
){
79 this.preservation
= preservation
;
83 //*********** CLONE **********************************/
86 * Clones <i>this</i> specimen. This is a shortcut that enables to
87 * create a new instance that differs only slightly from <i>this</i> specimen
88 * by modifying only some of the attributes.<BR>
89 * This method overrides the clone method from {@link DerivedUnitBase DerivedUnitBase}.
91 * @see DerivedUnitBase#clone()
92 * @see eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity#clone()
93 * @see java.lang.Object#clone()
96 public Object
clone(){
98 Specimen result
= (Specimen
)super.clone();
99 result
.setPreservation(this.preservation
);
102 } catch (CloneNotSupportedException e
) {
103 logger
.warn("Object does not implement cloneable");