1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.model.location;
|
11
|
|
12
|
|
13
|
import java.util.HashMap;
|
14
|
import java.util.Map;
|
15
|
import java.util.UUID;
|
16
|
|
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;
|
22
|
|
23
|
import org.apache.log4j.Logger;
|
24
|
import org.hibernate.envers.Audited;
|
25
|
|
26
|
import eu.etaxonomy.cdm.model.common.DefaultTermInitializer;
|
27
|
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
|
28
|
import eu.etaxonomy.cdm.model.common.TermVocabulary;
|
29
|
|
30
|
/**
|
31
|
* Reference systems for coordinates also according to OGC (Open Geographical
|
32
|
* Consortium) The list should be extensible at runtime through configuration.
|
33
|
* This needs to be investigated.
|
34
|
* @author m.doering
|
35
|
* @version 1.0
|
36
|
* @created 08-Nov-2007 13:06:49
|
37
|
*/
|
38
|
@XmlAccessorType(XmlAccessType.FIELD)
|
39
|
@XmlType(name = "ReferenceSystem")
|
40
|
@XmlRootElement(name = "ReferenceSystem")
|
41
|
@Entity
|
42
|
@Audited
|
43
|
public class ReferenceSystem extends DefinedTermBase<ReferenceSystem> {
|
44
|
private static final long serialVersionUID = 2704455299046749175L;
|
45
|
@SuppressWarnings("unused")
|
46
|
private static final Logger logger = Logger.getLogger(ReferenceSystem.class);
|
47
|
|
48
|
protected static Map<UUID, ReferenceSystem> termMap = null;
|
49
|
|
50
|
private static final UUID uuidWGS84 = UUID.fromString("63f4dd55-00fa-49e7-96fd-2b7059a1c1ee");
|
51
|
|
52
|
/**
|
53
|
* Factory method
|
54
|
* @return
|
55
|
*/
|
56
|
public static ReferenceSystem NewInstance(){
|
57
|
return new ReferenceSystem();
|
58
|
}
|
59
|
|
60
|
/**
|
61
|
* Factory method
|
62
|
* @return
|
63
|
*/
|
64
|
public static ReferenceSystem NewInstance(String term, String label, String labelAbbrev){
|
65
|
return new ReferenceSystem(term, label, labelAbbrev);
|
66
|
}
|
67
|
|
68
|
/**
|
69
|
* Constructor
|
70
|
*/
|
71
|
public ReferenceSystem() {
|
72
|
}
|
73
|
|
74
|
/**
|
75
|
* Constructor
|
76
|
*/
|
77
|
private ReferenceSystem(String term, String label, String labelAbbrev) {
|
78
|
super(term, label, labelAbbrev);
|
79
|
}
|
80
|
|
81
|
|
82
|
protected static ReferenceSystem getTermByUuid(UUID uuid){
|
83
|
if (termMap == null){
|
84
|
DefaultTermInitializer vocabularyStore = new DefaultTermInitializer();
|
85
|
vocabularyStore.initialize();
|
86
|
}
|
87
|
return (ReferenceSystem)termMap.get(uuid);
|
88
|
}
|
89
|
|
90
|
public static final ReferenceSystem WGS84(){
|
91
|
return getTermByUuid(uuidWGS84);
|
92
|
}
|
93
|
|
94
|
@Override
|
95
|
protected void setDefaultTerms(TermVocabulary<ReferenceSystem> termVocabulary){
|
96
|
termMap = new HashMap<UUID, ReferenceSystem>();
|
97
|
for (ReferenceSystem term : termVocabulary.getTerms()){
|
98
|
termMap.put(term.getUuid(), term);
|
99
|
}
|
100
|
}
|
101
|
|
102
|
}
|