| 1 | // $Id$ |
|---|
| 2 | /** |
|---|
| 3 | * Copyright (C) 2007 EDIT |
|---|
| 4 | * European Distributed Institute of Taxonomy |
|---|
| 5 | * http://www.e-taxonomy.eu |
|---|
| 6 | * |
|---|
| 7 | * The contents of this file are subject to the Mozilla Public License Version 1.1 |
|---|
| 8 | * See LICENSE.TXT at the top of this package for the full license terms. |
|---|
| 9 | */ |
|---|
| 10 | |
|---|
| 11 | package eu.etaxonomy.cdm.model.common; |
|---|
| 12 | |
|---|
| 13 | import java.util.UUID; |
|---|
| 14 | |
|---|
| 15 | import eu.etaxonomy.cdm.model.agent.InstitutionType; |
|---|
| 16 | import eu.etaxonomy.cdm.model.description.AbsenceTerm; |
|---|
| 17 | import eu.etaxonomy.cdm.model.description.Feature; |
|---|
| 18 | import eu.etaxonomy.cdm.model.description.MeasurementUnit; |
|---|
| 19 | import eu.etaxonomy.cdm.model.description.Modifier; |
|---|
| 20 | import eu.etaxonomy.cdm.model.description.NaturalLanguageTerm; |
|---|
| 21 | import eu.etaxonomy.cdm.model.description.PresenceTerm; |
|---|
| 22 | import eu.etaxonomy.cdm.model.description.Scope; |
|---|
| 23 | import eu.etaxonomy.cdm.model.description.Sex; |
|---|
| 24 | import eu.etaxonomy.cdm.model.description.Stage; |
|---|
| 25 | import eu.etaxonomy.cdm.model.description.State; |
|---|
| 26 | import eu.etaxonomy.cdm.model.description.StatisticalMeasure; |
|---|
| 27 | import eu.etaxonomy.cdm.model.description.TextFormat; |
|---|
| 28 | import eu.etaxonomy.cdm.model.location.Continent; |
|---|
| 29 | import eu.etaxonomy.cdm.model.location.NamedAreaLevel; |
|---|
| 30 | import eu.etaxonomy.cdm.model.location.NamedAreaType; |
|---|
| 31 | import eu.etaxonomy.cdm.model.location.ReferenceSystem; |
|---|
| 32 | import eu.etaxonomy.cdm.model.location.TdwgArea; |
|---|
| 33 | import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry; |
|---|
| 34 | import eu.etaxonomy.cdm.model.media.RightsTerm; |
|---|
| 35 | import eu.etaxonomy.cdm.model.name.HybridRelationshipType; |
|---|
| 36 | import eu.etaxonomy.cdm.model.name.NameRelationshipType; |
|---|
| 37 | import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus; |
|---|
| 38 | import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
|---|
| 39 | import eu.etaxonomy.cdm.model.name.Rank; |
|---|
| 40 | import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus; |
|---|
| 41 | import eu.etaxonomy.cdm.model.occurrence.DerivationEventType; |
|---|
| 42 | import eu.etaxonomy.cdm.model.occurrence.DeterminationModifier; |
|---|
| 43 | import eu.etaxonomy.cdm.model.occurrence.PreservationMethod; |
|---|
| 44 | import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType; |
|---|
| 45 | import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
|---|
| 46 | |
|---|
| 47 | /** |
|---|
| 48 | * @author n.hoffmann |
|---|
| 49 | * @created 03.06.2009 |
|---|
| 50 | * @version 1.0 |
|---|
| 51 | * |
|---|
| 52 | * @deprecated |
|---|
| 53 | * A static list of vocabularies is not the right way to do this. |
|---|
| 54 | * We will use a service method that will return vocabularies by term type (once that is implemented) |
|---|
| 55 | */ |
|---|
| 56 | @Deprecated |
|---|
| 57 | public enum VocabularyEnum { |
|---|
| 58 | |
|---|
| 59 | Language("45ac7043-7f5e-4f37-92f2-3874aaaef2de", Language.class), |
|---|
| 60 | UndefinedLanguage("7fd1e6d0-2e76-4dfa-bad9-2673dd042c28", Language.class), |
|---|
| 61 | Continent("e72cbcb6-58f8-4201-9774-15d0c6abc128", Continent.class), |
|---|
| 62 | WaterbodyOrCountry("006b1870-7347-4624-990f-e5ed78484a1a", WaterbodyOrCountry.class), |
|---|
| 63 | Rank("ef0d1ce1-26e3-4e83-b47b-ca74eed40b1b", Rank.class), |
|---|
| 64 | SpecimenTypeDesignationStatus("ab177bd7-d3c8-4e58-a388-226fff6ba3c2", SpecimenTypeDesignationStatus.class), |
|---|
| 65 | NomenclaturalStatusType("bb28cdca-2f8a-4f11-9c21-517e9ae87f1f", NomenclaturalStatusType.class), |
|---|
| 66 | SynonymRelationshipType("48917fde-d083-4659-b07d-413db843bd50", SynonymRelationshipType.class), |
|---|
| 67 | HybridRelationshipType("fc4abe52-9c25-4cfa-a682-8615bf4bbf07", HybridRelationshipType.class), |
|---|
| 68 | NameRelationshipType("6878cb82-c1a4-4613-b012-7e73b413c8cd", NameRelationshipType.class), |
|---|
| 69 | TaxonRelationshipType("15db0cf7-7afc-4a86-a7d4-221c73b0c9ac", TaxonRelationshipType.class), |
|---|
| 70 | MarkerType("19dffff7-e142-429c-a420-5d28e4ebe305", MarkerType.class), |
|---|
| 71 | AnnotationType("ca04609b-1ba0-4d31-9c2e-aa8eb2f4e62d", AnnotationType.class), |
|---|
| 72 | NamedAreaType("e51d52d6-965b-4f7d-900f-4ba9c6f5dd33", NamedAreaType.class), |
|---|
| 73 | NamedAreaLevel("49034253-27c8-4219-97e8-f8d987d3d122", NamedAreaLevel.class), |
|---|
| 74 | Feature("b187d555-f06f-4d65-9e53-da7c93f8eaa8", Feature.class), |
|---|
| 75 | NameFeature("a7ca3eef-4092-49e1-beec-ed5096193e5e", Feature.class), |
|---|
| 76 | TdwgArea("1fb40504-d1d7-44b0-9731-374fbe6cac77", TdwgArea.class), |
|---|
| 77 | PresenceTerm("adbbbe15-c4d3-47b7-80a8-c7d104e53a05", PresenceTerm.class), |
|---|
| 78 | AbsenceTerm("5cd438c8-a8a1-4958-842e-169e83e2ceee", AbsenceTerm.class), |
|---|
| 79 | Sex("9718b7dd-8bc0-4cad-be57-3c54d4d432fe", Sex.class), |
|---|
| 80 | DerivationEventType("398b50bb-348e-4fe0-a7f5-a75afd846d1f", DerivationEventType.class), |
|---|
| 81 | PreservationMethod("a7dc20c9-e6b3-459e-8f05-8d6d8fceb465", PreservationMethod.class), |
|---|
| 82 | DeterminationModifier("fe87ea8d-6e0a-4e5d-b0da-0ab8ea67ca77", DeterminationModifier.class), |
|---|
| 83 | StatisticalMeasure("066cc62e-7213-495e-a020-97a1233bc037", StatisticalMeasure.class), |
|---|
| 84 | RightsTerm("8627c526-73af-44d9-902c-11c1f11b60b4", RightsTerm.class), |
|---|
| 85 | NameTypeDesignationStatus("ab60e738-4d09-4c24-a1b3-9466b01f9f55", NameTypeDesignationStatus.class), |
|---|
| 86 | ExtensionType("117cc307-5bd4-4b10-9b2f-2e14051b3b20",ExtensionType.class), |
|---|
| 87 | ReferenceSystem("ec6376e5-0c9c-4f5c-848b-b288e6c17a86",ReferenceSystem.class), |
|---|
| 88 | InstitutionType("29ad808b-3126-4274-be81-4561e7afc76f", InstitutionType.class), |
|---|
| 89 | MeasurementUnit("3b82c375-66bb-4636-be74-dc9cd087292a", MeasurementUnit.class), |
|---|
| 90 | Scope("109bf76d-6f55-43d5-9ec5-6115d9490faa", Scope.class), |
|---|
| 91 | Stage("4d475bea-c3ae-4494-be16-6796f22fabac", Stage.class), |
|---|
| 92 | State("ceb65a53-c6cf-42bb-862f-daca7f2fc11d", State.class), |
|---|
| 93 | TextFormat("ac3926d2-5f6b-45a5-9cf9-be2a5a43f9b3", TextFormat.class), |
|---|
| 94 | // NamedArea("57c25420-ae94-4848-9513-2aff9bdb502c", NamedArea.class), |
|---|
| 95 | NaturalLanguageTerm("fdaba4b0-5c14-11df-a08a-0800200c9a66", NaturalLanguageTerm.class), |
|---|
| 96 | Modifier("b9434774-4931-4f1e-99cb-40a3ecd61777", Modifier.class) |
|---|
| 97 | ; |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | private UUID uuid; |
|---|
| 101 | private Class<? extends DefinedTermBase<?>> clazz; |
|---|
| 102 | |
|---|
| 103 | private VocabularyEnum(String uuidString, Class<? extends DefinedTermBase<?>> clazz){ |
|---|
| 104 | this.uuid = UUID.fromString(uuidString); |
|---|
| 105 | this.clazz = clazz; |
|---|
| 106 | } |
|---|
| 107 | |
|---|
| 108 | /** |
|---|
| 109 | * @return the <code>UUID</code> this vocabulary is uniquely identified with |
|---|
| 110 | */ |
|---|
| 111 | public UUID getUuid(){ |
|---|
| 112 | return uuid; |
|---|
| 113 | } |
|---|
| 114 | |
|---|
| 115 | /** |
|---|
| 116 | * @return the Class of a specific term vocabulary |
|---|
| 117 | */ |
|---|
| 118 | public Class<? extends DefinedTermBase<?>> getClazz(){ |
|---|
| 119 | return clazz; |
|---|
| 120 | } |
|---|
| 121 | |
|---|
| 122 | public static VocabularyEnum getVocabularyEnum(Class clazz){ |
|---|
| 123 | |
|---|
| 124 | for(VocabularyEnum vocabulary : VocabularyEnum.values()){ |
|---|
| 125 | if(vocabulary.getClazz().equals(clazz)){ |
|---|
| 126 | return vocabulary; |
|---|
| 127 | } |
|---|
| 128 | } |
|---|
| 129 | |
|---|
| 130 | return null; |
|---|
| 131 | } |
|---|
| 132 | } |
|---|