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
.DefaultTermInitializer
;
28 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
29 import eu
.etaxonomy
.cdm
.model
.common
.TermType
;
30 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
33 * Reference systems for coordinates also according to OGC (Open Geographical
34 * Consortium) The list should be extensible at runtime through configuration.
35 * This needs to be investigated.
38 * @created 08-Nov-2007 13:06:49
40 @XmlAccessorType(XmlAccessType
.FIELD
)
41 @XmlType(name
= "ReferenceSystem")
42 @XmlRootElement(name
= "ReferenceSystem")
44 @Indexed(index
= "eu.etaxonomy.cdm.model.common.DefinedTermBase")
46 public class ReferenceSystem
extends DefinedTermBase
<ReferenceSystem
> {
47 private static final long serialVersionUID
= -9060720949197749047L;
49 @SuppressWarnings("unused")
50 private static final Logger logger
= Logger
.getLogger(ReferenceSystem
.class);
52 protected static Map
<UUID
, ReferenceSystem
> termMap
= null;
54 private static final UUID uuidWGS84
= UUID
.fromString("63f4dd55-00fa-49e7-96fd-2b7059a1c1ee");
55 private static final UUID uuidGoogleEarth
= UUID
.fromString("1bb67042-2814-4b09-9e76-c8c1e68aa281");
56 private static final UUID uuidGazetteer
= UUID
.fromString("e35f1d1c-9347-4190-bd47-a3b00632fcf3");
63 public static ReferenceSystem
NewInstance(){
64 return new ReferenceSystem();
71 public static ReferenceSystem
NewInstance(String term
, String label
, String labelAbbrev
){
72 return new ReferenceSystem(term
, label
, labelAbbrev
);
75 //********************************** Constructor *******************************************************************/
77 //for hibernate use only
79 protected ReferenceSystem() {
80 super(TermType
.ReferenceSystem
);
86 private ReferenceSystem(String term
, String label
, String labelAbbrev
) {
87 super(TermType
.ReferenceSystem
, term
, label
, labelAbbrev
);
90 // ************************************* MTEHODS ***************************************************/
93 * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms()
96 public void resetTerms(){
102 protected static ReferenceSystem
getTermByUuid(UUID uuid
){
103 if (termMap
== null){
104 DefaultTermInitializer vocabularyStore
= new DefaultTermInitializer();
105 vocabularyStore
.initialize();
107 return (ReferenceSystem
)termMap
.get(uuid
);
110 public static final ReferenceSystem
WGS84(){
111 return getTermByUuid(uuidWGS84
);
114 public static final ReferenceSystem
GOOGLE_EARTH(){
115 return getTermByUuid(uuidGoogleEarth
);
118 public static final ReferenceSystem
GAZETTEER(){
119 return getTermByUuid(uuidGazetteer
);
123 protected void setDefaultTerms(TermVocabulary
<ReferenceSystem
> termVocabulary
){
124 termMap
= new HashMap
<UUID
, ReferenceSystem
>();
125 for (ReferenceSystem term
: termVocabulary
.getTerms()){
126 termMap
.put(term
.getUuid(), term
);