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 eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
13 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
15 import org
.apache
.log4j
.Logger
;
16 import org
.hibernate
.annotations
.Cascade
;
17 import org
.hibernate
.annotations
.CascadeType
;
18 import javax
.persistence
.*;
19 import javax
.xml
.bind
.annotation
.XmlAccessType
;
20 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
21 import javax
.xml
.bind
.annotation
.XmlElement
;
22 import javax
.xml
.bind
.annotation
.XmlIDREF
;
23 import javax
.xml
.bind
.annotation
.XmlRootElement
;
24 import javax
.xml
.bind
.annotation
.XmlSchemaType
;
25 import javax
.xml
.bind
.annotation
.XmlType
;
28 * This class represents elementary distribution data for a {@link Taxon taxon}.
29 * Only {@link TaxonDescription taxon descriptions} may contain distributions.
30 * A distribution instance consist of a {@link NamedArea named area} and of a {@link PresenceAbsenceTermBase status}
31 * describing the absence or the presence of a taxon (like "extinct"
32 * or "introduced") in this named area.
34 * This class corresponds partially to: <ul>
35 * <li> CodedDescription according to the the SDD schema
36 * <li> Distribution according to the TDWG ontology
41 * @created 08-Nov-2007 13:06:21
43 @XmlAccessorType(XmlAccessType
.FIELD
)
44 @XmlType(name
= "Distribution", propOrder
= {
48 @XmlRootElement(name
= "Distribution")
50 public class Distribution
extends DescriptionElementBase
{
51 static Logger logger
= Logger
.getLogger(Distribution
.class);
53 @XmlElement(name
= "NamedArea")
55 @XmlSchemaType(name
= "IDREF")
56 private NamedArea area
;
58 @XmlElement(name
= "PresenceAbsenceStatus")
59 private PresenceAbsenceTermBase status
;
63 * Class constructor: creates a new empty distribution instance.
64 * The corresponding {@link Feature feature} is set to {@link Feature#DISTRIBUTION() DISTRIBUTION}.
66 protected Distribution(){
67 super(Feature
.DISTRIBUTION());
72 * Creates an empty distribution instance. The corresponding {@link Feature feature}
73 * is set to {@link Feature#DISTRIBUTION() DISTRIBUTION}.
75 * @see #NewInstance(NamedArea, PresenceAbsenceTermBase)
77 public static Distribution
NewInstance(){
78 Distribution result
= new Distribution();
83 * Creates a distribution instance with the given {@link NamedArea named area} and {@link PresenceAbsenceTermBase status}.
84 * The corresponding {@link Feature feature} is set to {@link Feature#DISTRIBUTION() DISTRIBUTION}.
86 * @param area the named area for the new distribution
87 * @param status the presence or absence term for the new distribution
90 public static Distribution
NewInstance(NamedArea area
, PresenceAbsenceTermBase status
){
91 Distribution result
= new Distribution();
93 result
.setStatus(status
);
98 * Deprecated because {@link Feature feature} should always be {@link Feature#DISTRIBUTION() DISTRIBUTION}
99 * for all distribution instances.
102 * @see eu.etaxonomy.cdm.model.description.DescriptionElementBase#setFeature(eu.etaxonomy.cdm.model.description.Feature)
106 public void setFeature(Feature feature
) {
107 super.setFeature(feature
);
111 * Returns the {@link NamedArea named area} <i>this</i> distribution applies to.
114 @Cascade({CascadeType
.SAVE_UPDATE
})
115 public NamedArea
getArea(){
121 public void setArea(NamedArea area
){
126 * Returns the {@link PresenceAbsenceTermBase presence or absence term} for <i>this</i> distribution.
129 public PresenceAbsenceTermBase
getStatus(){
135 public void setStatus(PresenceAbsenceTermBase status
){
136 this.status
= status
;