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
;
13 import eu
.etaxonomy
.cdm
.model
.common
.TimePeriod
;
14 import eu
.etaxonomy
.cdm
.model
.common
.Keyword
;
15 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
16 import org
.apache
.log4j
.Logger
;
17 import org
.hibernate
.annotations
.Cascade
;
18 import org
.hibernate
.annotations
.CascadeType
;
22 import javax
.persistence
.*;
25 * A representation of a human being, living or dead.
26 * It includes name parts, contact details, institutional membership,
27 * and other possible information such as life period,
28 * taxonomic and/or geographical specialization. For a short name
29 * the inherited attribute {@link common.IdentifiableEntity#setTitleCache(String) titleCache} is to be used.
30 * For other alternative (string-)names {@link common.OriginalSource OriginalSource} instances must be created.
31 * and the inherited attribute {@link common.ReferencedEntityBase#setOriginalNameString(String) originalNameString} must be used.
33 * See also the <a href="http://rs.tdwg.org/ontology/voc/Person.rdf">TDWG Ontology</a>
37 * @created 08-Nov-2007 13:06:42
40 public class Person
extends Agent
implements INomenclaturalAgent
{
41 static Logger logger
= Logger
.getLogger(Person
.class);
43 private String prefix
;
44 private String firstname
;
45 private String lastname
;
46 private String suffix
;
47 private TimePeriod lifespan
;
48 protected Set
<InstitutionalMembership
> institutionalMemberships
;
49 private Contact contact
;
50 private Set
<Keyword
> keywords
= new HashSet();
55 * @see #Person(String, String, String)
61 * Class constructor using a "forenames" string (including initials),
62 * a surname (family name) and an abbreviated name.
64 * @param firstname the given name of this person
65 * @param lastname the hereditary name of this person
66 * @param abbreviation a standardised or abbreviated name of this person
69 public Person(String firstname
, String lastname
, String abbreviation
) {
70 this.setFirstname(firstname
);
71 this.setLastname(lastname
);
72 this.setTitleCache(abbreviation
);
77 @Cascade({CascadeType
.SAVE_UPDATE
, CascadeType
.DELETE
})
78 public Set
<InstitutionalMembership
> getInstitutionalMemberships(){
79 return this.institutionalMemberships
;
81 protected void setInstitutionalMemberships(Set
<InstitutionalMembership
> institutionalMemberships
){
82 this.institutionalMemberships
= institutionalMemberships
;
86 * Adds a new membership of this person in an institution.
87 * This method also creates a new institutional membership instance.
89 * @param institution the institution this person belongs to
90 * @param period the time period for which this person has been a member of the institution
91 * @param department the string label for the department this person belongs to,
92 * within the institution
93 * @param role the string label for the persons's role within the department or institution
94 * @see InstitutionalMembership#InstitutionalMembership(Institution, Person, TimePeriod, String, String)
96 public void addInstitutionalMembership(Institution institution
, TimePeriod period
, String department
, String role
){
97 InstitutionalMembership ims
= new InstitutionalMembership(institution
, this, period
, department
, role
);
101 * Removes one element from the set of institutional memberships of this person.
103 * @param ims the institutional membership of this person which should be deleted
104 * @see #addInstitutionalMembership(Institution, TimePeriod, String, String)
106 public void removeInstitutionalMembership(InstitutionalMembership ims
){
107 //TODO to be implemented?
108 logger
.warn("not yet fully implemented?");
109 ims
.setInstitute(null);
111 this.institutionalMemberships
.remove(ims
);
116 @Cascade({CascadeType
.SAVE_UPDATE
, CascadeType
.DELETE_ORPHAN
})
117 public Set
<Keyword
> getKeywords(){
118 return this.keywords
;
120 public void setKeywords(Set
<Keyword
> keywords
){
121 this.keywords
= keywords
;
124 * Adds a new keyword from the keyword vocabulary to describe better this person
125 * or circumscribe his activities.
127 * @param keyword any keyword relevant for this person or for his activities
128 * @see common.Keyword
130 public void addKeyword(Keyword keyword
){
131 this.keywords
.add(keyword
);
134 * Removes one element from the set of keywords for this person.
136 * @param keyword the keyword describing this person or his activities which should be deleted
137 * @see #addKeyword(Keyword)
139 public void removeKeyword(Keyword keyword
){
140 this.keywords
.remove(keyword
);
146 @Cascade({CascadeType
.SAVE_UPDATE
})
147 public Contact
getContact(){
151 * Assigns a {@link Contact contact} to this person.
153 * @param contact the contact which should be assigned to this person
155 public void setContact(Contact contact
){
156 this.contact
= contact
;
160 public String
getPrefix(){
164 * Assigns a prefix (for instance "Prof. Dr.<!-- -->") to this person's name.
166 * @param prefix the string which should be assigned as a prefix to this person's name
168 public void setPrefix(String prefix
){
169 this.prefix
= prefix
;
173 public String
getFirstname(){
174 return this.firstname
;
177 * Assigns a given name or forename (for instance "John") to this person.
178 * This is the part of his name which is not shared with other
179 * family members. Actually it may be just initials (for instance "G. Jr."),
180 * all forenames in full or a combination of expanded names and initials.
182 * @param firstname the string which should be assigned as a given name to this person
184 public void setFirstname(String firstname
){
185 this.firstname
= firstname
;
189 public String
getLastname(){
190 return this.lastname
;
193 * Assigns a hereditary name (surname or family name)
194 * to this person (for instance "Smith").
195 * This is the part of his name which is common to (all) other
196 * members of his family, as distinct from the given name or forename.
198 * @param lastname the string which should be assigned as a hereditary name to this person
200 public void setLastname(String lastname
){
201 this.lastname
= lastname
;
205 public String
getSuffix(){
209 * Assigns a suffix (for instance "Junior") to this person's name.
211 * @param suffix the string which should be assigned as a suffix to this person's name
213 public void setSuffix(String suffix
){
214 this.suffix
= suffix
;
218 public TimePeriod
getLifespan(){
219 return this.lifespan
;
222 * Assigns to this person a period of time in which he was alive.
223 * The form birthdate - deathdate (XXXX - YYYY; XXXX - or - YYYY as appropriate) is
224 * preferred, but a simple flourished date (fl. XXXX) may be given
225 * if that is all what is known.
227 * @param lifespan the time period to be assigned as life time to this person
228 * @see common.TimePeriod
230 public void setLifespan(TimePeriod lifespan
){
231 this.lifespan
= lifespan
;
236 * Generates the "full" name string of this person. The used attributes are:
237 * {@link #prefix prefix}, {@link #firstname firstname}, {@link #lastname lastname} and {@link #suffix suffix}.
238 * This method overrides {@link common.IdentifiableEntity#generateTitle() generateTitle}.
239 * The result might be kept as {@link common.IdentifiableEntity#setTitleCache(String) titleCache} if the
240 * flag {@link common.IdentifiableEntity#protectedTitleCache protectedTitleCache} is not set.
242 * @return the string with the full name of this person
244 public String
generateTitle(){
249 public String
getNomenclaturalTitle() {
250 // TODO Auto-generated method stub