1 |
9479da48
|
Andreas Müller
|
/**
|
2 |
|
|
* Copyright (C) 2007 EDIT
|
3 |
2aa73e7b
|
Cherian Mathew
|
* European Distributed Institute of Taxonomy
|
4 |
9479da48
|
Andreas Müller
|
* http://www.e-taxonomy.eu
|
5 |
2aa73e7b
|
Cherian Mathew
|
*
|
6 |
9479da48
|
Andreas Müller
|
* 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.common;
|
11 |
|
|
|
12 |
|
|
|
13 |
a065745f
|
Andreas Müller
|
import java.util.HashMap;
|
14 |
294bd6f5
|
em.lee
|
import java.util.List;
|
15 |
a065745f
|
Andreas Müller
|
import java.util.Map;
|
16 |
|
|
import java.util.UUID;
|
17 |
|
|
|
18 |
fd7ee7b1
|
ben.clark
|
import javax.persistence.Entity;
|
19 |
01b7ddbf
|
a.babadshanjan
|
import javax.xml.bind.annotation.XmlAccessType;
|
20 |
|
|
import javax.xml.bind.annotation.XmlAccessorType;
|
21 |
|
|
import javax.xml.bind.annotation.XmlType;
|
22 |
9479da48
|
Andreas Müller
|
|
23 |
fd7ee7b1
|
ben.clark
|
import org.apache.log4j.Logger;
|
24 |
|
|
import org.hibernate.envers.Audited;
|
25 |
|
|
|
26 |
1d36aa54
|
Andreas Müller
|
|
27 |
9479da48
|
Andreas Müller
|
/**
|
28 |
|
|
* Extension types similar to dynamically defined attributes. These are not data
|
29 |
|
|
* types, but rather content types like "DOI", "2nd nomenclatural reference", "3rd
|
30 |
|
|
* hybrid parent" or specific local identifiers.
|
31 |
|
|
* @author m.doering
|
32 |
|
|
* @created 08-Nov-2007 13:06:23
|
33 |
|
|
*/
|
34 |
01b7ddbf
|
a.babadshanjan
|
@XmlAccessorType(XmlAccessType.FIELD)
|
35 |
|
|
@XmlType(name = "ExtensionType")
|
36 |
9479da48
|
Andreas Müller
|
@Entity
|
37 |
c70a7f0f
|
Andreas Kohlbecker
|
//@Indexed disabled to reduce clutter in indexes, since this type is not used by any search
|
38 |
|
|
//@Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase")
|
39 |
ee91bcd9
|
ben.clark
|
@Audited
|
40 |
f6765014
|
ben.clark
|
public class ExtensionType extends DefinedTermBase<ExtensionType> {
|
41 |
0d575644
|
Andreas Müller
|
private static final long serialVersionUID = -7761963794004133427L;
|
42 |
136a3660
|
Andreas Müller
|
@SuppressWarnings("unused")
|
43 |
0d575644
|
Andreas Müller
|
private static final Logger logger = Logger.getLogger(ExtensionType.class);
|
44 |
9479da48
|
Andreas Müller
|
|
45 |
a065745f
|
Andreas Müller
|
private static final UUID uuidXmlFragment = UUID.fromString("ea109c1c-e69b-4e6d-9079-1941b9ee2991");
|
46 |
|
|
private static final UUID uuidRdfFragment = UUID.fromString("f3684e25-dcad-4c1e-a5d8-16cddf1c4f5b");
|
47 |
|
|
private static final UUID uuidDoi = UUID.fromString("f079aacc-ab08-4cc4-90a0-6d3958fb0dbf");
|
48 |
892efc69
|
Andreas Kohlbecker
|
// private static final UUID uuid2ndNomRef = UUID.fromString("46a98bfa-f11a-47fe-a6c5-50c7e8289b3d");
|
49 |
a065745f
|
Andreas Müller
|
private static final UUID uuid3rdHybridParent = UUID.fromString("5e552b24-5a2d-498d-a4f4-ccd8e5bc2bae");
|
50 |
|
|
private static final UUID uuidAreaOfInterest = UUID.fromString("cefa478e-604f-4db4-8afc-25e06c28ec69");
|
51 |
|
|
private static final UUID uuidNomStandard = UUID.fromString("4a6cbbe9-8d79-4d15-b316-2ff1adeff526");
|
52 |
|
|
private static final UUID uuidAbbreviation = UUID.fromString("5837e34e-b0f5-4736-8083-ff5eaecd8c43");
|
53 |
136a3660
|
Andreas Müller
|
private static final UUID uuidOrder = UUID.fromString("ecb7770d-a295-49ee-a88f-e9e137a7cabb");
|
54 |
|
|
private static final UUID uuidInformalCategory = UUID.fromString("11bbc52f-a085-43d3-9f9b-cbe0d1eb9a91");
|
55 |
9cc4226b
|
Katja Luther
|
private static final UUID uuidUrl = UUID.fromString("d769fa9f-51ee-4e11-8152-b5ce72b7f413");
|
56 |
a065745f
|
Andreas Müller
|
|
57 |
2aa73e7b
|
Cherian Mathew
|
protected static Map<UUID, ExtensionType> termMap = null;
|
58 |
|
|
|
59 |
|
|
/**
|
60 |
294bd6f5
|
em.lee
|
* Creates a new empty extension type instance.
|
61 |
2aa73e7b
|
Cherian Mathew
|
*
|
62 |
294bd6f5
|
em.lee
|
* @see #NewInstance(String, String, String)
|
63 |
|
|
*/
|
64 |
|
|
public static ExtensionType NewInstance() {
|
65 |
|
|
return new ExtensionType();
|
66 |
|
|
}
|
67 |
2aa73e7b
|
Cherian Mathew
|
|
68 |
|
|
/**
|
69 |
294bd6f5
|
em.lee
|
* Creates a new extension type instance with a description (in the {@link Language#DEFAULT() default language}),
|
70 |
|
|
* a label and a label abbreviation.
|
71 |
2aa73e7b
|
Cherian Mathew
|
*
|
72 |
294bd6f5
|
em.lee
|
* @param term the string (in the default language) describing the
|
73 |
2aa73e7b
|
Cherian Mathew
|
* new extension type to be created
|
74 |
294bd6f5
|
em.lee
|
* @param label the string identifying the new extension type to be created
|
75 |
|
|
* @param labelAbbrev the string identifying (in abbreviated form) the
|
76 |
|
|
* new extension type to be created
|
77 |
|
|
* @see #readCsvLine(List, Language)
|
78 |
|
|
* @see #NewInstance()
|
79 |
|
|
*/
|
80 |
|
|
public static ExtensionType NewInstance(String term, String label, String labelAbbrev){
|
81 |
|
|
return new ExtensionType(term, label, labelAbbrev);
|
82 |
|
|
}
|
83 |
8cc82a87
|
Andreas Müller
|
|
84 |
2aa73e7b
|
Cherian Mathew
|
//********************************** Constructor *******************************************************************/
|
85 |
|
|
|
86 |
9e3239f6
|
Andreas Müller
|
//for hibernate use only
|
87 |
294bd6f5
|
em.lee
|
@Deprecated
|
88 |
9e3239f6
|
Andreas Müller
|
protected ExtensionType() {
|
89 |
|
|
super(TermType.ExtensionType);
|
90 |
9479da48
|
Andreas Müller
|
}
|
91 |
2aa73e7b
|
Cherian Mathew
|
|
92 |
|
|
/**
|
93 |
294bd6f5
|
em.lee
|
* Class constructor: creates a new extension type instance with a description (in the {@link Language#DEFAULT() default language}),
|
94 |
|
|
* a label and a label abbreviation.
|
95 |
2aa73e7b
|
Cherian Mathew
|
*
|
96 |
294bd6f5
|
em.lee
|
* @param term the string (in the default language) describing the
|
97 |
2aa73e7b
|
Cherian Mathew
|
* new extension type to be created
|
98 |
294bd6f5
|
em.lee
|
* @param label the string identifying the new extension type to be created
|
99 |
|
|
* @param labelAbbrev the string identifying (in abbreviated form) the
|
100 |
|
|
* new extension type to be created
|
101 |
|
|
* @see #ExtensionType()
|
102 |
|
|
*/
|
103 |
|
|
protected ExtensionType(String term, String label, String labelAbbrev) {
|
104 |
533cbb43
|
Andreas Müller
|
super(TermType.ExtensionType, term, label, labelAbbrev);
|
105 |
9479da48
|
Andreas Müller
|
}
|
106 |
|
|
|
107 |
8cc82a87
|
Andreas Müller
|
//************************** METHODS *******************************************************/
|
108 |
2aa73e7b
|
Cherian Mathew
|
|
109 |
|
|
|
110 |
8cc82a87
|
Andreas Müller
|
/* (non-Javadoc)
|
111 |
|
|
* @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms()
|
112 |
|
|
*/
|
113 |
|
|
@Override
|
114 |
|
|
public void resetTerms(){
|
115 |
|
|
termMap = null;
|
116 |
|
|
}
|
117 |
|
|
|
118 |
2aa73e7b
|
Cherian Mathew
|
|
119 |
a065745f
|
Andreas Müller
|
protected static ExtensionType getTermByUuid(UUID uuid){
|
120 |
2aa73e7b
|
Cherian Mathew
|
if (termMap == null || termMap.isEmpty()){
|
121 |
|
|
return getTermByClassAndUUID(ExtensionType.class, uuid);
|
122 |
|
|
} else {
|
123 |
|
|
return termMap.get(uuid);
|
124 |
|
|
}
|
125 |
a065745f
|
Andreas Müller
|
}
|
126 |
9479da48
|
Andreas Müller
|
|
127 |
2aa73e7b
|
Cherian Mathew
|
|
128 |
9479da48
|
Andreas Müller
|
public static final ExtensionType XML_FRAGMENT(){
|
129 |
a065745f
|
Andreas Müller
|
return getTermByUuid(uuidXmlFragment);
|
130 |
9479da48
|
Andreas Müller
|
}
|
131 |
|
|
|
132 |
|
|
public static final ExtensionType RDF_FRAGMENT(){
|
133 |
a065745f
|
Andreas Müller
|
return getTermByUuid(uuidRdfFragment);
|
134 |
|
|
}
|
135 |
|
|
|
136 |
|
|
public static final ExtensionType DOI(){
|
137 |
|
|
return getTermByUuid(uuidDoi);
|
138 |
|
|
}
|
139 |
|
|
|
140 |
|
|
|
141 |
892efc69
|
Andreas Kohlbecker
|
// public static final ExtensionType SECOND_NOM_REF(){
|
142 |
|
|
// return getTermByUuid(uuid2ndNomRef);
|
143 |
|
|
// }
|
144 |
a065745f
|
Andreas Müller
|
|
145 |
|
|
|
146 |
|
|
public static final ExtensionType THIRD_HYBRID_PARENT(){
|
147 |
|
|
return getTermByUuid(uuid3rdHybridParent);
|
148 |
|
|
}
|
149 |
2aa73e7b
|
Cherian Mathew
|
|
150 |
a065745f
|
Andreas Müller
|
public static final ExtensionType AREA_OF_INTREREST(){
|
151 |
|
|
return getTermByUuid(uuidAreaOfInterest);
|
152 |
|
|
}
|
153 |
2aa73e7b
|
Cherian Mathew
|
|
154 |
a065745f
|
Andreas Müller
|
public static final ExtensionType NOMENCLATURAL_STANDARD(){
|
155 |
|
|
return getTermByUuid(uuidNomStandard);
|
156 |
|
|
}
|
157 |
2aa73e7b
|
Cherian Mathew
|
|
158 |
a065745f
|
Andreas Müller
|
public static final ExtensionType ABBREVIATION(){
|
159 |
|
|
return getTermByUuid(uuidAbbreviation);
|
160 |
|
|
}
|
161 |
2aa73e7b
|
Cherian Mathew
|
|
162 |
136a3660
|
Andreas Müller
|
public static final ExtensionType ORDER(){
|
163 |
|
|
return getTermByUuid(uuidOrder);
|
164 |
|
|
}
|
165 |
2aa73e7b
|
Cherian Mathew
|
|
166 |
136a3660
|
Andreas Müller
|
public static final ExtensionType INFORMAL_CATEGORY(){
|
167 |
|
|
return getTermByUuid(uuidInformalCategory);
|
168 |
|
|
}
|
169 |
9cc4226b
|
Katja Luther
|
|
170 |
|
|
public static final ExtensionType URL(){
|
171 |
|
|
return getTermByUuid(uuidUrl);
|
172 |
|
|
}
|
173 |
2aa73e7b
|
Cherian Mathew
|
|
174 |
|
|
|
175 |
f6765014
|
ben.clark
|
@Override
|
176 |
|
|
protected void setDefaultTerms(TermVocabulary<ExtensionType> termVocabulary) {
|
177 |
a065745f
|
Andreas Müller
|
termMap = new HashMap<UUID, ExtensionType>();
|
178 |
|
|
for (ExtensionType term : termVocabulary.getTerms()){
|
179 |
d11e2ca0
|
a.babadshanjan
|
termMap.put(term.getUuid(), term);
|
180 |
a065745f
|
Andreas Müller
|
}
|
181 |
f6765014
|
ben.clark
|
}
|
182 |
9479da48
|
Andreas Müller
|
|
183 |
d45008d0
|
Andreas Kohlbecker
|
}
|