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
;
13 import eu
.etaxonomy
.cdm
.jaxb
.MultilanguageTextAdapter
;
14 import eu
.etaxonomy
.cdm
.model
.media
.IMediaEntity
;
15 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
16 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
17 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
19 import eu
.etaxonomy
.cdm
.model
.common
.MultilanguageText
;
20 import eu
.etaxonomy
.cdm
.model
.common
.ReferencedEntityBase
;
22 import org
.apache
.log4j
.Logger
;
23 import org
.hibernate
.annotations
.Cascade
;
24 import org
.hibernate
.annotations
.CascadeType
;
28 import javax
.persistence
.*;
29 import javax
.xml
.bind
.annotation
.XmlAccessType
;
30 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
31 import javax
.xml
.bind
.annotation
.XmlElement
;
32 import javax
.xml
.bind
.annotation
.XmlElementWrapper
;
33 import javax
.xml
.bind
.annotation
.XmlIDREF
;
34 import javax
.xml
.bind
.annotation
.XmlSchemaType
;
35 import javax
.xml
.bind
.annotation
.XmlType
;
36 import javax
.xml
.bind
.annotation
.adapters
.XmlJavaTypeAdapter
;
39 * The upmost (abstract) class for a description element of a specimen
40 * or of a taxon. A concrete description element assigns descriptive data to
41 * the feature. As experts use the word feature for the property itself but not
42 * for the actual description naming this class FeatureBase would make no sense.
47 * @created 08-Nov-2007 13:06:24
49 @XmlAccessorType(XmlAccessType
.FIELD
)
50 @XmlType(name
= "DescriptionElementBase", propOrder
= {
57 @Inheritance(strategy
=InheritanceType
.SINGLE_TABLE
)
58 public abstract class DescriptionElementBase
extends ReferencedEntityBase
implements IMediaEntity
{
59 private static final Logger logger
= Logger
.getLogger(DescriptionElementBase
.class);
61 protected DescriptionElementBase(){
64 protected DescriptionElementBase(Feature feature
){
66 feature
= Feature
.UNKNOWN();
68 this.feature
= feature
;
71 //type, category of information. In structured descriptions characters
72 @XmlElement(name
= "Feature")
74 @XmlSchemaType(name
= "IDREF")
75 private Feature feature
;
77 @XmlElementWrapper(name
= "Modifiers")
78 @XmlElement(name
= "Modifier")
79 private Set
<Modifier
> modifiers
= new HashSet
<Modifier
>();
81 @XmlElement(name
= "ModifyingText")
82 @XmlJavaTypeAdapter(MultilanguageTextAdapter
.class)
83 private MultilanguageText modifyingText
;
85 @XmlElementWrapper(name
= "Media")
86 @XmlElement(name
= "Medium")
87 private Set
<Media
> media
= new HashSet
<Media
>();
91 @Cascade({CascadeType
.SAVE_UPDATE
})
92 public Set
<Media
> getMedia(){
95 protected void setMedia(Set
<Media
> media
) {
98 public void addMedia(Media media
){
99 this.media
.add(media
);
101 public void removeMedia(Media media
){
102 this.media
.remove(media
);
107 * Same as getFeature()
112 public Feature
getType(){
113 return this.getFeature();
116 * Same as setFeature(Feature feature)
117 * @see setFeature(Feature feature)
120 public void setType(Feature type
){
121 this.setFeature(type
);
125 @Cascade(CascadeType
.SAVE_UPDATE
)
126 public Feature
getFeature(){
129 public void setFeature(Feature feature
){
130 this.feature
= feature
;
135 public Set
<Modifier
> getModifiers(){
136 return this.modifiers
;
138 protected void setModifiers(Set
<Modifier
> modifiers
){
139 this.modifiers
= modifiers
;
141 public void addModifier(Modifier modifier
){
142 this.modifiers
.add(modifier
);
144 public void removeModifier(Modifier modifier
){
145 this.modifiers
.remove(modifier
);
149 public MultilanguageText
getModifyingText(){
150 return this.modifyingText
;
152 protected void setModifyingText(MultilanguageText modifyingText
){
153 this.modifyingText
= modifyingText
;
155 public LanguageString
addModifyingText(LanguageString description
){
156 return this.modifyingText
.add(description
);
158 public LanguageString
addModifyingText(String text
, Language language
){
159 return this.modifyingText
.put(language
, LanguageString
.NewInstance(text
, language
));
161 public LanguageString
removeModifyingText(Language language
){
162 return this.modifyingText
.remove(language
);