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
;
27 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
28 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
31 * This class represents elementary distribution data for a {@link Taxon taxon}.
32 * Only {@link TaxonDescription taxon descriptions} may contain distributions.
33 * A distribution instance consist of a {@link NamedArea named area} and of a {@link PresenceAbsenceTermBase status}
34 * describing the absence or the presence of a taxon (like "extinct"
35 * or "introduced") in this named area.
37 * This class corresponds partially to: <ul>
38 * <li> CodedDescriptionType according to the the SDD schema
39 * <li> Distribution according to the TDWG ontology
44 * @created 08-Nov-2007 13:06:21
46 @XmlAccessorType(XmlAccessType
.FIELD
)
47 @XmlType(name
= "Distribution", propOrder
= {
51 @XmlRootElement(name
= "Distribution")
54 public class Distribution
extends DescriptionElementBase
{
55 private static final long serialVersionUID
= 8366462435651559730L;
56 @SuppressWarnings("unused")
57 private static final Logger logger
= Logger
.getLogger(Distribution
.class);
59 @XmlElement(name
= "NamedArea")
61 @XmlSchemaType(name
= "IDREF")
62 private NamedArea area
;
64 @XmlElement(name
= "PresenceAbsenceStatus")
66 @XmlSchemaType(name
= "IDREF")
67 private PresenceAbsenceTermBase
<?
> status
;
71 * Class constructor: creates a new empty distribution instance.
72 * The corresponding {@link Feature feature} is set to {@link Feature#DISTRIBUTION() DISTRIBUTION}.
74 protected Distribution(){
75 super(Feature
.DISTRIBUTION());
80 * Creates an empty distribution instance. The corresponding {@link Feature feature}
81 * is set to {@link Feature#DISTRIBUTION() DISTRIBUTION}.
83 * @see #NewInstance(NamedArea, PresenceAbsenceTermBase)
85 public static Distribution
NewInstance(){
86 Distribution result
= new Distribution();
91 * Creates a distribution instance with the given {@link NamedArea named area} and {@link PresenceAbsenceTermBase status}.
92 * The corresponding {@link Feature feature} is set to {@link Feature#DISTRIBUTION() DISTRIBUTION}.
94 * @param area the named area for the new distribution
95 * @param status the presence or absence term for the new distribution
98 public static Distribution
NewInstance(NamedArea area
, PresenceAbsenceTermBase
<?
> status
){
99 Distribution result
= new Distribution();
100 result
.setArea(area
);
101 result
.setStatus(status
);
109 * Deprecated because {@link Feature feature} should always be {@link Feature#DISTRIBUTION() DISTRIBUTION}
110 * for all distribution instances.
113 * @see eu.etaxonomy.cdm.model.description.DescriptionElementBase#setFeature(eu.etaxonomy.cdm.model.description.Feature)
117 public void setFeature(Feature feature
) {
118 super.setFeature(feature
);
122 * Returns the {@link NamedArea named area} <i>this</i> distribution applies to.
124 @ManyToOne(fetch
= FetchType
.LAZY
)
125 @Cascade({CascadeType
.SAVE_UPDATE
})
126 public NamedArea
getArea(){
132 public void setArea(NamedArea area
){
137 * Returns the {@link PresenceAbsenceTermBase presence or absence term} for <i>this</i> distribution.
139 @ManyToOne(fetch
= FetchType
.LAZY
)
140 public PresenceAbsenceTermBase
<?
> getStatus(){
146 public void setStatus(PresenceAbsenceTermBase
<?
> status
){
147 this.status
= status
;