| 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 | |
|---|
| 10 | package eu.etaxonomy.cdm.model.occurrence; |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | import org.apache.log4j.Logger; |
|---|
| 14 | import org.hibernate.envers.Audited; |
|---|
| 15 | import org.hibernate.search.annotations.Indexed; |
|---|
| 16 | import org.springframework.beans.factory.annotation.Configurable; |
|---|
| 17 | |
|---|
| 18 | import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy; |
|---|
| 19 | import eu.etaxonomy.cdm.strategy.cache.common.IdentifiableEntityDefaultCacheStrategy; |
|---|
| 20 | |
|---|
| 21 | import javax.persistence.*; |
|---|
| 22 | import javax.xml.bind.annotation.XmlAccessType; |
|---|
| 23 | import javax.xml.bind.annotation.XmlAccessorType; |
|---|
| 24 | import javax.xml.bind.annotation.XmlRootElement; |
|---|
| 25 | import javax.xml.bind.annotation.XmlType; |
|---|
| 26 | |
|---|
| 27 | /** |
|---|
| 28 | * @author m.doering |
|---|
| 29 | * @version 1.0 |
|---|
| 30 | * @created 08-Nov-2007 13:06:32 |
|---|
| 31 | */ |
|---|
| 32 | @XmlAccessorType(XmlAccessType.FIELD) |
|---|
| 33 | @XmlType(name = "Observation") |
|---|
| 34 | @XmlRootElement(name = "Observation") |
|---|
| 35 | @Entity |
|---|
| 36 | @Indexed(index = "eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase") |
|---|
| 37 | @Audited |
|---|
| 38 | @Configurable |
|---|
| 39 | public class Observation extends DerivedUnitBase<IIdentifiableEntityCacheStrategy<Observation>> implements Cloneable{ |
|---|
| 40 | private static final Logger logger = Logger.getLogger(Observation.class); |
|---|
| 41 | |
|---|
| 42 | /** |
|---|
| 43 | * Factory method |
|---|
| 44 | * @return |
|---|
| 45 | */ |
|---|
| 46 | public static Observation NewInstance(){ |
|---|
| 47 | return new Observation(); |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | /** |
|---|
| 51 | * Constructor |
|---|
| 52 | */ |
|---|
| 53 | protected Observation() { |
|---|
| 54 | super(); |
|---|
| 55 | this.cacheStrategy = new IdentifiableEntityDefaultCacheStrategy<Observation>(); |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | //*********** CLONE **********************************/ |
|---|
| 59 | |
|---|
| 60 | /** |
|---|
| 61 | * Clones <i>this</i> observation. This is a shortcut that enables to |
|---|
| 62 | * create a new instance that differs only slightly from <i>this</i> observation |
|---|
| 63 | * by modifying only some of the attributes.<BR> |
|---|
| 64 | * This method overrides the clone method from {@link DerivedUnitBase DerivedUnitBase}. |
|---|
| 65 | * |
|---|
| 66 | * @see DerivedUnitBase#clone() |
|---|
| 67 | * @see eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity#clone() |
|---|
| 68 | * @see java.lang.Object#clone() |
|---|
| 69 | */ |
|---|
| 70 | @Override |
|---|
| 71 | public Observation clone(){ |
|---|
| 72 | try{ |
|---|
| 73 | Observation result = (Observation)super.clone(); |
|---|
| 74 | //no changes to: - |
|---|
| 75 | return result; |
|---|
| 76 | } catch (CloneNotSupportedException e) { |
|---|
| 77 | logger.warn("Object does not implement cloneable"); |
|---|
| 78 | e.printStackTrace(); |
|---|
| 79 | return null; |
|---|
| 80 | } |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | } |
|---|