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
.location
;
13 import java
.util
.HashMap
;
15 import java
.util
.UUID
;
17 import javax
.persistence
.Entity
;
18 import javax
.xml
.bind
.annotation
.XmlAccessType
;
19 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
20 import javax
.xml
.bind
.annotation
.XmlRootElement
;
21 import javax
.xml
.bind
.annotation
.XmlType
;
23 import org
.apache
.log4j
.Logger
;
24 import org
.hibernate
.envers
.Audited
;
25 import org
.hibernate
.search
.annotations
.Indexed
;
27 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
28 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
31 * Controlled vocabulary to differentiate categories of areas
34 * @created 08-Nov-2007 13:06:37
36 @XmlAccessorType(XmlAccessType
.FIELD
)
37 @XmlType(name
= "NamedAreaType")
38 @XmlRootElement(name
= "NamedAreaType")
40 @Indexed(index
= "eu.etaxonomy.cdm.model.common.DefinedTermBase")
42 public class NamedAreaType
extends DefinedTermBase
<NamedAreaType
> {
43 private static final long serialVersionUID
= 8280172429797206548L;
44 private static final Logger logger
= Logger
.getLogger(NamedAreaType
.class);
46 protected static Map
<UUID
, NamedAreaType
> termMap
= null;
48 private static final UUID uuidNaturalArea
= UUID
.fromString("cc33167c-d366-4030-b984-6b14e4f5fd22");
49 private static final UUID uuidAdministrationArea
= UUID
.fromString("1799f581-f425-40d6-a4db-ec2c638c0e92");
56 public static NamedAreaType
NewInstance(String term
, String label
, String labelAbbrev
){
57 logger
.debug("NewInstance");
58 return new NamedAreaType(term
, label
, labelAbbrev
);
64 public NamedAreaType(String term
, String label
, String labelAbbrev
) {
65 super(term
, label
, labelAbbrev
);
68 public NamedAreaType(){
71 //************************** METHODS ********************************
75 * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms()
78 public void resetTerms(){
83 protected static NamedAreaType
getTermByUuid(UUID uuid
){
85 return null; //better return null then initialize the termMap in an unwanted way
87 return (NamedAreaType
)termMap
.get(uuid
);
91 * The boundaries are given by natural factors (mountains, valleys, climate, etc.)
93 public static final NamedAreaType
NATURAL_AREA(){
94 return getTermByUuid(uuidNaturalArea
);
98 * The boundaries depend on administration (county, state, reserve, etc.)
100 public static final NamedAreaType
ADMINISTRATION_AREA(){
101 return getTermByUuid(uuidAdministrationArea
);
105 protected void setDefaultTerms(TermVocabulary
<NamedAreaType
> termVocabulary
) {
106 termMap
= new HashMap
<UUID
, NamedAreaType
>();
107 for (NamedAreaType term
: termVocabulary
.getTerms()){
108 termMap
.put(term
.getUuid(), (NamedAreaType
)term
);