root/trunk/cdmlib/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/TaxonNameDescription.java

Revision 13570, 4.2 kB (checked in by a.kohlbecker, 5 months ago)

harmonising whitespace tab->space

  • 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.description;
11
12import javax.persistence.Entity;
13import javax.persistence.FetchType;
14import javax.persistence.ManyToOne;
15import javax.xml.bind.annotation.XmlAccessType;
16import javax.xml.bind.annotation.XmlAccessorType;
17import javax.xml.bind.annotation.XmlElement;
18import javax.xml.bind.annotation.XmlIDREF;
19import javax.xml.bind.annotation.XmlRootElement;
20import javax.xml.bind.annotation.XmlSchemaType;
21import javax.xml.bind.annotation.XmlType;
22
23import org.apache.log4j.Logger;
24import org.hibernate.annotations.Cascade;
25import org.hibernate.annotations.CascadeType;
26import org.hibernate.envers.Audited;
27import org.hibernate.search.annotations.Indexed;
28import org.springframework.beans.factory.annotation.Configurable;
29
30import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
31import eu.etaxonomy.cdm.model.name.TaxonNameBase;
32import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
33import eu.etaxonomy.cdm.strategy.cache.common.IdentifiableEntityDefaultCacheStrategy;
34
35/**
36 * This class represents all piece of information (not ruled by a {@link NomenclaturalCode nomenclatural code})
37 * concerning a {@link TaxonNameBase taxon name} like for instance the content of its first
38 * publication (protolog) or a picture of this publication.
39 *
40 * @author a.mueller
41 * @version 1.0
42 * @created 08-Jul-2008
43 */
44@XmlAccessorType(XmlAccessType.FIELD)
45@XmlType(name = "TaxonNameDescription", propOrder = {
46        "taxonName"
47})
48@XmlRootElement(name = "TaxonNameDescription")
49@Entity
50@Indexed(index = "eu.etaxonomy.cdm.model.description.DescriptionBase")
51@Audited
52@Configurable
53public class TaxonNameDescription extends DescriptionBase<IIdentifiableEntityCacheStrategy<TaxonNameDescription>> implements Cloneable{
54    private static final long serialVersionUID = -7349160369642038687L;
55    @SuppressWarnings("unused")
56    private static final Logger logger = Logger.getLogger(TaxonNameDescription.class);
57
58    @XmlElement(name="TaxonName")
59    @XmlIDREF
60    @XmlSchemaType(name="IDREF")
61    @ManyToOne(fetch = FetchType.LAZY)
62//      @JoinColumn(name="taxonName_id")
63    @Cascade(CascadeType.SAVE_UPDATE)
64    private TaxonNameBase<?,?> taxonName;
65
66    /**
67     * Creates a new taxon name description instance for the given {@link TaxonNameBase name}.
68     * The new taxon name description will be also added to the {@link TaxonNameBase#getDescriptions() set of descriptions}
69     * assigned to the given name.
70     *
71     * @see     #NewInstance()
72     */
73    public static TaxonNameDescription NewInstance(TaxonNameBase name){
74        TaxonNameDescription description = new TaxonNameDescription();
75        name.addDescription(description);
76        return description;
77    }
78
79    /**
80     * Class constructor: creates a new empty taxon name description instance.
81     */
82    public TaxonNameDescription() {
83        super();
84        this.cacheStrategy = new IdentifiableEntityDefaultCacheStrategy();
85    }
86
87    /**
88     * Creates a new empty taxon name description instance.
89     */
90    public static TaxonNameDescription NewInstance(){
91        return new TaxonNameDescription();
92    }
93
94    /**
95     * Returns the {@link TaxonNameBase taxon name} to which <i>this</i> taxon name description
96     * provides additional information not ruled by a {@link NomenclaturalCode nomenclatural code}.
97     */
98    public TaxonNameBase<?,?> getTaxonName() {
99        return taxonName;
100    }
101
102
103//*********************** CLONE ********************************************************/
104
105    /**
106     * Clones <i>this</i> taxon name description. This is a shortcut that enables to create
107     * a new instance that differs only slightly from <i>this</i> taxon name description by
108     * modifying only some of the attributes.
109     *
110     * @see eu.etaxonomy.cdm.model.description.DescriptionBase#clone()
111     * @see java.lang.Object#clone()
112     */
113    @Override
114    public Object clone() {
115        TaxonNameDescription result;
116        result = (TaxonNameDescription)super.clone();
117        //no changes to: taxonName
118        return result;
119    }
120}
Note: See TracBrowser for help on using the browser.