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
.FieldBridge
;
28 import org
.springframework
.beans
.factory
.annotation
.Configurable
;
30 import eu
.etaxonomy
.cdm
.hibernate
.search
.NotNullAwareIdBridge
;
31 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
32 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
33 import eu
.etaxonomy
.cdm
.strategy
.cache
.common
.IIdentifiableEntityCacheStrategy
;
34 import eu
.etaxonomy
.cdm
.strategy
.cache
.common
.IdentifiableEntityDefaultCacheStrategy
;
37 * This class represents all piece of information (not ruled by a {@link NomenclaturalCode nomenclatural code})
38 * concerning a {@link TaxonName taxon name} like for instance the content of its first
39 * 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 disabled to reduce clutter in indexes, since this type is not used by any search
51 //@Indexed(index = "eu.etaxonomy.cdm.model.description.DescriptionBase")
54 public class TaxonNameDescription
extends DescriptionBase
<IIdentifiableEntityCacheStrategy
<TaxonNameDescription
>> implements Cloneable
{
55 private static final long serialVersionUID
= -7349160369642038687L;
56 @SuppressWarnings("unused")
57 private static final Logger logger
= Logger
.getLogger(TaxonNameDescription
.class);
59 @XmlElement(name
="TaxonName")
61 @XmlSchemaType(name
="IDREF")
62 @ManyToOne(fetch
= FetchType
.LAZY
)
63 @Cascade({CascadeType
.SAVE_UPDATE
,CascadeType
.MERGE
})
64 @FieldBridge(impl
=NotNullAwareIdBridge
.class)
65 private TaxonName
<?
,?
> taxonName
;
67 //******************* FACTORY ********************************************/
70 * Creates a new empty taxon name description instance.
72 public static TaxonNameDescription
NewInstance(){
73 return new TaxonNameDescription();
78 * Creates a new taxon name description instance for the given {@link TaxonName name}.
79 * The new taxon name description will be also added to the {@link TaxonName#getDescriptions() set of descriptions}
80 * assigned to the given name.
84 public static TaxonNameDescription
NewInstance(TaxonName name
){
85 TaxonNameDescription description
= new TaxonNameDescription();
86 name
.addDescription(description
);
90 // ********************** CONSTRUCTOR ***************************************/
93 * Class constructor: creates a new empty taxon name description instance.
95 private TaxonNameDescription() {
97 this.cacheStrategy
= new IdentifiableEntityDefaultCacheStrategy();
100 //************************* GETTER /SETTER ***************************************/
103 * Returns the {@link TaxonName taxon name} to which <i>this</i> taxon name description
104 * provides additional information not ruled by a {@link NomenclaturalCode nomenclatural code}.
106 public TaxonName
<?
,?
> getTaxonName() {
111 //*********************** CLONE ********************************************************/
114 * Clones <i>this</i> taxon name description. This is a shortcut that enables to create
115 * a new instance that differs only slightly from <i>this</i> taxon name description by
116 * modifying only some of the attributes.
118 * @see eu.etaxonomy.cdm.model.description.DescriptionBase#clone()
119 * @see java.lang.Object#clone()
122 public Object
clone() {
123 TaxonNameDescription result
;
124 result
= (TaxonNameDescription
)super.clone();
125 //no changes to: taxonName