root/trunk/cdmlib/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/occurrence/DerivedUnit.java

Revision 6556, 2.3 kB (checked in by ben.clark, 3 years ago)

Added annotations to support free-text searching of occurrences & related entities

  • Property svn:keywords set to Id
Line 
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
10package eu.etaxonomy.cdm.model.occurrence;
11
12
13import org.apache.log4j.Logger;
14import org.hibernate.envers.Audited;
15import org.hibernate.search.annotations.Indexed;
16import org.springframework.beans.factory.annotation.Configurable;
17
18import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
19import eu.etaxonomy.cdm.strategy.cache.common.IdentifiableEntityDefaultCacheStrategy;
20
21import javax.persistence.*;
22import javax.xml.bind.annotation.XmlAccessType;
23import javax.xml.bind.annotation.XmlAccessorType;
24import javax.xml.bind.annotation.XmlRootElement;
25
26/**
27 * @author p.kelbert
28 */
29@XmlAccessorType(XmlAccessType.FIELD)
30@XmlRootElement(name = "DerivedUnit")
31@Entity
32@Indexed(index = "eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase")
33@Audited
34@Configurable
35public class DerivedUnit extends DerivedUnitBase<IIdentifiableEntityCacheStrategy<DerivedUnit>> implements Cloneable{
36        /**
37         *
38         */
39        private static final long serialVersionUID = 1L;
40        private static final Logger logger = Logger.getLogger(DerivedUnit.class);
41       
42        /**
43         * Factory method
44         * @return
45         */
46        public static DerivedUnit NewInstance(){
47                return new DerivedUnit();
48        }
49       
50        /**
51         * Constructor
52         */
53        protected DerivedUnit() {
54                super();
55                this.cacheStrategy = new IdentifiableEntityDefaultCacheStrategy<DerivedUnit>();
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 DerivedUnit clone(){
72                try{
73                        DerivedUnit result = (DerivedUnit)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}
Note: See TracBrowser for help on using the browser.