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
.*;
21 * Information on how to approach a {@link Person person} or an {@link Institution institution}.
22 * It includes telecommunication data
23 * and electronic as well as multiple postal addresses.
25 * See also the <a href="http://rs.tdwg.org/ontology/voc/ContactDetails#ContactDetails">TDWG Ontology</a>
29 * @created 08-Nov-2007 13:06:18
32 public class Contact
extends VersionableEntity
{
38 // TODO Auto-generated constructor stub
41 static Logger logger
= Logger
.getLogger(Contact
.class);
46 protected Set
<Address
> addresses
;
50 * Returns the set of postal {@link Address addresses} belonging to this contact.
51 * A {@link Person person} or an {@link Institution institution} cannot have more than one contact,
52 * but a contact may include several postal addresses.
54 * @return the set of postal addresses
57 @OneToMany(mappedBy
="contact")
58 @Cascade({CascadeType
.SAVE_UPDATE
, CascadeType
.DELETE_ORPHAN
})
59 public Set
<Address
> getAddresses(){
60 return this.addresses
;
63 * @see #getAddresses()
65 protected void setAddresses(Set
<Address
> addresses
){
66 this.addresses
= addresses
;
69 * Adds a new postal {@link Address address} to the set of postal addresses of this contact.
71 * @param address the address to be added
72 * @see #getAddresses()
75 public void addAddress(Address address
){
77 address
.setContact(this);
78 addresses
.add(address
);
82 * Removes one element from the set of postal addresses of this contact.
84 * @param address the postal address of this contact which should be deleted
85 * @see #getAddresses()
87 public void removeAddress(Address address
){
88 address
.setContact(null);
93 * Returns the string representing the electronic mail address
94 * included in this contact.
96 public String
getEmail(){
103 public void setEmail(String email
){
108 * Returns the string representing the "Uniform Resource Locator" (url)
109 * included in this contact.
111 public String
getUrl(){
118 public void setUrl(String url
){
123 * Returns the string representing the phone number
124 * included in this contact.
126 public String
getPhone(){
133 public void setPhone(String phone
){
138 * Returns the string representing the telefax number
139 * included in this contact.
141 public String
getFax(){
148 public void setFax(String fax
){