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
.xml
.bind
.annotation
.XmlAccessType
;
21 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
22 import javax
.xml
.bind
.annotation
.XmlElement
;
23 import javax
.xml
.bind
.annotation
.XmlElementWrapper
;
24 import javax
.xml
.bind
.annotation
.XmlIDREF
;
25 import javax
.xml
.bind
.annotation
.XmlRootElement
;
26 import javax
.xml
.bind
.annotation
.XmlSchemaType
;
27 import javax
.xml
.bind
.annotation
.XmlType
;
29 import org
.apache
.log4j
.Logger
;
30 import org
.hibernate
.annotations
.Cascade
;
31 import org
.hibernate
.annotations
.CascadeType
;
32 import org
.hibernate
.envers
.Audited
;
33 import org
.hibernate
.search
.annotations
.Field
;
34 import org
.hibernate
.search
.annotations
.Index
;
35 import org
.hibernate
.search
.annotations
.Indexed
;
36 import org
.springframework
.beans
.factory
.annotation
.Configurable
;
38 import eu
.etaxonomy
.cdm
.strategy
.cache
.common
.IIdentifiableEntityCacheStrategy
;
39 import eu
.etaxonomy
.cdm
.strategy
.cache
.common
.IdentifiableEntityDefaultCacheStrategy
;
42 * This class represents public or private institutions.
43 * It includes name, contact details and institution type.
45 * This class corresponds to: <ul>
46 * <li> Institution according to the TDWG ontology
47 * <li> Institution according to the TCS
48 * <li> Organisation (Institution) according to the ABCD schema
53 * @created 08-Nov-2007 13:06:29
55 @XmlAccessorType(XmlAccessType
.FIELD
)
56 @XmlType(name
= "Institution", propOrder
= {
62 @XmlRootElement(name
= "Institution")
64 @Indexed(index
= "eu.etaxonomy.cdm.model.agent.AgentBase")
67 public class Institution
extends AgentBase
<IIdentifiableEntityCacheStrategy
<Institution
>> {
68 private static final long serialVersionUID
= -951321271656955808L;
69 public static final Logger logger
= Logger
.getLogger(Institution
.class);
71 @XmlElement(name
= "Code")
72 @Field(index
=Index
.TOKENIZED
)
75 @XmlElement(name
= "Name")
76 @Field(index
=Index
.TOKENIZED
)
79 @XmlElementWrapper(name
= "Types")
80 @XmlElement(name
= "Type")
82 @XmlSchemaType(name
= "IDREF")
83 @ManyToMany(fetch
= FetchType
.LAZY
)
84 private Set
<InstitutionType
> types
= new HashSet
<InstitutionType
>();
86 @XmlElement(name
= "IsPartOf")
88 @XmlSchemaType(name
= "IDREF")
89 @ManyToOne(fetch
= FetchType
.LAZY
)
90 @Cascade(CascadeType
.SAVE_UPDATE
)
91 private Institution isPartOf
;
94 * Creates a new empty institution instance.
96 public static Institution
NewInstance(){
97 return new Institution();
104 public Institution() {
106 this.cacheStrategy
= new IdentifiableEntityDefaultCacheStrategy
<Institution
>();
110 * Returns the set of institution {@link InstitutionType types} (categories)
111 * used to describe or circumscribe <i>this</i> institution's activities.
112 * Institution types are items of a controlled {@link eu.etaxonomy.cdm.model.common.TermVocabulary vocabulary}.
114 * @return the set of institution types
115 * @see InstitutionType
117 public Set
<InstitutionType
> getTypes(){
122 * Adds a new institutional type (from the corresponding {@link eu.etaxonomy.cdm.model.common.TermVocabulary vocabulary})
123 * to the set of institution types of <i>this</i> institution.
125 * @param t any type of institution
127 * @see InstitutionType
129 public void addType(InstitutionType t
){
134 * Removes one element from the set of institution types for <i>this</i> institution.
136 * @param t the institution type which should be deleted
139 public void removeType(InstitutionType t
){
140 this.types
.remove(t
);
144 * Returns the parent institution of this institution.
145 * This is for instance the case when this institution is a herbarium
146 * belonging to a parent institution such as a museum.
148 public Institution
getIsPartOf(){
149 return this.isPartOf
;
153 * Assigns a parent institution to which this institution belongs.
155 * @param isPartOf the parent institution
156 * @see #getIsPartOf()
158 public void setIsPartOf(Institution isPartOf
){
159 this.isPartOf
= isPartOf
;
163 * Returns the string representing the code (can also be an acronym or initials)
164 * by which this institution is known among experts.
166 public String
getCode(){
172 public void setCode(String code
){
178 * Returns the full name, as distinct from a code, an acronym or initials,
179 * by which this institution is generally known.
181 public String
getName(){
187 public void setName(String name
){