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 java
.util
.HashSet
;
16 import javax
.persistence
.Entity
;
17 import javax
.persistence
.FetchType
;
18 import javax
.persistence
.ManyToMany
;
19 import javax
.persistence
.ManyToOne
;
20 import javax
.persistence
.Transient
;
21 import javax
.xml
.bind
.annotation
.XmlAccessType
;
22 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
23 import javax
.xml
.bind
.annotation
.XmlElement
;
24 import javax
.xml
.bind
.annotation
.XmlElementWrapper
;
25 import javax
.xml
.bind
.annotation
.XmlIDREF
;
26 import javax
.xml
.bind
.annotation
.XmlRootElement
;
27 import javax
.xml
.bind
.annotation
.XmlSchemaType
;
28 import javax
.xml
.bind
.annotation
.XmlTransient
;
29 import javax
.xml
.bind
.annotation
.XmlType
;
31 import org
.apache
.log4j
.Logger
;
32 import org
.hibernate
.annotations
.Cascade
;
33 import org
.hibernate
.annotations
.CascadeType
;
34 import org
.hibernate
.envers
.Audited
;
35 import org
.hibernate
.search
.annotations
.Field
;
36 import org
.hibernate
.search
.annotations
.Index
;
37 import org
.hibernate
.search
.annotations
.Indexed
;
38 import org
.springframework
.beans
.factory
.annotation
.Configurable
;
40 import eu
.etaxonomy
.cdm
.strategy
.cache
.common
.IIdentifiableEntityCacheStrategy
;
41 import eu
.etaxonomy
.cdm
.strategy
.cache
.common
.IdentifiableEntityDefaultCacheStrategy
;
44 * This class represents public or private institutions.
45 * It includes name, contact details and institution type.
47 * This class corresponds to: <ul>
48 * <li> Institution according to the TDWG ontology
49 * <li> Institution according to the TCS
50 * <li> Organisation (Institution) according to the ABCD schema
55 * @created 08-Nov-2007 13:06:29
57 @XmlAccessorType(XmlAccessType
.FIELD
)
58 @XmlType(name
= "Institution", propOrder
= {
64 @XmlRootElement(name
= "Institution")
66 @Indexed(index
= "eu.etaxonomy.cdm.model.agent.AgentBase")
69 public class Institution
extends AgentBase
<IIdentifiableEntityCacheStrategy
<Institution
>> {
70 private static final long serialVersionUID
= -951321271656955808L;
71 public static final Logger logger
= Logger
.getLogger(Institution
.class);
73 @XmlElement(name
= "Code")
74 @Field(index
=Index
.TOKENIZED
)
77 @XmlElement(name
= "Name")
78 @Field(index
=Index
.TOKENIZED
)
81 @XmlElementWrapper(name
= "Types")
82 @XmlElement(name
= "Type")
84 @XmlSchemaType(name
= "IDREF")
85 @ManyToMany(fetch
= FetchType
.LAZY
)
86 private Set
<InstitutionType
> types
= new HashSet
<InstitutionType
>();
88 @XmlElement(name
= "IsPartOf")
90 @XmlSchemaType(name
= "IDREF")
91 @ManyToOne(fetch
= FetchType
.LAZY
)
92 @Cascade(CascadeType
.SAVE_UPDATE
)
93 private Institution isPartOf
;
96 * Creates a new empty institution instance.
98 public static Institution
NewInstance(){
99 return new Institution();
106 public Institution() {
108 this.cacheStrategy
= new IdentifiableEntityDefaultCacheStrategy
<Institution
>();
112 * Returns the set of institution {@link InstitutionType types} (categories)
113 * used to describe or circumscribe <i>this</i> institution's activities.
114 * Institution types are items of a controlled {@link eu.etaxonomy.cdm.model.common.TermVocabulary vocabulary}.
116 * @return the set of institution types
117 * @see InstitutionType
119 public Set
<InstitutionType
> getTypes(){
124 * Adds a new institutional type (from the corresponding {@link eu.etaxonomy.cdm.model.common.TermVocabulary vocabulary})
125 * to the set of institution types of <i>this</i> institution.
127 * @param t any type of institution
129 * @see InstitutionType
131 public void addType(InstitutionType t
){
136 * Removes one element from the set of institution types for <i>this</i> institution.
138 * @param t the institution type which should be deleted
141 public void removeType(InstitutionType t
){
142 this.types
.remove(t
);
146 * Returns the parent institution of this institution.
147 * This is for instance the case when this institution is a herbarium
148 * belonging to a parent institution such as a museum.
150 public Institution
getIsPartOf(){
151 return this.isPartOf
;
155 * Assigns a parent institution to which this institution belongs.
157 * @param isPartOf the parent institution
158 * @see #getIsPartOf()
160 public void setIsPartOf(Institution isPartOf
){
161 this.isPartOf
= isPartOf
;
165 * Returns the string representing the code (can also be an acronym or initials)
166 * by which this institution is known among experts.
168 public String
getCode(){
174 public void setCode(String code
){
180 * Returns the full name, as distinct from a code, an acronym or initials,
181 * by which this institution is generally known.
183 public String
getName(){
189 public void setName(String name
){