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
.agent
;
12 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.hibernate
.annotations
.Cascade
;
15 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
.XmlElementWrapper
;
23 import javax
.xml
.bind
.annotation
.XmlRootElement
;
24 import javax
.xml
.bind
.annotation
.XmlSchemaType
;
25 import javax
.xml
.bind
.annotation
.XmlType
;
28 * Information on how to approach a {@link Person person} or an {@link Institution institution}.
29 * It includes telecommunication data
30 * and electronic as well as multiple postal addresses.
32 * See also the <a href="http://rs.tdwg.org/ontology/voc/ContactDetails#ContactDetails">TDWG Ontology</a>
36 * @created 08-Nov-2007 13:06:18
38 @XmlAccessorType(XmlAccessType
.FIELD
)
39 @XmlType(name
= "", propOrder
= {
46 @XmlRootElement(name
= "Contact")
48 public class Contact
extends VersionableEntity
{
54 // TODO Auto-generated constructor stub
57 static Logger logger
= Logger
.getLogger(Contact
.class);
59 @XmlElement(name
= "EmailAddress")
62 @XmlElement(name
= "URL")
63 @XmlSchemaType(name
= "anyURI")
66 @XmlElement(name
= "PhoneNumber")
69 @XmlElement(name
= "FaxNumber")
72 @XmlElementWrapper(name
= "Addresses")
73 @XmlElement(name
= "Address")
74 protected Set
<Address
> addresses
;
78 * Returns the set of postal {@link Address addresses} belonging to <i>this</i> contact.
79 * A {@link Person person} or an {@link Institution institution} cannot have more than one contact,
80 * but a contact may include several postal addresses.
82 * @return the set of postal addresses
85 @OneToMany(mappedBy
="contact")
86 @Cascade({CascadeType
.SAVE_UPDATE
, CascadeType
.DELETE_ORPHAN
})
87 public Set
<Address
> getAddresses(){
88 return this.addresses
;
91 * @see #getAddresses()
93 protected void setAddresses(Set
<Address
> addresses
){
94 this.addresses
= addresses
;
97 * Adds a new postal {@link Address address} to the set of postal addresses of <i>this</i> contact.
99 * @param address the address to be added
100 * @see #getAddresses()
103 public void addAddress(Address address
){
104 if (address
!= null){
105 address
.setContact(this);
106 addresses
.add(address
);
110 * Removes one element from the set of postal addresses of <i>this</i> contact.
112 * @param address the postal address of <i>this</i> contact which should be deleted
113 * @see #getAddresses()
115 public void removeAddress(Address address
){
116 address
.setContact(null);
121 * Returns the string representing the electronic mail address
122 * included in <i>this</i> contact.
124 public String
getEmail(){
131 public void setEmail(String email
){
136 * Returns the string representing the "Uniform Resource Locator" (url)
137 * included in <i>this</i> contact.
139 public String
getUrl(){
146 public void setUrl(String url
){
151 * Returns the string representing the phone number
152 * included in <i>this</i> contact.
154 public String
getPhone(){
161 public void setPhone(String phone
){
166 * Returns the string representing the telefax number
167 * included in <i>this</i> contact.
169 public String
getFax(){
176 public void setFax(String fax
){