Revision 12c8358b
Added by Andreas Müller over 15 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TermVocabulary.java | ||
---|---|---|
14 | 14 |
import org.hibernate.annotations.Cascade; |
15 | 15 |
import org.hibernate.annotations.CascadeType; |
16 | 16 |
import org.hibernate.annotations.Type; |
17 |
|
|
18 |
import eu.etaxonomy.cdm.model.common.init.DefaultVocabularyStore; |
|
19 |
import eu.etaxonomy.cdm.model.common.init.IVocabularyStore; |
|
20 |
|
|
17 | 21 |
import java.util.*; |
18 | 22 |
|
19 | 23 |
import javax.persistence.*; |
... | ... | |
46 | 50 |
public class TermVocabulary<T extends DefinedTermBase> extends TermBase implements Iterable<T> { |
47 | 51 |
static Logger logger = Logger.getLogger(TermVocabulary.class); |
48 | 52 |
|
53 |
static protected IVocabularyStore vocabularyStore = new DefaultVocabularyStore(); |
|
54 |
|
|
55 |
public static void setVocabularyStore(IVocabularyStore vocabularyStore){ |
|
56 |
DefinedTermBase.vocabularyStore = vocabularyStore; |
|
57 |
} |
|
58 |
|
|
49 | 59 |
private static final UUID uuidLanguage = UUID.fromString("17ba1c02-256d-47cf-bed0-2964ec1108ba"); |
50 | 60 |
private static final UUID uuidRank = UUID.fromString("b17451eb-4278-4179-af68-44f27aa3d151"); |
51 | 61 |
private static final UUID uuidContinent = UUID.fromString("ed4e5948-172a-424c-83d6-6fc7c7da70ed"); |
52 |
|
|
62 |
private static final UUID uuidTdwg = UUID.fromString("1fb40504-d1d7-44b0-9731-374fbe6cac77"); |
|
63 |
|
|
53 | 64 |
|
54 | 65 |
public static TermVocabulary findByUuid(UUID uuid){ |
55 |
//in tests tems may no be initialised by database access |
|
56 |
// if (!isInitialized()){ |
|
57 |
// initTermList(null); |
|
58 |
// } |
|
59 |
// return termVocabularyMap.get(uuid); |
|
60 |
//TODO |
|
61 |
logger.error("Not yet implemented"); |
|
62 |
return null; |
|
66 |
TermVocabulary<?> voc = vocabularyStore.getVocabularyByUuid(uuid); |
|
67 |
return voc; |
|
63 | 68 |
} |
64 | 69 |
public static final TermVocabulary getUUID(UUID uuid){ |
65 | 70 |
return findByUuid(uuid); |
... | ... | |
67 | 72 |
public static final TermVocabulary LANGUAGE(){ |
68 | 73 |
return getUUID(uuidLanguage); |
69 | 74 |
} |
75 |
public static final TermVocabulary TDWG(){ |
|
76 |
return getUUID(uuidTdwg); |
|
77 |
} |
|
70 | 78 |
|
71 | 79 |
//The vocabulary source (e.g. ontology) defining the terms to be loaded when a database is created for the first time. |
72 | 80 |
// Software can go and grap these terms incl labels and description. |
Also available in: Unified diff