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
.description
;
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
.annotations
.Cascade
;
25 import org
.hibernate
.annotations
.CascadeType
;
26 import org
.hibernate
.envers
.Audited
;
27 import org
.hibernate
.search
.annotations
.Indexed
;
28 import org
.springframework
.beans
.factory
.annotation
.Configurable
;
30 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
31 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
32 import eu
.etaxonomy
.cdm
.strategy
.cache
.common
.IIdentifiableEntityCacheStrategy
;
33 import eu
.etaxonomy
.cdm
.strategy
.cache
.common
.IdentifiableEntityDefaultCacheStrategy
;
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.
42 * @created 08-Jul-2008
44 @XmlAccessorType(XmlAccessType
.FIELD
)
45 @XmlType(name
= "TaxonNameDescription", propOrder
= {
48 @XmlRootElement(name
= "TaxonNameDescription")
50 @Indexed(index
= "eu.etaxonomy.cdm.model.description.DescriptionBase")
53 public 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);
58 @XmlElement(name
="TaxonName")
60 @XmlSchemaType(name
="IDREF")
61 @ManyToOne(fetch
= FetchType
.LAZY
)
62 // @JoinColumn(name="taxonName_id")
63 @Cascade(CascadeType
.SAVE_UPDATE
)
64 private TaxonNameBase
<?
,?
> taxonName
;
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.
73 public static TaxonNameDescription
NewInstance(TaxonNameBase name
){
74 TaxonNameDescription description
= new TaxonNameDescription();
75 name
.addDescription(description
);
80 * Class constructor: creates a new empty taxon name description instance.
82 public TaxonNameDescription() {
84 this.cacheStrategy
= new IdentifiableEntityDefaultCacheStrategy();
88 * Creates a new empty taxon name description instance.
90 public static TaxonNameDescription
NewInstance(){
91 return new TaxonNameDescription();
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}.
98 public TaxonNameBase
<?
,?
> getTaxonName() {
103 //*********************** CLONE ********************************************************/
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.
110 * @see eu.etaxonomy.cdm.model.description.DescriptionBase#clone()
111 * @see java.lang.Object#clone()
114 public Object
clone() {
115 TaxonNameDescription result
;
116 result
= (TaxonNameDescription
)super.clone();
117 //no changes to: taxonName